3 new commits in pytest:

https://bitbucket.org/hpk42/pytest/changeset/593347ff1537/
changeset:   593347ff1537
user:        ataumoefolau
date:        2012-10-12 06:39:17
summary:     nose.py: don't try to call setup if it's not callable
affected #:  1 file

diff -r 4ff9c2bc50bdf82809f9ded29f55c50c8103e92c -r 
593347ff153799d98ea1faeefc3641f28a3503d2 _pytest/nose.py
--- a/_pytest/nose.py
+++ b/_pytest/nose.py
@@ -41,7 +41,7 @@
 
 def call_optional(obj, name):
     method = getattr(obj, name, None)
-    if method is not None and not hasattr(method, "_pytestfixturefunction"):
+    if method is not None and not hasattr(method, "_pytestfixturefunction") 
and callable(method):
         # If there's any problems allow the exception to raise rather than
         # silently ignoring them
         method()



https://bitbucket.org/hpk42/pytest/changeset/efc2693750ab/
changeset:   efc2693750ab
user:        RonnyPfannschmidt
date:        2012-11-05 21:17:58
summary:     test call_optional not calling non-callable functions
affected #:  1 file

diff -r 593347ff153799d98ea1faeefc3641f28a3503d2 -r 
efc2693750ab613fd4f32e8549f3e0fd719ce2b4 testing/test_nose.py
--- a/testing/test_nose.py
+++ b/testing/test_nose.py
@@ -35,6 +35,12 @@
     assert not l
 
 
+def test_setup_func_not_callable():
+    from _pytest.nose import call_optional
+    class A:
+        f = 1
+    call_optional(A(), "f")
+
 def test_nose_setup_func(testdir):
     p = testdir.makepyfile("""
         from nose.tools import with_setup



https://bitbucket.org/hpk42/pytest/changeset/2bde7353ee7d/
changeset:   2bde7353ee7d
user:        RonnyPfannschmidt
date:        2012-11-05 21:18:50
summary:     merge pull request
affected #:  2 files

diff -r 08e713c68aba7134a29f8d24980a78500b137abe -r 
2bde7353ee7d24bb45198cb469b12d05e7207d30 _pytest/nose.py
--- a/_pytest/nose.py
+++ b/_pytest/nose.py
@@ -41,7 +41,7 @@
 
 def call_optional(obj, name):
     method = getattr(obj, name, None)
-    if method is not None and not hasattr(method, "_pytestfixturefunction"):
+    if method is not None and not hasattr(method, "_pytestfixturefunction") 
and callable(method):
         # If there's any problems allow the exception to raise rather than
         # silently ignoring them
         method()


diff -r 08e713c68aba7134a29f8d24980a78500b137abe -r 
2bde7353ee7d24bb45198cb469b12d05e7207d30 testing/test_nose.py
--- a/testing/test_nose.py
+++ b/testing/test_nose.py
@@ -35,6 +35,12 @@
     assert not l
 
 
+def test_setup_func_not_callable():
+    from _pytest.nose import call_optional
+    class A:
+        f = 1
+    call_optional(A(), "f")
+
 def test_nose_setup_func(testdir):
     p = testdir.makepyfile("""
         from nose.tools import with_setup

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
py-svn mailing list
py-svn@codespeak.net
http://codespeak.net/mailman/listinfo/py-svn

Reply via email to