Skip to content

Commit

Permalink
Add missing type hints.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Jun 7, 2022
1 parent 3d85df1 commit be621d1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# stdlib
import datetime
from typing import Iterator

# 3rd party
import pytest
Expand All @@ -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
4 changes: 2 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# stdlib
import tempfile
from typing import Any, Dict
from typing import Any, Dict, List

# 3rd party
import pytest
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_build_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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>"
Expand Down
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
10 changes: 5 additions & 5 deletions whey_conda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit be621d1

Please sign in to comment.