doc test fails with egg

Bug #1448979 reported by John Vandenberg on 2015-04-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testscenarios
Undecided
Unassigned

Bug Description

The tests tries to load the README file, even if it is inside an egg. It seems testtools now builds an egg before doing the testing.

$ make check
PYTHONPATH=/tmp/testscenarios/0.4/lib: python -m testtools.run \
    testscenarios.test_suite
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/testtools/run.py", line 399, in <module>
    main(sys.argv, sys.stdout)
  File "/usr/lib/python2.7/site-packages/testtools/run.py", line 396, in main
    stdout=stdout)
  File "/usr/lib/python2.7/site-packages/testtools/run.py", line 206, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/site-packages/testtools/run.py", line 283, in parseArgs
    self.createTests()
  File "/usr/lib/python2.7/site-packages/testtools/run.py", line 292, in createTests
    self.module)
  File "/usr/lib64/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python2.7/unittest/loader.py", line 113, in loadTestsFromName
    test = obj()
  File "build/bdist.linux-x86_64/egg/testscenarios/__init__.py", line 71, in test_suite
  File "build/bdist.linux-x86_64/egg/testscenarios/tests/__init__.py", line 29, in test_suite
  File "build/bdist.linux-x86_64/egg/testscenarios/tests/__init__.py", line 42, in load_tests
  File "/usr/lib64/python2.7/doctest.py", line 2514, in DocFileSuite
    suite.addTest(DocFileTest(path, **kw))
  File "/usr/lib64/python2.7/doctest.py", line 2433, in DocFileTest
    doc, path = _load_testfile(path, package, module_relative)
  File "/usr/lib64/python2.7/doctest.py", line 215, in _load_testfile
    file_contents = package.__loader__.get_data(filename)
IOError: [Errno 2] No such file or directory: 'testscenarios/tests/../../../README'

The problematic code in question is in lib/testscenarios/tests/__init__.py line 42

    standard_tests.addTest(
        doctest.DocFileSuite("../../../README", optionflags=doctest.ELLIPSIS))

Robert Collins (lifeless) wrote :

I can't replicate this in either the old bzr tree or the git tree.

Changed in testscenarios:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers