@@ -729,6 +729,20 @@ def function_fixture():
729729 yield
730730 logging.info('function teardown')
731731
732+ @pytest.fixture(scope='function')
733+ def function_skip_fixture():
734+ logging.info('skip fixture setup')
735+ pytest.skip('some reason')
736+ yield
737+ logging.info('skip fixture teardown')
738+
739+ @pytest.fixture(scope='function')
740+ def function_setup_fail_fixture():
741+ logging.info('fail fixture setup')
742+ assert False
743+ yield
744+ logging.info('fail fixture teardown')
745+
732746 class TestFirstPassLastFail:
733747
734748 @staticmethod
@@ -775,6 +789,16 @@ def test_2():
775789 logging.info("TestSkipLast 2")
776790 assert False
777791
792+ class TestSkipFixture:
793+ @staticmethod
794+ def test_1(function_skip_fixture):
795+ logging.info("TestSkipFixture 1")
796+
797+ class TestSetupFailed:
798+ @staticmethod
799+ def test_1(function_setup_fail_fixture):
800+ logging.info("TestSetupFailed 1")
801+
778802 class TestTestCaseFailFirstFailLast(TestCase):
779803
780804 @staticmethod
@@ -874,6 +898,24 @@ def test_2():
874898 mock .call ("TestSkipLast 1" ),
875899 mock .call ("function teardown" ),
876900 mock .call ("class teardown" ),
901+ # TestSkipFixture
902+ mock .call ("class setup" ),
903+ mock .call ("function setup" ),
904+ mock .call ("skip fixture setup" ),
905+ mock .call ("function teardown" ),
906+ mock .call ("class teardown" ),
907+ # TestSetupFailed
908+ mock .call ("class setup" ),
909+ mock .call ("function setup" ),
910+ mock .call ("fail fixture setup" ),
911+ mock .call ("function teardown" ),
912+ mock .call ("function setup" ),
913+ mock .call ("fail fixture setup" ),
914+ mock .call ("function teardown" ),
915+ mock .call ("function setup" ),
916+ mock .call ("fail fixture setup" ),
917+ mock .call ("function teardown" ),
918+ mock .call ("class teardown" ),
877919 # TestTestCaseFailFirstFailLast
878920 mock .call ("class setup" ),
879921 mock .call ("function setup" ),
@@ -923,4 +965,4 @@ def test_2():
923965 ]
924966
925967 logging .info .assert_has_calls (expected_calls , any_order = False )
926- assert_outcomes (result , failed = 8 , passed = 2 , rerun = 16 , skipped = 4 )
968+ assert_outcomes (result , failed = 8 , passed = 2 , rerun = 18 , skipped = 5 , error = 1 )
0 commit comments