support for multiple test runners appears to have bitrotted.

Bug #331905 reported by James Henstridge on 2009-02-20
Affects Status Importance Assigned to Milestone
James Henstridge

Bug Description

The Storm test suite contains code to run the tests under the unittest, trial and py.test test runners. We usually only test the unittest runner though, and it seems that the others have bitrot.

Trying the py.test runner results in:

    $ STORM_TEST_RUNNER=py_test ./test
    Traceback (most recent call last):
      File "./test", line 184, in <module>
      File "./test", line 104, in test_with_py_test
      File "/usr/lib/python2.5/site-packages/py/test/", line 12, in main
      File "/usr/lib/python2.5/site-packages/py/test/", line 46, in parse
      File "/usr/lib/python2.5/site-packages/py/test/", line 32, in setinitial
        self._path2confmods[None] = self.getconftestmodules(anchor)
      File "/usr/lib/python2.5/site-packages/py/test/", line 45, in getconftestmodules
        clist = self.getconftestmodules(dp)
      File "/usr/lib/python2.5/site-packages/py/test/", line 48, in getconftestmodules
      File "/usr/lib/python2.5/site-packages/py/test/", line 78, in importconfig
        mod = configpath.pyimport()
      File "/usr/lib/python2.5/site-packages/py/path/local/", line 417, in pyimport
        mod = __import__(modname, None, None, ['__doc__'])
      File "/home/james/src/lp/storm.trunk/tests/", line 29, in <module>
        import py.test.compat
    ImportError: No module named compat

Running with the trial test runner also has problems with the django tests (appears to be in the test discovery code):

    $ STORM_TEST_RUNNER=trial ./test
    Traceback (most recent call last):
      File "/usr/lib/python2.5/site-packages/twisted/python/", line 241, in parseOptions
      File "/usr/lib/python2.5/site-packages/twisted/scripts/", line 293, in postOptions
        self['reporter'] = self._loadReporterByName(self['reporter'])
      File "/usr/lib/python2.5/site-packages/twisted/scripts/", line 279, in _loadReporterByName
        for p in plugin.getPlugins(itrial.IReporter):
      File "/usr/lib/python2.5/site-packages/twisted/", line 200, in getPlugins
        allDropins = getCache(package)
    --- <exception caught here> ---
      File "/usr/lib/python2.5/site-packages/twisted/", line 179, in getCache
      File "/usr/lib/python2.5/site-packages/twisted/python/", line 574, in setContent'w').write(content)
      File "/usr/lib/python2.5/site-packages/twisted/python/", line 384, in open
        return open(self.path, mode+'b')
    exceptions.IOError: [Errno 13] Permission denied: '/usr/lib/python2.5/site-packages/twisted/plugins/'
    Traceback (most recent call last):
      File "./test", line 184, in <module>
      File "./test", line 93, in test_with_trial
      File "/usr/lib/python2.5/site-packages/twisted/scripts/", line 357, in run
        suite = _getSuite(config)
      File "/usr/lib/python2.5/site-packages/twisted/scripts/", line 315, in _getSuite
        return loader.loadByNames(config['tests'], recurse)
      File "/usr/lib/python2.5/site-packages/twisted/trial/", line 627, in loadByNames
        for thing in set(things)]
      File "/usr/lib/python2.5/site-packages/twisted/trial/", line 585, in loadAnything
        return self.loadModule(thing)
      File "/usr/lib/python2.5/site-packages/twisted/trial/", line 469, in loadModule
        for testClass in self.findTestClasses(module):
      File "/usr/lib/python2.5/site-packages/twisted/trial/", line 429, in findTestClasses
        if isTestCase(val):
      File "/usr/lib/python2.5/site-packages/twisted/trial/", line 313, in isTestCase
        return issubclass(obj, pyunit.TestCase)
      File "/var/lib/python-support/python2.5/django/conf/", line 28, in __getattr__
      File "/var/lib/python-support/python2.5/django/conf/", line 57, in _import_settings
        raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
    ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

I'm not sure whether it is worth keeping the py.test support, but the trial code might be necessary to properly test twisted-integration.

If we get rid of py.test support, we've only got unittest-compatible frameworks left. We could then use the same test discovery code for running under unittest and trial, which would reduce the amount of infrequently used infrastructure.

Related branches

Changed in storm:
importance: Undecided → Low
Changed in storm:
milestone: none → 0.16
James Henstridge (jamesh) wrote :

Fix merged as r339.

Changed in storm:
assignee: nobody → James Henstridge (jamesh)
status: New → Fix Committed
Jamu Kakar (jkakar) on 2009-11-29
Changed in storm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers