parent
fab696dcd1
commit
9d72bc48ee
|
@ -410,5 +410,11 @@ def check_testcase_implements_trial_reporter(done: List[int] = []) -> None:
|
|||
|
||||
|
||||
def _is_skipped(obj) -> bool:
|
||||
"""Return True if the given object has been marked with @unittest.skip."""
|
||||
return bool(getattr(obj, "__unittest_skip__", False))
|
||||
"""Return True if the given object has been marked with @unittest.skip.
|
||||
|
||||
Also return True if obj is a method of a skipped object.
|
||||
"""
|
||||
skipped = bool(getattr(obj, "__unittest_skip__", False))
|
||||
if isinstance(obj, types.MethodType):
|
||||
skipped |= _is_skipped(obj.__self__)
|
||||
return skipped
|
||||
|
|
|
@ -1265,12 +1265,24 @@ def test_pdb_teardown_skipped(
|
|||
def test_1(self):
|
||||
pass
|
||||
|
||||
{mark}("skipped for other reasons")
|
||||
class MyTestCase2(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
pytest.test_pdb_teardown_skipped.append("setUp:" + self.id())
|
||||
|
||||
def tearDown(self):
|
||||
pytest.test_pdb_teardown_skipped.append("tearDown:" + self.id())
|
||||
|
||||
def test_2(self):
|
||||
pass
|
||||
|
||||
""".format(
|
||||
mark=mark
|
||||
)
|
||||
)
|
||||
result = pytester.runpytest_inprocess("--pdb")
|
||||
result.stdout.fnmatch_lines("* 1 skipped in *")
|
||||
result.stdout.fnmatch_lines("* 2 skipped in *")
|
||||
assert tracked == []
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue