Opened 10 years ago

Last modified 9 years ago

#22945 closed Bug

Creating a tests directory with __init__ breaks the testrunner — at Initial Version

Reported by: gene.dolgin@… Owned by: nobody
Component: Testing framework Version: 1.7-rc-1
Severity: Normal Keywords: testrunner, tests, test
Cc: mmitar@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In any given app, creating a directory called 'tests' with an init.py file and a number of test_*.py files which contain TestCases, the testrunner errors when trying to load the 'tests' directory

Traceback (most recent call last):

File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 127, in <module>

utility.execute()

File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 102, in execute

PycharmTestCommand().run_from_argv(self.argv)

File "/Users/gene/Python/venvs/dd_django/lib/python2.7/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv

super(Command, self).run_from_argv(argv)

File "/Users/gene/Python/venvs/dd_django/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv

self.execute(*args, options.dict)

File "/Users/gene/Python/venvs/dd_django/lib/python2.7/site-packages/django/core/management/commands/test.py", line 71, in execute

super(Command, self).execute(*args, options)

File "/Users/gene/Python/venvs/dd_django/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute

output = self.handle(*args, options)

File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 89, in handle

failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive, failfast=failfast)

File "/Applications/PyCharm.app/helpers/pycharm/django_test_runner.py", line 228, in run_tests

extra_tests=extra_tests, options)

File "/Applications/PyCharm.app/helpers/pycharm/django_test_runner.py", line 128, in run_tests

return super(DjangoTeamcityTestRunner, self).run_tests(test_labels, extra_tests, kwargs)

File "/Users/gene/Python/venvs/dd_django/lib/python2.7/site-packages/django/test/runner.py", line 146, in run_tests

suite = self.build_suite(test_labels, extra_tests)

File "/Applications/PyCharm.app/helpers/pycharm/django_test_runner.py", line 92, in build_suite

suite = super(DjangoTeamcityTestRunner, self).build_suite(*args, kwargs)

File "/Users/gene/Python/venvs/dd_django/lib/python2.7/site-packages/django/test/runner.py", line 95, in build_suite

tests = self.test_loader.discover(start_dir=label, kwargs)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 204, in discover

tests = list(self._find_tests(start_dir, pattern))

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 265, in _find_tests

raise ImportError(msg % (mod_name, module_dir, expected_dir))

ImportError: 'tests' module incorrectly imported from '/Users/gene/Python/dd_django/pacer/tests'. Expected '/Users/gene/Python/dd_django/pacer'. Is this module globally installed?

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top