improvements to rewrite cache invalidation

- stat the source path before it is read.
- Validate the source size in addition to mtime.
This commit is contained in:
Benjamin Peterson
2014-09-01 16:51:27 -04:00
parent 068548f7a9
commit d4cd1aad8e
3 changed files with 26 additions and 19 deletions

View File

@@ -511,13 +511,13 @@ class TestAssertionRewriteHookDetails(object):
state = AssertionState(config, "rewrite")
source_path = tmpdir.ensure("source.py")
pycpath = tmpdir.join("pyc").strpath
assert _write_pyc(state, [1], source_path, pycpath)
assert _write_pyc(state, [1], source_path.stat(), pycpath)
def open(*args):
e = IOError()
e.errno = 10
raise e
monkeypatch.setattr(b, "open", open)
assert not _write_pyc(state, [1], source_path, pycpath)
assert not _write_pyc(state, [1], source_path.stat(), pycpath)
def test_resources_provider_for_loader(self, testdir):
"""