Skip to content

Commit 0b2d6bd

Browse files
committed
Fix type hints and warnings.
1 parent 3a83d63 commit 0b2d6bd

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

repo_helper/cli/commands/conda_recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ def make_recipe(out_dir) -> int:
4646
from domdf_python_tools.terminal_colours import Fore
4747

4848
# this package
49-
from repo_helper.conda import make_recipe
49+
from repo_helper import conda
5050
from repo_helper.utils import traverse_to_file
5151

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

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

57-
make_recipe(repo_dir, recipe_file)
57+
conda.make_recipe(repo_dir, recipe_file)
5858

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

repo_helper/conda.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def get_from_cache(channel_name: str) -> List[str]:
9696

9797
def compile_requirements(
9898
repo_dir: PathPlus,
99-
extras: Mapping[str, Iterable[Union[str, Requirement]]],
99+
extras: Mapping[str, Iterable[str]],
100100
) -> List[ComparableRequirement]:
101101
"""
102102
Compile a list of requirements for the package from the requirements.txt file and any extra dependencies.
@@ -142,7 +142,7 @@ def validate_requirements(
142142
143143
:param requirements:
144144
:param conda_channels:
145-
145+
146146
.. versionadded:: 2020.11.10
147147
""" # noqa: D400
148148

tests/test_config_vars.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,15 @@ class Test_py_modules(ListTest):
511511
config_var = py_modules
512512
test_value = ["domdf_spreadsheet_tools"]
513513

514+
def test_success(self):
515+
with pytest.warns(DeprecationWarning) as record:
516+
super().test_success()
517+
518+
# check that the message matches
519+
assert record[0].message.args == ( # type: ignore
520+
"The 'py_modules' configuration value is deprecated. Please make your module into a package instead.",
521+
)
522+
514523

515524
class Test_console_scripts(ListTest):
516525
config_var = console_scripts

tests/test_requirements_tools.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
#
2222

2323
# stdlib
24-
from collections import Sequence
25-
from typing import Union
24+
from typing import Sequence, Union
2625

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

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

0 commit comments

Comments
 (0)