[Pytest-commit] commit/pytest: hpk42: add nose.SkipTest for python2.6 -- which apparently is a subclass from python2.7 on.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Sep 6 12:49:01 CEST 2013


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/2596c9358665/
Changeset:   2596c9358665
User:        hpk42
Date:        2013-09-06 12:48:54
Summary:     add nose.SkipTest for python2.6 -- which apparently is a subclass from python2.7 on.
addresses issue236
Affected #:  1 file

diff -r 1200d39c921f8af41b3c62be2a017bcf7f165b1c -r 2596c935866532b97023e739dd978dc15796743c _pytest/nose.py
--- a/_pytest/nose.py
+++ b/_pytest/nose.py
@@ -5,13 +5,13 @@
 import sys
 from _pytest import unittest
 
-
 def pytest_runtest_makereport(__multicall__, item, call):
     SkipTest = getattr(sys.modules.get('nose', None), 'SkipTest', None)
     if SkipTest:
         if call.excinfo and call.excinfo.errisinstance(SkipTest):
             # let's substitute the excinfo with a py.test.skip one
-            call2 = call.__class__(lambda: py.test.skip(str(call.excinfo.value)), call.when)
+            call2 = call.__class__(lambda:
+                        pytest.skip(str(call.excinfo.value)), call.when)
             call.excinfo = call2.excinfo
 
 
@@ -40,10 +40,12 @@
         #    del item.parent._nosegensetup
 
 def pytest_make_collect_report(collector):
-    if sys.modules.get("unittest"):
-        SkipTest = getattr(py.std.unittest, "SkipTest", None)
-        if SkipTest is not None:
-            collector.skip_exceptions += (SkipTest,)
+    SkipTest = getattr(sys.modules.get('unittest', None), 'SkipTest', None)
+    if SkipTest is not None:
+        collector.skip_exceptions += (SkipTest,)
+    SkipTest = getattr(sys.modules.get('nose', None), 'SkipTest', None)
+    if SkipTest is not None:
+        collector.skip_exceptions += (SkipTest,)
     if isinstance(collector, pytest.Generator):
         call_optional(collector.obj, '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.


More information about the pytest-commit mailing list