support for multiple test runners appears to have bitrotted.

Bug #331905 reported by James Henstridge
2
Affects Status Importance Assigned to Milestone
Storm
Fix Released
Low
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>
        runner_func()
      File "./test", line 104, in test_with_py_test
        py.test.cmdline.main()
      File "/usr/lib/python2.5/site-packages/py/test/cmdline.py", line 12, in main
        config.parse(args)
      File "/usr/lib/python2.5/site-packages/py/test/config.py", line 46, in parse
        self._conftest.setinitial(args)
      File "/usr/lib/python2.5/site-packages/py/test/conftesthandle.py", line 32, in setinitial
        self._path2confmods[None] = self.getconftestmodules(anchor)
      File "/usr/lib/python2.5/site-packages/py/test/conftesthandle.py", line 45, in getconftestmodules
        clist = self.getconftestmodules(dp)
      File "/usr/lib/python2.5/site-packages/py/test/conftesthandle.py", line 48, in getconftestmodules
        clist.append(importconfig(conftestpath))
      File "/usr/lib/python2.5/site-packages/py/test/conftesthandle.py", line 78, in importconfig
        mod = configpath.pyimport()
      File "/usr/lib/python2.5/site-packages/py/path/local/local.py", line 417, in pyimport
        mod = __import__(modname, None, None, ['__doc__'])
      File "/home/james/src/lp/storm.trunk/tests/conftest.py", 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/usage.py", line 241, in parseOptions
        self.postOptions()
      File "/usr/lib/python2.5/site-packages/twisted/scripts/trial.py", line 293, in postOptions
        self['reporter'] = self._loadReporterByName(self['reporter'])
      File "/usr/lib/python2.5/site-packages/twisted/scripts/trial.py", line 279, in _loadReporterByName
        for p in plugin.getPlugins(itrial.IReporter):
      File "/usr/lib/python2.5/site-packages/twisted/plugin.py", line 200, in getPlugins
        allDropins = getCache(package)
    --- <exception caught here> ---
      File "/usr/lib/python2.5/site-packages/twisted/plugin.py", line 179, in getCache
        dropinPath.setContent(pickle.dumps(dropinDotCache))
      File "/usr/lib/python2.5/site-packages/twisted/python/filepath.py", line 574, in setContent
        sib.open('w').write(content)
      File "/usr/lib/python2.5/site-packages/twisted/python/filepath.py", line 384, in open
        return open(self.path, mode+'b')
    exceptions.IOError: [Errno 13] Permission denied: '/usr/lib/python2.5/site-packages/twisted/plugins/dropin.cache.new'
    Traceback (most recent call last):
      File "./test", line 184, in <module>
        runner_func()
      File "./test", line 93, in test_with_trial
        trial.run()
      File "/usr/lib/python2.5/site-packages/twisted/scripts/trial.py", line 357, in run
        suite = _getSuite(config)
      File "/usr/lib/python2.5/site-packages/twisted/scripts/trial.py", line 315, in _getSuite
        return loader.loadByNames(config['tests'], recurse)
      File "/usr/lib/python2.5/site-packages/twisted/trial/runner.py", line 627, in loadByNames
        for thing in set(things)]
      File "/usr/lib/python2.5/site-packages/twisted/trial/runner.py", line 585, in loadAnything
        return self.loadModule(thing)
      File "/usr/lib/python2.5/site-packages/twisted/trial/runner.py", line 469, in loadModule
        for testClass in self.findTestClasses(module):
      File "/usr/lib/python2.5/site-packages/twisted/trial/runner.py", line 429, in findTestClasses
        if isTestCase(val):
      File "/usr/lib/python2.5/site-packages/twisted/trial/runner.py", line 313, in isTestCase
        return issubclass(obj, pyunit.TestCase)
      File "/var/lib/python-support/python2.5/django/conf/__init__.py", line 28, in __getattr__
        self._import_settings()
      File "/var/lib/python-support/python2.5/django/conf/__init__.py", 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
Revision history for this message
James Henstridge (jamesh) wrote :

Fix merged as r339.

Changed in storm:
assignee: nobody → James Henstridge (jamesh)
status: New → Fix Committed
Jamu Kakar (jkakar)
Changed in storm:
status: Fix Committed → Fix Released
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.