[Tutor] Test discovery not locating module to test

boB Stepp robertvstepp at gmail.com
Thu Aug 20 05:29:24 CEST 2015

W7 64-bit.  Py 3.4.3

unittest result:

E:\Projects\mcm>python -m unittest
ERROR: test.db.test_mcm_db_mgr (unittest.loader.ModuleImportFailure)
Traceback (most recent call last):
  File "C:\Python34\lib\unittest\case.py", line 58, in testPartExecutor
  File "C:\Python34\lib\unittest\case.py", line 577, in run
  File "C:\Python34\lib\unittest\loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: test.db.test_mcm_db_mgr
Traceback (most recent call last):
  File "C:\Python34\lib\unittest\loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "C:\Python34\lib\unittest\loader.py", line 290, in _get_module_from_name
  File "E:\Projects\mcm\test\db\test_mcm_db_mgr.py", line 22, in <module>
    import mcm_db_mgr
ImportError: No module named 'mcm_db_mgr'

Ran 1 test in 0.000s

FAILED (errors=1)

Relevant code in test_mcm_db_mgr.py:

import unittest

# import modules to be tested:
import mcm_db_mgr

class MCMDBMgrTestCase(unittest.TestCase):
    def setUp(self):
        # Insert setup code here...

    def test_open_mcm_db(self):

    def tearDown(self):
        # Insert tear-down code here...

I suspect that there is something wrong with my project structure.
Currently it is as follows:


All __init__.py files are currently empty.  Alex had asked a question
very similar to this situation, and I thought I had understood the
answer Laura had given, but apparently I do not understand.  Where am
I going wrong this time?



More information about the Tutor mailing list