test source existence; actually fix tests

This commit is contained in:
Ruben ten Hove
2022-07-06 13:07:02 -04:00
parent dccb1e220f
commit 69dd5790cf
2 changed files with 14 additions and 9 deletions

View File

@@ -1281,6 +1281,14 @@ def move_hosts_file_into_place(final_file):
""" # noqa: W605
filename = os.path.abspath(final_file.name)
try:
if not Path(filename).exists():
raise FileNotFoundError
except Exception:
print_failure(f"{filename} does not exist.")
return False
if platform.system() == "Windows":
target_file = str(Path(os.getenv("SystemRoot")) / "system32" / "drivers" / "etc" / "hosts")
else: