File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
tests/core/engine_adapter/integration Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 27
27
logger = logging .getLogger (__name__ )
28
28
29
29
30
+ @pytest .hookimpl (tryfirst = True , wrapper = True )
31
+ def pytest_fixture_post_finalizer (fixturedef : pytest .FixtureDef , request : pytest .FixtureRequest ):
32
+ try :
33
+ yield
34
+ except KeyError as e :
35
+ # The tmp_path fixture frequently throws errors like:
36
+ # - KeyError: <_pytest.stash.StashKey object at 0x79ba385fe1a0>
37
+ # in its teardown. This causes pytest to mark the test as failed even though we have zero control over this behaviour.
38
+ # So we log/swallow that particular error here rather than raising it
39
+ if fixturedef .argname == "tmp_path" and "_pytest.stash.StashKey" in repr (e ):
40
+ request .node .add_report_section (
41
+ "teardown" , "stderr" , f"Ignored tmp_path teardown error: { e } "
42
+ )
43
+ return
44
+ raise
45
+
46
+
30
47
@pytest .fixture
31
48
def config (tmp_path : pathlib .Path ) -> Config :
32
49
return load_config_from_paths (
You can’t perform that action at this time.
0 commit comments