summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_filecmp.py
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2013-06-14 22:19:11 (GMT)
committerNed Deily <nad@acm.org>2013-06-14 22:19:11 (GMT)
commit7bff3cbe3de7bc96575396ad3fd7bfc6058eaa94 (patch)
tree946c2fb6a2f593ece017c84bc8adf9cd3f1214d2 /Lib/test/test_filecmp.py
parent3fe35e65034de82c45e2d8fe1ebe4a2929c68453 (diff)
downloadcpython-7bff3cbe3de7bc96575396ad3fd7bfc6058eaa94.zip
cpython-7bff3cbe3de7bc96575396ad3fd7bfc6058eaa94.tar.gz
cpython-7bff3cbe3de7bc96575396ad3fd7bfc6058eaa94.tar.bz2
Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache.
Patch by Mark Levitt
Diffstat (limited to 'Lib/test/test_filecmp.py')
-rw-r--r--Lib/test/test_filecmp.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_filecmp.py b/Lib/test/test_filecmp.py
index f760147..c7cb3fc 100644
--- a/Lib/test/test_filecmp.py
+++ b/Lib/test/test_filecmp.py
@@ -39,6 +39,13 @@ class FileCompareTestCase(unittest.TestCase):
self.assertFalse(filecmp.cmp(self.name, self.dir),
"File and directory compare as equal")
+ def test_cache_clear(self):
+ first_compare = filecmp.cmp(self.name, self.name_same, shallow=False)
+ second_compare = filecmp.cmp(self.name, self.name_diff, shallow=False)
+ filecmp.clear_cache()
+ self.assertTrue(len(filecmp._cache) == 0,
+ "Cache not cleared after calling clear_cache")
+
class DirCompareTestCase(unittest.TestCase):
def setUp(self):
tmpdir = tempfile.gettempdir()