| 41 | | except ImportError: |
|---|
| 42 | | # No tests.py file for application |
|---|
| 43 | | pass |
|---|
| 44 | | |
|---|
| | 41 | except ImportError, e: |
|---|
| | 42 | # Couldn't import tests.py. Was it due to a missing file, or |
|---|
| | 43 | # due to an import error in a tests.py that actually exists? |
|---|
| | 44 | import os.path |
|---|
| | 45 | from imp import find_module |
|---|
| | 46 | try: |
|---|
| | 47 | mod = find_module(TEST_MODULE, [os.path.dirname(app_module.__file__)]) |
|---|
| | 48 | except ImportError: |
|---|
| | 49 | # 'tests' module doesn't exist. Move on. |
|---|
| | 50 | pass |
|---|
| | 51 | else: |
|---|
| | 52 | # The module exists, so there must be an import error in the |
|---|
| | 53 | # test module itself. We don't need the module; close the file |
|---|
| | 54 | # handle returned by find_module. |
|---|
| | 55 | mod[0].close() |
|---|
| | 56 | raise |
|---|
| | 57 | |
|---|