Author redixin
Recipients redixin
Date 2015-05-20.18:11:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
"unittest discover" does add some directories to sys.path

later some modules can not work with modified sys.path

Here module `pdb` is trying to import standard module `cmd` but does import `cmd` module from `tests` directory:

"unittest discover" should not modify sys.path in any way.

$ mkdir /tmp/t
$ cd /tmp/t
$ mkdir tests
$ mkdir tests/cmd
$ touch tests/cmd/
$ echo "import pdb" > tests/
$ python -m unittest discover tests
ERROR: test_nothing (unittest.loader.ModuleImportFailure)
ImportError: Failed to import test module: test_nothing
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python2.7/unittest/", line 232, in _get_module_from_name
  File "/tmp/t/tests/", line 1, in <module>
    import pdb
  File "/usr/lib/python2.7/", line 59, in <module>
    class Pdb(bdb.Bdb, cmd.Cmd):
AttributeError: 'module' object has no attribute 'Cmd'

Ran 1 test in 0.000s

FAILED (errors=1)
Date User Action Args
2015-05-20 18:11:44redixinsetrecipients: + redixin
2015-05-20 18:11:44redixinsetmessageid: <>
2015-05-20 18:11:44redixinlinkissue24247 messages
2015-05-20 18:11:44redixincreate