diff options
| author | ianb <devnull@localhost> | 2005-06-08 20:20:17 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-06-08 20:20:17 +0000 |
| commit | aa9801d070e403d38b99d02112cfc961a000f727 (patch) | |
| tree | 20d9d4c9d588da7dc990bbf5344eb109498f8b65 /paste/tests | |
| parent | 335896710b457a0da854382f38bcdd355e7dd1fe (diff) | |
| download | paste-aa9801d070e403d38b99d02112cfc961a000f727.tar.gz | |
Make setup_module() work without a module passed in
Diffstat (limited to 'paste/tests')
| -rw-r--r-- | paste/tests/fixture.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/paste/tests/fixture.py b/paste/tests/fixture.py index 53dbfbb..4a1a16a 100644 --- a/paste/tests/fixture.py +++ b/paste/tests/fixture.py @@ -558,7 +558,7 @@ class TestRequest(object): self.full_url = url -def setup_module(module): +def setup_module(module=None): """ This is used by py.test if it is in the module, so do:: @@ -568,6 +568,11 @@ def setup_module(module): module. If there is a function ``reset_state`` in your module then that is also called. """ + if module is None: + # The module we were called from must be the module... + module = sys._getframe().f_back.f_globals['__name__'] + if isinstance(module, (str, unicode)): + module = sys.modules[module] try: CONFIG.current_config() except AttributeError: |
