summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2014-04-10 09:21:02 -0400
committerJohn Szakmeister <john@szakmeister.net>2014-04-10 09:21:02 -0400
commitdaf2c38eb4c4844af1b7cedcd60fe10547dd13d0 (patch)
treee32491d301bf55a11c1d5dafb9f4e2b0351274cd
parent0181572a64195a8fa1c6c867ae6c61a79a9606ca (diff)
parente49dddb4eb3a3f6fa9d910e1e34bde02eaba5f18 (diff)
downloadnose-daf2c38eb4c4844af1b7cedcd60fe10547dd13d0.tar.gz
Merge pull request #787 from AntoineD/master
Fix #786: generator method fails with callable instance
-rw-r--r--nose/loader.py4
-rw-r--r--unit_tests/test_issue_786.py12
2 files changed, 14 insertions, 2 deletions
diff --git a/nose/loader.py b/nose/loader.py
index 4152a12..8a85515 100644
--- a/nose/loader.py
+++ b/nose/loader.py
@@ -287,7 +287,7 @@ class TestLoader(unittest.TestLoader):
test_func = unbound_method(c, getattr(c, test_func))
if ismethod(test_func):
yield MethodTestCase(test_func, arg=arg, descriptor=g)
- elif isfunction(test_func):
+ elif callable(test_func):
# In this case we're forcing the 'MethodTestCase'
# to run the inline function as its test call,
# but using the generator method as the 'method of
@@ -296,7 +296,7 @@ class TestLoader(unittest.TestLoader):
else:
yield Failure(
TypeError,
- "%s is not a function or method" % test_func)
+ "%s is not a callable or method" % test_func)
except KeyboardInterrupt:
raise
except:
diff --git a/unit_tests/test_issue_786.py b/unit_tests/test_issue_786.py
new file mode 100644
index 0000000..5669be4
--- /dev/null
+++ b/unit_tests/test_issue_786.py
@@ -0,0 +1,12 @@
+def test_evens():
+ yield check_even_cls
+
+class Test(object):
+ def test_evens(self):
+ yield check_even_cls
+
+class Check(object):
+ def __call__(self):
+ pass
+
+check_even_cls = Check()