def test_get_file(self, testdir, a_py): fs_data = SourceTree(rootdir=testdir.tmpdir.strpath, mtimes={'a.py': -100}, checksums={'a.py': -200}) fs_data.get_file('a.py') fs_data.mtimes['a.py'] = a_py.mtime fs_data.checksums['a.py'] = 'ec1fd361d4d73353c3f65cb10b86fcea4e0d0e42'
def test_get_file(self, testdir): a_py = testdir.makepyfile(a=""" def test_a(): return 0 """) file_system = SourceTree(rootdir=testdir.tmpdir.strpath) module = file_system.get_file("a.py") assert module.mtime == a_py.mtime() assert module.checksum == "de226b260917867990e4fb7aac70c5d6582266d4"
def test_empty_file(self, testdir): file_system = SourceTree(rootdir=testdir.tmpdir.strpath) testdir.makepyfile(__init__="") module = file_system.get_file("__init__.py") assert module.checksum == "da39a3ee5e6b4b0d3255bfef95601890afd80709"
def test_nonexistent_file(self, testdir): file_system = SourceTree(rootdir=testdir.tmpdir.strpath) assert file_system.get_file("jdslkajfnoweijflaohdnoviwn.py") is None