dangerzone/tests/test_util.py
Alex Pyrgiotis 03c3541bdc
tests: Run Mypy against tests
Run Mypy static checks against our tests. This brings them inline with
the rest of the codebase, and we have an extra level of certainty that
the tests (and unit tests in particular) will not significantly diverge
from the code they are testing.
2022-10-25 19:09:23 +03:00

23 lines
680 B
Python

import platform
import subprocess
from pathlib import Path
import pytest
import dangerzone.util as util
VERSION_FILE_NAME = "version.txt"
def test_get_resource_path() -> None:
share_dir = Path("share").resolve()
resource_path = Path(util.get_resource_path(VERSION_FILE_NAME)).parent
assert share_dir.samefile(
resource_path
), f"{share_dir} is not the same file as {resource_path}"
@pytest.mark.skipif(platform.system() != "Windows", reason="Windows-specific")
def test_get_subprocess_startupinfo() -> None:
startupinfo = util.get_subprocess_startupinfo()
assert isinstance(startupinfo, subprocess.STARTUPINFO) # type: ignore[attr-defined]