diff --git a/test/test_module.py b/test/test_module.py new file mode 100644 index 0000000..0a55753 --- /dev/null +++ b/test/test_module.py @@ -0,0 +1,16 @@ +import os +import pytest +import updater +from unittest import mock + +@pytest.mark.parametrize("system", [("Windows", "Linux", "Darwin")]) +def test_find_datafiles(system): + with mock.patch("platform.system", return_value=system): + result = updater.find_datafiles() + if system == "Windows": + assert "bootstrap.exe" in result[0][1] + assert os.path.exists(result[0][1][0]) + else: + assert len(result[0][1]) == 2 + assert os.path.exists(result[0][1][0]) + assert os.path.exists(result[0][1][1]) \ No newline at end of file diff --git a/updater/__init__.py b/updater/__init__.py index 5b99436..a231cfe 100644 --- a/updater/__init__.py +++ b/updater/__init__.py @@ -1,8 +1,14 @@ import glob import os.path import platform +from typing import List, Tuple -def find_datafiles(): +def find_datafiles() -> List[Tuple[str, List[str]]]: + """ Returns path to the updater bootstrap file. + + :returns: A tuple of the form ("", ["bootstrap_file"]) + :rtype: tuple + """ system = platform.system() if system == 'Windows': file_ext = '*.exe'