From c64d77887e96f385e64105ab0859afdbc7d4e603 Mon Sep 17 00:00:00 2001 From: Kavi Gupta Date: Fri, 12 Jul 2024 19:09:07 -0400 Subject: [PATCH 1/4] add test for abspath in file cache --- tests/test_out_file_cache.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_out_file_cache.py b/tests/test_out_file_cache.py index f41634a..29ea348 100644 --- a/tests/test_out_file_cache.py +++ b/tests/test_out_file_cache.py @@ -64,6 +64,23 @@ def test_basic(self): self.assertCounter(1) self.assertAtPath("abc", "246") + def test_overwrite_self_same_path(self): + self.assertCounter(0) + self.assertEqual(self.f(123, out_file=self.out_path("abc")), [123, 2]) + self.assertCounter(1) + self.assertEqual(self.f(123, out_file=self.out_path("abc")), [123, 2]) + self.assertCounter(1) + self.assertAtPath("abc", "246") + + + def test_overwrite_self_same_abspath(self): + self.assertCounter(0) + self.assertEqual(self.f(123, out_file=self.out_path("abc")), [123, 2]) + self.assertCounter(1) + self.assertEqual(self.f(123, out_file=self.out_path("./abc")), [123, 2]) + self.assertCounter(1) + self.assertAtPath("abc", "246") + def test_basic_overwritten(self): self.assertCounter(0) self.assertEqual(self.f(123, out_file=self.out_path("abc")), [123, 2]) From f50a2ef753b6c2da7d84cac18d50101e7cc2155b Mon Sep 17 00:00:00 2001 From: Kavi Gupta Date: Fri, 12 Jul 2024 19:09:18 -0400 Subject: [PATCH 2/4] actually fix the bug --- permacache/out_file_cache.py | 1 + 1 file changed, 1 insertion(+) diff --git a/permacache/out_file_cache.py b/permacache/out_file_cache.py index 052d94c..54a0902 100644 --- a/permacache/out_file_cache.py +++ b/permacache/out_file_cache.py @@ -67,6 +67,7 @@ def do_copy_file(file_cache, out_path): """ Helper function for do_copy_files that copies a single file. """ + out_path = os.path.abspath(out_path) file_cache_valid = {} for path in file_cache: try: From db1380e0c0f4554e7e344a4168f639b6b3114584 Mon Sep 17 00:00:00 2001 From: Kavi Gupta Date: Fri, 12 Jul 2024 19:09:28 -0400 Subject: [PATCH 3/4] bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 75dc13e..33f336e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="permacache", - version="3.7.1", + version="3.7.2", author="Kavi Gupta", author_email="permacache@kavigupta.org", description="Permanant cache.", From 106303bdba3a1d94da19e965ce62774340a68109 Mon Sep 17 00:00:00 2001 From: Kavi Gupta Date: Fri, 12 Jul 2024 20:46:58 -0400 Subject: [PATCH 4/4] formatting --- tests/test_out_file_cache.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_out_file_cache.py b/tests/test_out_file_cache.py index 29ea348..e3ce31d 100644 --- a/tests/test_out_file_cache.py +++ b/tests/test_out_file_cache.py @@ -72,7 +72,6 @@ def test_overwrite_self_same_path(self): self.assertCounter(1) self.assertAtPath("abc", "246") - def test_overwrite_self_same_abspath(self): self.assertCounter(0) self.assertEqual(self.f(123, out_file=self.out_path("abc")), [123, 2])