From 9207b92f23fad7e9b23ffb49f5a44b172bb86d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20De=20Ara=C3=BAjo?= Date: Tue, 24 Dec 2024 11:19:01 +0000 Subject: [PATCH] check that test functions are not called when skipped --- tests/contrib/pytest/test_pytest_quarantine.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/contrib/pytest/test_pytest_quarantine.py b/tests/contrib/pytest/test_pytest_quarantine.py index bc429a070f9..93b0b07eade 100644 --- a/tests/contrib/pytest/test_pytest_quarantine.py +++ b/tests/contrib/pytest/test_pytest_quarantine.py @@ -183,6 +183,8 @@ def test_quarantine_outcomes_without_atr(self): ("teardown", "passed"), ] + assert len(rec.getcalls("pytest_pyfunc_call")) == 1 + def test_quarantine_outcomes_with_atr(self): self.testdir.makepyfile(test_fail_quarantined=_TEST_FAIL_QUARANTINED) @@ -211,6 +213,8 @@ def test_quarantine_outcomes_with_atr(self): ("teardown", "passed"), ] + assert len(rec.getcalls("pytest_pyfunc_call")) == 6 + def test_quarantine_fail_setup(self): self.testdir.makepyfile(test_fail_quarantined=_TEST_FAIL_SETUP_QUARANTINED) @@ -367,6 +371,8 @@ def _test_quarantine_outcomes(self, atr_enabled): ("teardown", "passed"), ] + assert len(rec.getcalls("pytest_pyfunc_call")) == 0 # test function is not called + def test_quarantine_fail_setup(self): self.testdir.makepyfile(test_fail_quarantined=_TEST_FAIL_SETUP_QUARANTINED)