diff --git a/tests/conftest.py b/tests/conftest.py index fd7ebde..3026db7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ # stdlib import datetime +from typing import Iterator # 3rd party import pytest @@ -12,11 +13,11 @@ @pytest.fixture() -def tar_regression(datadir, original_datadir, request) -> AdvancedFileRegressionFixture: +def tar_regression(datadir, original_datadir, request) -> AdvancedFileRegressionFixture: # noqa: MAN001 return TarFileRegressionFixture(datadir, original_datadir, request) @pytest.fixture() -def fixed_datetime(): +def fixed_datetime() -> Iterator: with with_fixed_datetime(datetime.datetime.fromtimestamp(1602552000.0)): yield diff --git a/tests/test_build.py b/tests/test_build.py index cd2e2b1..041f535 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -1,6 +1,6 @@ # stdlib import tempfile -from typing import Any, Dict +from typing import Any, Dict, List # 3rd party import pytest @@ -124,7 +124,7 @@ def test_build_success( advanced_data_regression.check(data) -def check_built_wheel(filename: PathPlus, tar_regression: TarFileRegressionFixture): +def check_built_wheel(filename: PathPlus, tar_regression: TarFileRegressionFixture) -> List[str]: assert filename.is_file() with TarFile.open(filename) as zip_file: diff --git a/tests/test_build_conda.py b/tests/test_build_conda.py index 5818f96..234fbb1 100644 --- a/tests/test_build_conda.py +++ b/tests/test_build_conda.py @@ -16,7 +16,7 @@ from whey_conda import CondaBuilder -def test_info_dir(tmp_pathplus): +def test_info_dir(tmp_pathplus: PathPlus) -> None: (tmp_pathplus / "pyproject.toml").write_text(DESCRIPTION) @@ -44,7 +44,7 @@ def test_info_dir(tmp_pathplus): ("domdfcoding", "mathematical"), ] ) -def test_build(username, repository, tmp_pathplus, monkeypatch): +def test_build(username: str, repository: str, tmp_pathplus: PathPlus, monkeypatch): # Monkeypatch dulwich so it doesn't try to use the global config. monkeypatch.setattr(StackedConfig, "default_backends", lambda *args: []) email = b"repo-helper[bot] <74742576+repo-helper[bot]@users.noreply.github.com>" diff --git a/tests/utils.py b/tests/utils.py index dab8ad3..98a4dbb 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -47,11 +47,11 @@ def open( class TarFileRegressionFixture(AdvancedFileRegressionFixture): - def check_archive(self, tar_file: TarFile, filename: str, **kwargs): + def check_archive(self, tar_file: TarFile, filename: str, **kwargs) -> None: self.check(tar_file.read_text(filename), **kwargs) -def get_stdouterr(capsys, tmpdir: pathlib.Path) -> Dict[str, str]: +def get_stdouterr(capsys, tmpdir: pathlib.Path) -> Dict[str, str]: # noqa: MAN001 outerr = capsys.readouterr() diff --git a/whey_conda/__init__.py b/whey_conda/__init__.py index 2eb6718..cfa5ec1 100644 --- a/whey_conda/__init__.py +++ b/whey_conda/__init__.py @@ -141,11 +141,11 @@ def info_dir(self) -> PathPlus: info_dir.maybe_make() return info_dir - def _echo_if_v(self, *args, **kwargs): + def _echo_if_v(self, *args, **kwargs) -> None: if self.verbose: self._echo(*args, **kwargs) - def write_conda_index(self, build_number: int = 1): + def write_conda_index(self, build_number: int = 1) -> None: """ Write the conda ``index.json`` file. @@ -178,7 +178,7 @@ def write_conda_index(self, build_number: int = 1): index_json_file.dump_json(index, indent=2) self.report_written(index_json_file) - def write_conda_about(self): + def write_conda_about(self) -> None: """ Write the conda ``about.json`` file. @@ -304,7 +304,7 @@ def create_conda_archive(self, wheel_contents_dir: PathLike, build_number: int = return os.path.basename(conda_filename) - def write_license(self, dest_dir: PathPlus, dest_filename: str = "LICENSE"): + def write_license(self, dest_dir: PathPlus, dest_filename: str = "LICENSE") -> None: """ Write the ``LICENSE`` file. @@ -384,7 +384,7 @@ def build_conda(self) -> str: build = build_conda -def pip_install_wheel(wheel_file: PathLike, target_dir: PathLike, verbose: bool = False): +def pip_install_wheel(wheel_file: PathLike, target_dir: PathLike, verbose: bool = False) -> None: command = [ "pip", "install",