From 290c07450d7726edc487ebd6574c13d0b47cee79 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 14 Feb 2020 12:35:00 -0300 Subject: [PATCH] Compatibility with upcoming pytest 5.4 `FixtureDef.cache_result` will be always set in pytest 5.4 (https://github.com/pytest-dev/pytest/pull/6737). This change makes it compatible when the new version is released while keeping it backward compatible. --- python/pytest/freeze fixtures/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pytest/freeze fixtures/conftest.py b/python/pytest/freeze fixtures/conftest.py index d03295f..4914265 100644 --- a/python/pytest/freeze fixtures/conftest.py +++ b/python/pytest/freeze fixtures/conftest.py @@ -29,7 +29,7 @@ def pytest_fixture_setup(fixturedef, request): def pytest_fixture_post_finalizer(fixturedef, request): if not request.node.nodeid: return - if not hasattr(fixturedef, 'cached_result'): + if getattr(fixturedef, 'cached_result', None) is None: return file_path = construct_file_path(fixturedef, request) with open(file_path, 'wb') as outt: