[py-svn] r31474 - in py/branch/distributed/py/test/rsession: . testing
fijal at codespeak.net
fijal at codespeak.net
Tue Aug 22 16:11:02 CEST 2006
Author: fijal
Date: Tue Aug 22 16:10:59 2006
New Revision: 31474
Added:
py/branch/distributed/py/test/rsession/outcome.py (contents, props changed)
Modified:
py/branch/distributed/py/test/rsession/executor.py
py/branch/distributed/py/test/rsession/slavenode.py
py/branch/distributed/py/test/rsession/testing/test_slavenode.py
Log:
(hpk, fijal) - Added outcome representation for master side
Modified: py/branch/distributed/py/test/rsession/executor.py
==============================================================================
--- py/branch/distributed/py/test/rsession/executor.py (original)
+++ py/branch/distributed/py/test/rsession/executor.py Tue Aug 22 16:10:59 2006
@@ -3,18 +3,7 @@
import py
-class Outcome(object):
- pass
-
-class FailingOutcome(Outcome):
- passed = False
- def __init__(self, excinfo, setupfailure=False):
- self.excinfo = excinfo
- self.setupfailure = setupfailure
-
-class PassingOutcome(Outcome):
- passed = True
- setupfailure = False
+from py.__.test.rsession.outcome import FailingOutcome, PassingOutcome
class Executor(object):
def __init__(self, fun, setup=lambda: None):
Added: py/branch/distributed/py/test/rsession/outcome.py
==============================================================================
--- (empty file)
+++ py/branch/distributed/py/test/rsession/outcome.py Tue Aug 22 16:10:59 2006
@@ -0,0 +1,22 @@
+
+""" Classes for representing outcomes on master and slavenode sides
+"""
+
+class Outcome(object):
+ def make_repr(self):
+ return (self.passed, self.setupfailure, repr(self.excinfo))
+
+class FailingOutcome(Outcome):
+ passed = False
+ def __init__(self, excinfo, setupfailure=False):
+ self.excinfo = excinfo
+ self.setupfailure = setupfailure
+
+class PassingOutcome(Outcome):
+ passed = True
+ setupfailure = False
+ excinfo = None
+
+class ReprOutcome(object):
+ def __init__(self, repr_tuple):
+ self.passed, self.setupfailure, self.excinfo = repr_tuple
Modified: py/branch/distributed/py/test/rsession/slavenode.py
==============================================================================
--- py/branch/distributed/py/test/rsession/slavenode.py (original)
+++ py/branch/distributed/py/test/rsession/slavenode.py Tue Aug 22 16:10:59 2006
@@ -26,3 +26,11 @@
item = self.getitem(itemspec)
ex = Executor(item.obj, setup=item.setup)
return ex.execute()
+
+ def wrapped_run(self, cmd, *args):
+ outcome = self.run(cmd, *args)
+ call = gettattr(self, "wrap_" + cmd)
+ return call(outcome)
+
+ def wrap_execitem(self, outcome):
+ return repr(outcome)
Modified: py/branch/distributed/py/test/rsession/testing/test_slavenode.py
==============================================================================
--- py/branch/distributed/py/test/rsession/testing/test_slavenode.py (original)
+++ py/branch/distributed/py/test/rsession/testing/test_slavenode.py Tue Aug 22 16:10:59 2006
@@ -3,6 +3,8 @@
from py.__.test.rsession.slavenode import SlaveNode
import py
+from py.__.test.rsession.outcome import ReprOutcome
+
def funcpass():
pass
@@ -30,7 +32,7 @@
assert outcome.passed
assert not outcome.setupfailure
- ser = outcome.serialize()
+ ser = outcome.make_repr()
reproutcome = ReprOutcome(ser)
assert reproutcome.passed
assert not reproutcome.setupfailure
@@ -44,7 +46,7 @@
assert len(outcome.excinfo.traceback) == 1
assert outcome.excinfo.traceback[-1].frame.code.name == 'funcfail'
- ser = outcome.serialize()
+ ser = outcome.make_repr()
reproutcome = ReprOutcome(ser)
assert not reproutcome.passed
assert not reproutcome.setupfailure
More information about the pytest-commit
mailing list