From 6ef3156b17731c435bb9372027fb446fdad03a86 Mon Sep 17 00:00:00 2001 From: akamat10 Date: Sun, 29 Sep 2024 12:54:58 -0400 Subject: [PATCH] Fix mypy errors --- tests/lint/unittest_expand_modules.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py index 1af94bd080..b9ae0631fa 100644 --- a/tests/lint/unittest_expand_modules.py +++ b/tests/lint/unittest_expand_modules.py @@ -312,20 +312,20 @@ def test_expand_modules_with_ignore( assert not errors -def test_discover_package_path_no_source_root_overlap(tmp_path): +def test_discover_package_path_no_source_root_overlap(tmp_path: Path) -> None: """Test whether source_roots is returned even if module doesn't overlap with source_roots """ - source_roots = [tmp_path] + source_roots = [str(tmp_path)] package_paths = discover_package_path(__file__, source_roots) expected = source_roots assert package_paths == expected -def test_discover_package_path_legacy(): +def test_discover_package_path_legacy() -> None: """Test for legacy path discovery when source_roots is empty""" - source_roots = [] + source_roots: list[str] = [] package_paths = discover_package_path(__file__, source_roots) # First ancestor directory without __init__.py @@ -334,16 +334,18 @@ def test_discover_package_path_legacy(): assert package_paths == expected -def test_discover_package_path_legacy_no_parent_without_init_py(tmp_path, monkeypatch): +def test_discover_package_path_legacy_no_parent_without_init_py( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: """Test to return current directory if no parent directory without __init__.py is found """ - source_roots = [] + source_roots: list[str] = [] monkeypatch.setattr(os.path, "exists", lambda path: True) monkeypatch.setattr(os.path, "dirname", lambda path: path) - package_paths = discover_package_path(tmp_path, source_roots) + package_paths = discover_package_path(str(tmp_path), source_roots) expected = [os.getcwd()]