hard to get hold of actual error when testrepository itself fails

Bug #1087487 reported by Jelmer Vernooij
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Testrepository
Triaged
Wishlist
Unassigned

Bug Description

testrepository unhelpfully reports "Could not import command module testrepository.commands.run" including a backtrace, without letting me know *why* the import failed.

Traceback (most recent call last):
  File "/home/jelmer/src/testrepository/trunk/testr", line 26, in <module>
    sys.exit(run_argv(sys.argv, sys.stdin, sys.stdout, sys.stderr))
  File "/home/jelmer/src/testrepository/trunk/testrepository/commands/__init__.py", line 182, in run_argv
    cmdclass = _find_command(cmd_name)
  File "/home/jelmer/src/testrepository/trunk/testrepository/commands/__init__.py", line 52, in _find_command
    raise KeyError("Could not import command module %s" % modname)
KeyError: 'Could not import command module testrepository.commands.run'

This in fact happened to be a testtools compatibility issue, which shows when I comment out the exeption handler in __init__.py line 53:

Traceback (most recent call last):
  File "/home/jelmer/src/testrepository/trunk/testr", line 26, in <module>
    sys.exit(run_argv(sys.argv, sys.stdin, sys.stdout, sys.stderr))
  File "/home/jelmer/src/testrepository/trunk/testrepository/commands/__init__.py", line 179, in run_argv
    cmdclass = _find_command(cmd_name)
  File "/home/jelmer/src/testrepository/trunk/testrepository/commands/__init__.py", line 49, in _find_command
    _temp = __import__(modname, globals(), locals(), [classname])
  File "/home/jelmer/src/testrepository/trunk/testrepository/commands/run.py", line 26, in <module>
    from testrepository.commands.load import load
  File "/home/jelmer/src/testrepository/trunk/testrepository/commands/load.py", line 21, in <module>
    from testtools import ConcurrentTestSuite, MultiTestResult, Tagger
ImportError: cannot import name Tagger

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

TESTR_PDB=1
would let you debug that without commenting out the exception handler.

Changed in testrepository:
status: New → Triaged
importance: Undecided → Wishlist
summary: - hides underlying issues for ImportError
+ hard to get hold of actual error when testrepository itself fails
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> TESTR_PDB=1 would let you debug that without commenting out the exception handler.

That doesn't seem to work for me. In fact, ./testrepository/ui/cli.py which I suppose is handling TESTR_PDB never seems to be loaded when this exception occurs. Perhaps this exception is raised before the UI is loaded?

gwenhwyvar:~/src/testrepository% bzr revno
177

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.