Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache.
Patch by Mark Levitt
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 @@
         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()