Opened 8 years ago

#6579 defect new

doctests cause trial -j to crash

Reported by: Glyph Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

As per other discussions, trial doesn't support doctests. That's fine; doctests are a bit silly and maybe we shouldn't bother supporting them. Certainly we don't support them right now.

However, if you happen to have any doctests lying around, it's not just that they don't get run; they cause the parent process to crash with no useful error message. That's not good.

Here's a quick sketch of a fix.

  • twisted/trial/_dist/worker.py

     
    4242        """
    4343        Run a test case by name.
    4444        """
    45         case = self._loader.loadByName(testCase)
     45        try:
     46            case = self._loader.loadByName(testCase)
     47        except:
     48            class _FakeID(object):
     49                def id(self):
     50                    return testCase
     51            self._result.addSkip(_FakeID(), "Doctests are not runnable by "
     52                                 "trial -j.")
     53            return {'success': False}
    4654        suite = TrialSuite([case], self._forceGarbageCollection)
    4755        suite.run(self._result)
    4856        return {'success': True}

Change History (0)

Note: See TracTickets for help on using tickets.