From f01cfef4a4939233c89fdbcd4c15d67f8be1caa7 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sat, 9 Nov 2024 23:04:16 +0000 Subject: [PATCH] prevent test suite not cleaning tmp dirs (#342) --- tests/test_cache_control.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_cache_control.py b/tests/test_cache_control.py index f77b4dd..40cac5b 100644 --- a/tests/test_cache_control.py +++ b/tests/test_cache_control.py @@ -6,8 +6,8 @@ Unit tests that verify our caching methods work correctly. """ +import os import time -from tempfile import mkdtemp from unittest.mock import ANY, Mock import pytest @@ -143,7 +143,7 @@ def test_update_cached_response_no_local_cache(self): result = cc.update_cached_response(req, resp) assert result is resp - def test_update_cached_response_with_valid_headers_separate_body(self): + def test_update_cached_response_with_valid_headers_separate_body(self, tmp_path): """ If the local cache has the given URL ``update_cached_response()`` will: @@ -152,7 +152,7 @@ def test_update_cached_response_with_valid_headers_separate_body(self): This is the version for a cache that stores a separate body. """ - cache = SeparateBodyFileCache(mkdtemp()) + cache = SeparateBodyFileCache(os.fsdecode(tmp_path)) self.update_cached_response_with_valid_headers_test(cache) def test_update_cached_response_with_valid_headers(self):