From 97d3e7374466c3cff58b2de6825177c6d2bd0d05 Mon Sep 17 00:00:00 2001 From: "michael.richey" Date: Thu, 28 May 2026 10:13:25 -0400 Subject: [PATCH] fix(tests): keep VCR cassette open during setup_and_teardown teardown Declare vcr as an explicit fixture parameter so pytest finalises it after setup_and_teardown, not before. Without the dependency the teardown phase could run after the cassette was closed, causing real aiohttp calls that time out (30 s) in CI. Co-Authored-By: Claude Sonnet 4.6 --- tests/integration/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 918615e1..54621499 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -47,7 +47,7 @@ def setup(self, tmpdir_factory): os.chdir(my_tmpdir) @pytest.fixture(autouse=True, scope="function") - def setup_and_teardown(self, request, caplog: pytest.LogCaptureFixture): + def setup_and_teardown(self, request, caplog: pytest.LogCaptureFixture, vcr): """Set up before each test and clean up after each test.""" # Clean up resources from any previous tests self.clean_resource_files() @@ -55,7 +55,7 @@ def setup_and_teardown(self, request, caplog: pytest.LogCaptureFixture): # Run the test yield - # Clean up resources respecting the resources_to_preserve_filter + # vcr dependency keeps the cassette open so teardown HTTP calls are served from the recording. runner = CliRunner() self.test_resource_cleanup(runner, caplog)