summaryrefslogtreecommitdiff
path: root/unit_tests/mock.py
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2007-03-15 21:44:05 +0000
committerJason Pellerin <jpellerin@gmail.com>2007-03-15 21:44:05 +0000
commit22dbb73a0f5f7916f6789c1fd9fbd266f968bd96 (patch)
treebe88fa81fc4168eac80fcbffd7d23da47ae17ba7 /unit_tests/mock.py
parent69abb090c89d8544e0f8168147ddab9ae8196b2f (diff)
downloadnose-22dbb73a0f5f7916f6789c1fd9fbd266f968bd96.tar.gz
Work on integration of resultProxy into suite/case, unit and functional tests, continued removal of context bits
Diffstat (limited to 'unit_tests/mock.py')
-rw-r--r--unit_tests/mock.py64
1 files changed, 43 insertions, 21 deletions
diff --git a/unit_tests/mock.py b/unit_tests/mock.py
index c589cc3..cbc7e62 100644
--- a/unit_tests/mock.py
+++ b/unit_tests/mock.py
@@ -1,29 +1,51 @@
from nose.case import Test
from nose.config import Config
+from nose import proxy
+class ResultProxyFactory:
+ def __call__(self, result, test):
+ return ResultProxy(result, test)
-class MockContext:
- result_proxy = None
-
- def __init__(self, parent=None, config=None):
- self.parent = parent
- if config is None:
- config = Config()
- self.config = config
-
- def __call__(self, test):
- return Test(self, test)
-
- def setup(self):
- print "Context setup called"
- if self.parent is not None:
- self.parent.setup()
-
- def teardown(self):
- print "Context teardown called"
- if self.parent is not None:
- self.parent.teardown()
+class ResultProxy(proxy.ResultProxy):
+ called = []
+ def __init__(self, result, test):
+ self.result = result
+ self.test = test
+ def afterTest(self, test):
+ self.assertMyTest(test)
+ self.called.append(('afterTest', test))
+ def beforeTest(self, test):
+ self.assertMyTest(test)
+ self.called.append(('beforeTest', test))
+ def startTest(self, test):
+ print "proxy startTest"
+ self.assertMyTest(test)
+ self.called.append(('startTest', test))
+ def stopTest(self, test):
+ print "proxy stopTest"
+ self.assertMyTest(test)
+ self.called.append(('stopTest', test))
+ def addDeprecated(self, test, err):
+ print "proxy addDeprecated"
+ self.assertMyTest(test)
+ self.called.append(('addDeprecated', test, err))
+ def addError(self, test, err):
+ print "proxy addError"
+ self.assertMyTest(test)
+ self.called.append(('addError', test, err))
+ def addFailure(self, test, err):
+ print "proxy addFailure"
+ self.assertMyTest(test)
+ self.called.append(('addFailure', test, err))
+ def addSkip(self, test, err):
+ print "proxy addSkip"
+ self.assertMyTest(test)
+ self.called.append(('addSkip', test, err))
+ def addSuccess(self, test):
+ self.assertMyTest(test)
+ self.called.append(('addSuccess', test))
+
class RecordingPluginManager(object):