From 64ad0f69d50da1130907e3ac1b30f6cc60a9cd16 Mon Sep 17 00:00:00 2001 From: Iuri de Silvio Date: Sun, 19 Feb 2023 23:25:26 -0300 Subject: [PATCH] Get cache from disk to avoid cache overwriting. https://github.com/tholo/pytest-flake8/issues/94 --- pytest_black.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytest_black.py b/pytest_black.py index 04c80cb..d8f706e 100644 --- a/pytest_black.py +++ b/pytest_black.py @@ -39,7 +39,9 @@ def pytest_configure(config): def pytest_unconfigure(config): # save cached mtimes at end of session if hasattr(config, "_blackmtimes"): - config.cache.set(HISTKEY, config._blackmtimes) + cache = config.cache.get(HISTKEY, {}) + cache.update(config._blackmtimes) + config.cache.set(HISTKEY, cache) class BlackItem(pytest.Item, pytest.File):