diff -u nose-0.10.4/debian/patches/10-pytest-compatibility.patch nose-0.10.4/debian/patches/10-pytest-compatibility.patch --- nose-0.10.4/debian/patches/10-pytest-compatibility.patch +++ nose-0.10.4/debian/patches/10-pytest-compatibility.patch @@ -1,35 +1,9 @@ Changes API from setup_method(self) to setup_method(self, method) for compatibility with py.test (and likewise for teardown_method) - -Also handle some strangeness with unexpected classes, methods etc (investigate) +See http://code.google.com/p/python-nose/issues/detail?id=210 --- nose-0.10.4/nose/case.py 2008-04-02 04:44:16.000000000 +0200 +++ nose-0.10.4/nose/case.py 2008-10-09 10:02:45.000000000 +0200 -@@ -5,6 +5,7 @@ - import logging - import sys - import unittest -+import inspect - from nose.config import Config - from nose.failure import Failure # for backwards compatibility - from nose.util import resolve_name, test_address, try_run -@@ -323,8 +324,14 @@ - self.test = test - self.arg = arg - self.descriptor = descriptor -- self.cls = method.im_class -- self.inst = self.cls() -+ if inspect.isclass(method.im_self): -+ self.cls = method.im_self -+ else: -+ self.cls = method.im_class -+ try: -+ self.inst = self.cls() -+ except TypeError, e: -+ raise ValueError("Could not instantiate class to test method %s: %s" % (self.method, e)) - if self.test is None: - method_name = self.method.__name__ - self.test = getattr(self.inst, method_name) -@@ -360,10 +367,10 @@ +@@ -360,10 +360,10 @@ """Get context (class) of this test""") def setUp(self): @@ -42,44 +16,6 @@ def _descriptors(self): """Get the descriptors of the test method: the method and ---- nose-0.10.4/nose/loader.py 2008-04-07 04:15:06.000000000 +0200 -+++ nose-0.10.4/nose/loader.py 2008-10-09 10:02:45.000000000 +0200 -@@ -284,6 +284,8 @@ - test = getattr(module, item, None) - # print "Check %s (%s) in %s" % (item, test, module.__name__) - if isclass(test): -+ if test.__name__ is None: -+ raise ValueError("Test class %r doesn't have a __name__ attribute" % test) - if self.selector.wantClass(test): - test_classes.append(test) - elif isfunction(test) and self.selector.wantFunction(test): ---- nose-0.10.4/nose/tools.py 2008-04-02 04:44:16.000000000 +0200 -+++ nose-0.10.4/nose/tools.py 2008-10-09 10:02:45.000000000 +0200 -@@ -42,10 +42,14 @@ - name = func.compat_func_name - else: - name = func.__name__ -- newfunc.__dict__ = func.__dict__ -+ try: -+ newfunc.__dict__ = func.__dict__ -+ except AttributeError: -+ for attr in dir(func): -+ newfunc.__dict__[attr] = getattr(func, attr) - newfunc.__doc__ = func.__doc__ - newfunc.__module__ = func.__module__ -- if not hasattr(newfunc, 'compat_co_firstlineno'): -+ if not hasattr(newfunc, 'compat_co_firstlineno') and hasattr(func, "func_code"): - newfunc.compat_co_firstlineno = func.func_code.co_firstlineno - try: - newfunc.__name__ = name -@@ -85,6 +89,7 @@ - else: - message = "%s() did not raise %s" % (name, valid) - raise AssertionError(message) -+ return True - newfunc = make_decorator(func)(newfunc) - return newfunc - return decorate --- nose-0.10.4/nose/util.py 2008-04-30 21:32:14.000000000 +0200 +++ nose-0.10.4/nose/util.py 2008-10-09 10:02:45.000000000 +0200 @@ -421,7 +421,7 @@ @@ -108,0 +45,25 @@ +--- nose-0.10.4/unit_tests/test_cases.py 2008-03-06 17:24:27.000000000 +0200 ++++ nose-0.10.4/unit_tests/test_cases.py 2008-10-09 10:28:47.000000000 +0200 +@@ -80,7 +80,21 @@ + case = nose.case.MethodTestCase(TestClassFailingTest.test_func) + case(res) + self.assertEqual(called, ['setup', 'test', 'teardown']) +- ++ ++ class TestClassSetupMethod(object): ++ def setup_method(self, method): ++ called.append('setup_method %s' % (method.__name__)) ++ def teardown_method(self, method): ++ called.append('teardown_method %s' % (method.__name__)) ++ def test_func(self): ++ called.append('test') ++ raise Exception("failed") ++ ++ called[:] = [] ++ case = nose.case.MethodTestCase(TestClassSetupMethod.test_func) ++ case(res) ++ self.assertEqual(called, ['setup_method test_func', 'test', 'teardown_method test_func']) ++ + def test_function_test_case_fixtures(self): + from nose.tools import with_setup + res = unittest.TestResult() diff -u nose-0.10.4/debian/changelog nose-0.10.4/debian/changelog --- nose-0.10.4/debian/changelog +++ nose-0.10.4/debian/changelog @@ -1,3 +1,11 @@ +nose (0.10.4-ppa2) hardy; urgency=low + + * Remove unneeded sections of py.test compatibility patch + * Add test for setup_method + * Add link to patch submission + + -- David Fraser Thu, 09 Oct 2008 11:45:00 +0200 + nose (0.10.4-ppa1) hardy; urgency=low * Upgrade to 0.10.4