Validate that the value is an existing file.
schema = vol.Schema(cv.isfile)
with tempfile.NamedTemporaryFile() as fp:
pass
for value in ("invalid", None, -1, 0, 80000, fp.name):
with pytest.raises(vol.Invalid):
schema(value)
After Change
schema = vol.Schema(cv.isfile)
fake_file = "this-file-does-not.exist"
assert not os.path.isfile(fake_file)
for value in ("invalid", None, -1, 0, 80000, fake_file):
with pytest.raises(vol.Invalid):
schema(value)