MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_setup_teardown_linking_issue265

Function test_setup_teardown_linking_issue265

testing/test_nose.py:310–335  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

308
309
310def test_setup_teardown_linking_issue265(pytester: Pytester) -> None:
311 # we accidentally didn't integrate nose setupstate with normal setupstate
312 # this test ensures that won't happen again
313 pytester.makepyfile(
314 '''
315 import pytest
316
317 class TestGeneric(object):
318 def test_nothing(self):
319 """Tests the API of the implementation (for generic and specialized)."""
320
321 @pytest.mark.skipif("True", reason=
322 "Skip tests to check if teardown is skipped as well.")
323 class TestSkipTeardown(TestGeneric):
324
325 def setup(self):
326 """Sets up my specialized implementation for $COOL_PLATFORM."""
327 raise Exception("should not call setup for skipped tests")
328
329 def teardown(self):
330 """Undoes the setup."""
331 raise Exception("should not call teardown for skipped tests")
332 '''
333 )
334 reprec = pytester.runpytest()
335 reprec.assert_outcomes(passed=1, skipped=1)
336
337
338def test_SkipTest_during_collection(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

assert_outcomesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected