11""" run test suites written for nose. """
2- import sys
3-
4- import pytest
52from _pytest import python
6- from _pytest import runner
73from _pytest import unittest
84from _pytest .config import hookimpl
95
106
11- def get_skip_exceptions ():
12- skip_classes = set ()
13- for module_name in ("unittest" , "unittest2" , "nose" ):
14- mod = sys .modules .get (module_name )
15- if hasattr (mod , "SkipTest" ):
16- skip_classes .add (mod .SkipTest )
17- return tuple (skip_classes )
18-
19-
20- def pytest_runtest_makereport (item , call ):
21- if call .excinfo and call .excinfo .errisinstance (get_skip_exceptions ()):
22- # let's substitute the excinfo with a pytest.skip one
23- call2 = runner .CallInfo .from_call (
24- lambda : pytest .skip (str (call .excinfo .value )), call .when
25- )
26- call .excinfo = call2 .excinfo
27-
28-
297@hookimpl (trylast = True )
308def pytest_runtest_setup (item ):
319 if is_potential_nosetest (item ):
@@ -40,9 +18,6 @@ def teardown_nose(item):
4018 if is_potential_nosetest (item ):
4119 if not call_optional (item .obj , "teardown" ):
4220 call_optional (item .parent .obj , "teardown" )
43- # if hasattr(item.parent, '_nosegensetup'):
44- # #call_optional(item._nosegensetup, 'teardown')
45- # del item.parent._nosegensetup
4621
4722
4823def is_potential_nosetest (item ):
0 commit comments