Update importlib.invalidate_caches() to be more general.

This commit is contained in:
Brett Cannon 2012-02-27 18:15:42 -05:00
parent 9a4d7ddb6c
commit b46a1793a7
5 changed files with 62 additions and 38 deletions

View file

@ -143,6 +143,13 @@ class FinderTests(abc.FinderTests):
finally:
os.unlink('mod.py')
def test_invalidate_caches(self):
# invalidate_caches() should reset the mtime.
finder = _bootstrap._FileFinder('', _bootstrap._SourceFinderDetails())
finder._path_mtime = 42
finder.invalidate_caches()
self.assertEqual(finder._path_mtime, -1)
def test_main():
from test.support import run_unittest