Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_modify(tmpdir):
mktree(tmpdir, tree)
watcher = AllWatcher(str(tmpdir))
assert watcher.check() == set()
sleep(0.01)
tmpdir.join('foo/bar.txt').write('foobar')
assert watcher.check() == {(Change.modified, str(tmpdir.join('foo/bar.txt')))}
def test_add(tmpdir):
watcher = AllWatcher(str(tmpdir))
changes = watcher.check()
assert changes == set()
sleep(0.01)
tmpdir.join('foo.txt').write('foobar')
changes = watcher.check()
assert changes == {(Change.added, str(tmpdir.join('foo.txt')))}
def test_delete(tmpdir):
mktree(tmpdir, tree)
watcher = AllWatcher(str(tmpdir))
sleep(0.01)
tmpdir.join('foo/bar.txt').remove()
assert watcher.check() == {(Change.deleted, str(tmpdir.join('foo/bar.txt')))}
def test_does_not_exist(caplog):
AllWatcher('/foo/bar')
assert "error walking file system: FileNotFoundError [Errno 2] No such file or directory: '/foo/bar'" in caplog.text