← Back to team overview

testtools-dev team mailing list archive

[Bug 681045] Re: Bad error when running tests that fail to import

 

I'm not 100% sure what needs to be done here, but I expect it'll come
quickly enough.

** Changed in: testtools
       Status: New => Triaged

** Changed in: testtools
   Importance: Undecided => High

-- 
Bad error when running tests that fail to import
https://bugs.launchpad.net/bugs/681045
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.

Status in Test Repository: New
Status in testtools: Triaged

Bug description:
When running testr's own tests using testr, when there's some kind of failure preventing one of the tests from importing correctly, you get an error like this:

$ testr run
running=python -m subunit.run testrepository.tests.test_suite| testr load
Traceback (most recent call last):
  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.6/dist-packages/subunit/run.py", line 72, in <module>
    SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner)
  File "/usr/lib/python2.6/dist-packages/testtools/run.py", line 133, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.6/dist-packages/testtools/run.py", line 188, in parseArgs
    self.createTests()
  File "/usr/lib/python2.6/dist-packages/testtools/run.py", line 199, in createTests
    self.module)
  File "/usr/lib/python2.6/unittest.py", line 613, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.6/unittest.py", line 598, in loadTestsFromName
    test = obj()
  File "testrepository/tests/__init__.py", line 70, in test_suite
    suite = loader.loadTestsFromNames(module_names)
  File "/usr/lib/python2.6/unittest.py", line 613, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.6/unittest.py", line 584, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_arguments'
id=2, tests=0

Many other test runners (e.g. trial, zope.testrunner) do substantially better than this.