using discover with testrepository is not obvious (needs --load-list)

Bug #823928 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testtools
Invalid
Wishlist
Unassigned

Bug Description

I would like to have a .testr.conf like this::

  test_command=python -m subunit.run discover $IDLIST

(subunit uses testtools's TestProgram)

This works for running the whole suite, but when I want to run a subset of the test suite, I cannot. I get this error:

$ python -m testtools.run discover devportalbinary.tests.test_binary devportalbinary.tests.test_binary_backend
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/testtools/run.py", line 332, in <module>
    main(sys.argv, sys.stdout)
  File "/usr/lib/python2.7/dist-packages/testtools/run.py", line 329, in main
    program = TestProgram(argv=argv, testRunner=runner, stdout=stdout)
  File "/usr/lib/python2.7/dist-packages/testtools/run.py", line 155, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/dist-packages/testtools/run.py", line 194, in parseArgs
    self._do_discovery(argv[2:])
  File "/usr/lib/python2.7/dist-packages/testtools/run.py", line 303, in _do_discovery
    self.test = loader.discover(start_dir, pattern, top_level_dir)
  File "/usr/lib/python2.7/unittest/loader.py", line 202, in discover
    raise ImportError('Start directory is not importable: %r' % start_dir)
ImportError: Start directory is not importable: 'devportalbinary.tests.test_binary'

Not sure if this is really a testrepository bug.

Tags: docs runner
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 823928] [NEW] Cannot restrict tests found by discover

You probably want --load-list $IDFILE rather than $IDLIST

-Rob

Revision history for this message
Robert Collins (lifeless) wrote : Re: Cannot restrict tests found by discover

In fact, to be clearer - you want load-list to work with discovery; I don't know if it does, but if it does, then the use case with testrepository will work (but the discover limitation may still exist).

Changed in testtools:
status: New → Incomplete
Jonathan Lange (jml)
tags: added: runner
Revision history for this message
Robert Collins (lifeless) wrote :

load-list works fine with discovery. The upstream definition of discovery means that load-list is a necessity.

Revision history for this message
Robert Collins (lifeless) wrote :

Reclassifying as a doc bug.

tags: added: docs
Changed in testtools:
status: Incomplete → Triaged
importance: Undecided → Wishlist
summary: - Cannot restrict tests found by discover
+ using discover with testrepository is not obvious (needs --load-list)
Revision history for this message
Robert Collins (lifeless) wrote :

Note that is is documented here:
https://testrepository.readthedocs.org/en/latest/MANUAL.html#python

Is more needed?

Changed in testtools:
status: Triaged → Incomplete
Revision history for this message
Jonathan Lange (jml) wrote :

Nope!

Changed in testtools:
status: Incomplete → Invalid
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.