diff options
| author | Jonathan Lange <jml@mumak.net> | 2006-12-22 17:20:46 +1100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2006-12-22 17:20:46 +1100 |
| commit | 0859b36623ee7db9ff6da45625c297488b8d9f35 (patch) | |
| tree | 7b8ebad2bef819ba14cf2ff83daa2a5ec5e5233f /python/subunit/__init__.py | |
| parent | a8c0069d60a01e5ef1a8c37cbb9748364f02b16d (diff) | |
| parent | c42cac02dc84b8db42f3c85f36affdaf732245a1 (diff) | |
| download | subunit-git-0859b36623ee7db9ff6da45625c297488b8d9f35.tar.gz | |
- Return a valid exc_info tuple from RemoteError
- Clarify the line-handling logic in the server
- Pick out some hacks that were added to allow trial to run the subunit
tests
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index f171f78..1fc34ec 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -119,32 +119,20 @@ class TestProtocolServer(object): elif (self.state == TestProtocolServer.READING_FAILURE or self.state == TestProtocolServer.READING_ERROR): self._appendMessage(line) - elif line.startswith("test:"): - self._startTest(6, line) - elif line.startswith("testing:"): - self._startTest(9, line) - elif line.startswith("testing"): - self._startTest(8, line) - elif line.startswith("test"): - self._startTest(5, line) - elif line.startswith("error:"): - self._addError(7, line) - elif line.startswith("error"): - self._addError(6, line) - elif line.startswith("failure:"): - self._addFailure(9, line) - elif line.startswith("failure"): - self._addFailure(8, line) - elif line.startswith("successful:"): - self._addSuccess(12, line) - elif line.startswith("successful"): - self._addSuccess(11, line) - elif line.startswith("success:"): - self._addSuccess(9, line) - elif line.startswith("success"): - self._addSuccess(8, line) else: - self.stdOutLineReceived(line) + cmd, rest = line.split(None, 1) + offset = len(cmd) + 1 + cmd = cmd.strip(':') + if cmd in ('test', 'testing'): + self._startTest(offset, line) + elif cmd == 'error': + self._addError(offset, line) + elif cmd == 'failure': + self._addFailure(offset, line) + elif cmd in ('success', 'successful'): + self._addSuccess(offset, line) + else: + self.stdOutLineReceived(line) def lostConnection(self): """The input connection has finished.""" @@ -230,7 +218,7 @@ class TestProtocolClient(unittest.TestResult): def RemoteError(description=""): if description == "": description = "\n" - return (RemoteException("RemoteError:\n%s" % description), None, None) + return (RemoteException, RemoteException(description), None) class RemotedTestCase(unittest.TestCase): |
