summaryrefslogtreecommitdiff
path: root/unit_tests
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2008-01-29 01:54:35 +0000
committerJason Pellerin <jpellerin@gmail.com>2008-01-29 01:54:35 +0000
commit64433a2828b9984347525fe5c32af0d23343db61 (patch)
tree093af5745183d947119b0c7566439ca65f128b2c /unit_tests
parent5fadf7ed2bf0b0818f653d958abbff9dad2fe941 (diff)
downloadnose-64433a2828b9984347525fe5c32af0d23343db61.tar.gz
Fixed #152: applied patch
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/mock.py8
-rw-r--r--unit_tests/test_cases.py3
-rw-r--r--unit_tests/test_plugin_manager.py4
3 files changed, 11 insertions, 4 deletions
diff --git a/unit_tests/mock.py b/unit_tests/mock.py
index fe5d16c..98e7d43 100644
--- a/unit_tests/mock.py
+++ b/unit_tests/mock.py
@@ -2,6 +2,7 @@ import imp
import sys
from nose.config import Config
from nose import proxy
+from nose.plugins.manager import NoPlugins
from nose.util import odict
@@ -63,7 +64,11 @@ class RecordingPluginManager(object):
def __getattr__(self, call):
return RecordingPluginProxy(self, call)
+ def null_call(self, call, *arg, **kw):
+ return getattr(self._nullPluginManager, call)(*arg, **kw)
+
def reset(self):
+ self._nullPluginManager = NoPlugins()
self.called = odict()
def calls(self):
@@ -75,9 +80,10 @@ class RecordingPluginProxy(object):
def __init__(self, manager, call):
self.man = manager
self.call = call
-
+
def __call__(self, *arg, **kw):
self.man.called.setdefault(self.call, []).append((arg, kw))
+ return self.man.null_call(self.call, *arg, **kw)
class Bucket(object):
diff --git a/unit_tests/test_cases.py b/unit_tests/test_cases.py
index cc573bc..adc1a6c 100644
--- a/unit_tests/test_cases.py
+++ b/unit_tests/test_cases.py
@@ -2,6 +2,7 @@ import unittest
import pdb
import sys
import nose.case
+import nose.failure
from nose.config import Config
from mock import ResultProxyFactory, ResultProxy
@@ -88,7 +89,7 @@ class TestNoseCases(unittest.TestCase):
def test_failure_case(self):
res = unittest.TestResult()
- f = nose.case.Failure(ValueError, "a is not b")
+ f = nose.failure.Failure(ValueError, "No such test spam")
f(res)
assert res.errors
diff --git a/unit_tests/test_plugin_manager.py b/unit_tests/test_plugin_manager.py
index 4dc79e7..51d9435 100644
--- a/unit_tests/test_plugin_manager.py
+++ b/unit_tests/test_plugin_manager.py
@@ -54,12 +54,12 @@ class TestPluginManager(unittest.TestCase):
"Some plugins were not found by iteration: %s" % expect
def test_plugin_generative_method_errors_not_hidden(self):
- import nose.case
+ import nose.failure
pm = PluginManager(plugins=[Plug3(), Plug4()])
loaded = list(pm.loadTestsFromModule('whatever'))
self.assertEqual(len(loaded), 2)
for test in loaded:
- assert isinstance(test, nose.case.Failure), \
+ assert isinstance(test, nose.failure.Failure), \
"%s is not a failure" % test