Comment 3 for bug 1271133

Revision history for this message
Jonathan Lange (jml) wrote :

According to https://bugs.launchpad.net/testtools/+bug/1380918/comments/9, this is fully fixed.

I tried running `testr run` on testtools master, first with no modifications and got:

$ testr run
running=${PYTHON:-python} -m subunit.run testtools.tests.test_suite
Ran 1196 (+1195) tests in 2.071s
PASSED (id=0, skips=8)

Then with this patch:

$ git di
diff --git a/testtools/tests/matchers/test_basic.py b/testtools/tests/matchers/test_basic.py
index c53bc9e..2270646 100644
--- a/testtools/tests/matchers/test_basic.py
+++ b/testtools/tests/matchers/test_basic.py
@@ -1,5 +1,6 @@
 # Copyright (c) 2008-2012 testtools developers. See LICENSE for details.

+aouthaosute
 import re

 from testtools import TestCase

and got:

$ testr run
running=${PYTHON:-python} -m subunit.run testtools.tests.test_suite
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/subunit/run.py", line 149, in <module>
    main()
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/subunit/run.py", line 145, in main
    stdout=stdout, exit=False)
  File "testtools/run.py", line 171, in __init__
    self.parseArgs(argv)
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/main.py", line 135, in parseArgs
    self.createTests()
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/main.py", line 142, in createTests
    self.module)
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/loader.py", line 245, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/loader.py", line 230, in loadTestsFromName
    test = obj()
  File "testtools/tests/__init__.py", line 51, in test_suite
    suites = map(lambda x: x.test_suite(), modules)
  File "testtools/tests/__init__.py", line 51, in <lambda>
    suites = map(lambda x: x.test_suite(), modules)
  File "testtools/tests/matchers/__init__.py", line 8, in test_suite
    from testtools.tests.matchers import (
  File "testtools/tests/matchers/test_basic.py", line 3, in <module>
    aouthaosute
NameError: name 'aouthaosute' is not defined
======================================================================
FAIL: process-returncode
tags: worker-0
----------------------------------------------------------------------
returncode 1
Ran 1 (-1195) tests
FAILED (id=1, failures=1 (+1))

And then with this patch:

 git di
diff --git a/testtools/tests/matchers/test_basic.py b/testtools/tests/matchers/test_basic.py
index c53bc9e..5b1304c 100644
--- a/testtools/tests/matchers/test_basic.py
+++ b/testtools/tests/matchers/test_basic.py
@@ -1,5 +1,6 @@
 # Copyright (c) 2008-2012 testtools developers. See LICENSE for details.

+import aouthaosute
 import re

 from testtools import TestCase

and got:

$ testr run
running=${PYTHON:-python} -m subunit.run testtools.tests.test_suite
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/subunit/run.py", line 149, in <module>
    main()
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/subunit/run.py", line 145, in main
    stdout=stdout, exit=False)
  File "testtools/run.py", line 171, in __init__
    self.parseArgs(argv)
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/main.py", line 135, in parseArgs
    self.createTests()
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/main.py", line 142, in createTests
    self.module)
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/loader.py", line 245, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Users/jml/.virtualenvs/testtools/lib/python2.7/site-packages/unittest2/loader.py", line 230, in loadTestsFromName
    test = obj()
  File "testtools/tests/__init__.py", line 51, in test_suite
    suites = map(lambda x: x.test_suite(), modules)
  File "testtools/tests/__init__.py", line 51, in <lambda>
    suites = map(lambda x: x.test_suite(), modules)
  File "testtools/tests/matchers/__init__.py", line 8, in test_suite
    from testtools.tests.matchers import (
  File "testtools/tests/matchers/test_basic.py", line 3, in <module>
    import aouthaosute
ImportError: No module named aouthaosute
======================================================================
FAIL: process-returncode
tags: worker-0
----------------------------------------------------------------------
returncode 1
Ran 1 tests
FAILED (id=6, failures=1)

So, afaict, this bug is fixed, with no changes required to testtools.