Fix 'refleak' introduced by fnmatch cache purge tests.

This introduces a 'purge' function for the fnmatch module analogous
to the 'purge' function in the re module.
This commit is contained in:
R. David Murray 2010-07-10 13:52:13 +00:00
parent a851483527
commit 0425a8ea72
3 changed files with 18 additions and 2 deletions

View file

@ -3,10 +3,14 @@
from test import support
import unittest
from fnmatch import fnmatch, fnmatchcase, _MAXCACHE, _cache, _cacheb
from fnmatch import fnmatch, fnmatchcase, _MAXCACHE, _cache, _cacheb, purge
class FnmatchTestCase(unittest.TestCase):
def tearDown(self):
purge()
def check_match(self, filename, pattern, should_match=1, fn=fnmatch):
if should_match:
self.assertTrue(fn(filename, pattern),