X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fintegration%2Ftestlib%2Fcheck.py;h=524ca623f949bb86274271a67d9b17f8115ea6d5;hb=3d787920d51a35e74e442c7265be3b13b69ad8e4;hp=1d1dfb0f8767e7bbfbe7790b26f81b469cf4bbc7;hpb=76de8e3924fc36e5a3e906741bf640dceb846800;p=tinc diff --git a/test/integration/testlib/check.py b/test/integration/testlib/check.py index 1d1dfb0f..524ca623 100755 --- a/test/integration/testlib/check.py +++ b/test/integration/testlib/check.py @@ -1,6 +1,8 @@ """Simple assertions which print the expected and received values on failure.""" +import os.path import typing as T +from pathlib import Path from .log import log @@ -86,3 +88,9 @@ def files_eq(path0: str, path1: str) -> None: if content0 != content1: raise ValueError(f"expected files {path0} and {path1} to match") + + +def file_exists(path: T.Union[str, Path]) -> None: + """Check that file or directory exists.""" + if not os.path.exists(path): + raise ValueError("expected path '{path}' to exist")