Skip to content

Commit

Permalink
Fix type hints and warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Nov 10, 2020
1 parent 3a83d63 commit 0b2d6bd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions repo_helper/cli/commands/conda_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def make_recipe(out_dir) -> int:
from domdf_python_tools.terminal_colours import Fore

# this package
from repo_helper.conda import make_recipe
from repo_helper import conda
from repo_helper.utils import traverse_to_file

repo_dir = traverse_to_file(PathPlus.cwd(), "repo_helper.yml")

recipe_file = PathPlus(out_dir).resolve() / "meta.yaml"
recipe_file.parent.maybe_make()

make_recipe(repo_dir, recipe_file)
conda.make_recipe(repo_dir, recipe_file)

click.echo(Fore.GREEN(f"Wrote recipe to {recipe_file!s}"), color=resolve_color_default())

Expand Down
4 changes: 2 additions & 2 deletions repo_helper/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_from_cache(channel_name: str) -> List[str]:

def compile_requirements(
repo_dir: PathPlus,
extras: Mapping[str, Iterable[Union[str, Requirement]]],
extras: Mapping[str, Iterable[str]],
) -> List[ComparableRequirement]:
"""
Compile a list of requirements for the package from the requirements.txt file and any extra dependencies.
Expand Down Expand Up @@ -142,7 +142,7 @@ def validate_requirements(
:param requirements:
:param conda_channels:
.. versionadded:: 2020.11.10
""" # noqa: D400

Expand Down
9 changes: 9 additions & 0 deletions tests/test_config_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ class Test_py_modules(ListTest):
config_var = py_modules
test_value = ["domdf_spreadsheet_tools"]

def test_success(self):
with pytest.warns(DeprecationWarning) as record:
super().test_success()

# check that the message matches
assert record[0].message.args == ( # type: ignore
"The 'py_modules' configuration value is deprecated. Please make your module into a package instead.",
)


class Test_console_scripts(ListTest):
config_var = console_scripts
Expand Down
4 changes: 1 addition & 3 deletions tests/test_requirements_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#

# stdlib
from collections import Sequence
from typing import Union
from typing import Sequence, Union

# 3rd party
import pytest
Expand Down Expand Up @@ -207,7 +206,6 @@ def test_read_requirements_invalid(tmp_pathplus, file_regression: FileRegression
with pytest.warns(UserWarning) as record:
requirements, comments = read_requirements(tmp_pathplus / "requirements.txt")

# check that only one warning was raised
assert len(record) == 2
# check that the message matches
assert record[0].message.args[0] == "Ignored invalid requirement 'domdf-sphinx-theme!!!0.1.0'" # type: ignore
Expand Down

0 comments on commit 0b2d6bd

Please sign in to comment.