StartUpFailure raises when id() called

Bug #624084 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.testrunner
Fix Released
Undecided
Unassigned

Bug Description

StartUpFailure is an empty test case added to indicate import failures, which is great. However, calling id() on a StartUpFailure raises an exception like this:

Traceback (most recent call last):
  File "./bin/test", line 267, in <module>
    testrunner.run([])
  File "/home/jml/repos/lp-sourcedeps/eggs/zope.testing-3.9.4_p1-py2.6.egg/zope/testing/testrunner/__init__.py", line 32, in run
    failed = run_internal(defaults, args, script_parts=script_parts)
  File "/home/jml/repos/lp-sourcedeps/eggs/zope.testing-3.9.4_p1-py2.6.egg/zope/testing/testrunner/__init__.py", line 45, in run_internal
    runner.run()
  File "/home/jml/repos/lp-sourcedeps/eggs/zope.testing-3.9.4_p1-py2.6.egg/zope/testing/testrunner/runner.py", line 126, in run
    feature.global_setup()
  File "/home/jml/repos/lp-sourcedeps/eggs/zope.testing-3.9.4_p1-py2.6.egg/zope/testing/testrunner/find.py", line 418, in global_setup
    tests = find_tests(self.runner.options, self.runner.found_suites)
  File "/home/jml/src/launchpad/better-ec2-mail/lib/canonical/testing/customresult.py", line 28, in find_tests
    return hook(real_find_tests(*args))
  File "/home/jml/src/launchpad/better-ec2-mail/lib/canonical/testing/customresult.py", line 28, in find_tests
    return hook(real_find_tests(*args))
  File "/home/jml/src/launchpad/better-ec2-mail/lib/canonical/testing/customresult.py", line 46, in do_filter
    if test.id() in tests:
  File "/usr/lib/python2.6/unittest.py", line 243, in id
    return "%s.%s" % (_strclass(self.__class__), self._testMethodName)
AttributeError: 'StartUpFailure' object has no attribute '_testMethodName'

Although the API isn't as well-documented as it could be, it's very reasonable for testing tools to expect TestCase objects to provide an id() method that returns a byte-string and doesn't raise.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

This is almost identical to bug 221151.

Revision history for this message
Tres Seaver (tseaver) wrote :

The initial fix for this issue was released with zope.testrunner 4.0.0b3.
An updated, Python 2.4-compatible version of the fix was included in
the 4.0.0b5 release.

Changed in zope.testrunner:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.