From 73ae9649188d312fef29316e0efce58453542b63 Mon Sep 17 00:00:00 2001
From: jakkdl
Date: Fri, 15 Mar 2024 15:54:17 +0100
Subject: [PATCH] remove test_scope_fixture_caching1/2, they're now in a
separate PR
---
testing/python/fixtures.py | 77 --------------------------------------
1 file changed, 77 deletions(-)
diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py
index 6f469542b..d525cae87 100644
--- a/testing/python/fixtures.py
+++ b/testing/python/fixtures.py
@@ -4676,80 +4676,3 @@ def test_scoped_fixture_teardown_order(pytester: Pytester) -> None:
)
result = pytester.runpytest()
assert result.ret == 0
-
-
-def test_scope_fixture_caching_1(pytester: Pytester) -> None:
- """
- Make sure setup and finalization is only run once when using fixture
- multiple times. This might be a duplicate of another test."""
- pytester.makepyfile(
- """
- from __future__ import annotations
-
- from typing import Generator
-
- import pytest
- executed: list[str] = []
- @pytest.fixture(scope="class")
- def fixture_1() -> Generator[None, None, None]:
- executed.append("fix setup")
- yield
- executed.append("fix teardown")
-
-
- class TestFixtureCaching:
- def test_1(self, fixture_1: None) -> None:
- assert executed == ["fix setup"]
-
- def test_2(self, fixture_1: None) -> None:
- assert executed == ["fix setup"]
-
-
- def test_expected_setup_and_teardown() -> None:
- assert executed == ["fix setup", "fix teardown"]
- """
- )
- result = pytester.runpytest()
- assert result.ret == 0
-
-
-def test_scope_fixture_caching_2(pytester: Pytester) -> None:
- """Make sure setup & finalization is only run once, with a cached exception."""
- pytester.makepyfile(
- """
- from __future__ import annotations
-
- from typing import Generator
-
- import pytest
- executed_crash: list[str] = []
-
-
- @pytest.fixture(scope="class")
- def fixture_crash(request: pytest.FixtureRequest) -> None:
- executed_crash.append("fix_crash setup")
-
- def my_finalizer() -> None:
- executed_crash.append("fix_crash teardown")
-
- request.addfinalizer(my_finalizer)
-
- raise Exception("foo")
-
-
- class TestFixtureCachingException:
- @pytest.mark.xfail
- def test_crash_1(self, fixture_crash: None) -> None:
- ...
-
- @pytest.mark.xfail
- def test_crash_2(self, fixture_crash: None) -> None:
- ...
-
-
- def test_crash_expected_setup_and_teardown() -> None:
- assert executed_crash == ["fix_crash setup", "fix_crash teardown"]
- """
- )
- result = pytester.runpytest()
- assert result.ret == 0