File tree Expand file tree Collapse file tree
src/usethis/_tool/impl/base Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,7 +214,6 @@ reportCallInDefaultInitializer = false
214214reportExplicitAny = false
215215reportImplicitOverride = false
216216reportImplicitStringConcatenation = false
217- reportImportCycles = false
218217reportInvalidAbstractMethod = false
219218reportMissingParameterType = false
220219reportMissingTypeArgument = false
Original file line number Diff line number Diff line change 88from usethis ._backend .uv .detect import is_uv_used
99from usethis ._console import how_print
1010from usethis ._tool .base import Tool
11+ from usethis ._tool .heuristics import is_likely_used
1112from usethis ._tool .impl .spec .coverage_py import CoveragePyToolSpec
13+ from usethis ._tool .impl .spec .pytest import PytestToolSpec
1214from usethis ._types .backend import BackendEnum
1315from usethis ._types .deps import Dependency
1416
1517
1618class CoveragePyTool (CoveragePyToolSpec , Tool ):
1719 @final
1820 def test_deps (self , * , unconditional : bool = False ) -> list [Dependency ]:
19- from usethis ._tool .impl .base .pytest import ( # to avoid circularity; # noqa: PLC0415
20- PytestTool ,
21- )
22-
2321 deps = [Dependency (name = "coverage" , extras = frozenset ({"toml" }))]
24- if unconditional or PytestTool (). is_used ( ):
22+ if unconditional or is_likely_used ( PytestToolSpec () ):
2523 deps += [Dependency (name = "pytest-cov" )]
2624 return deps
2725
2826 @final
2927 def print_how_to_use (self ) -> None :
30- from usethis ._tool .impl .base .pytest import ( # to avoid circularity; # noqa: PLC0415
31- PytestTool ,
32- )
33-
3428 backend = get_backend ()
3529
36- if PytestTool (). is_used ( ):
30+ if is_likely_used ( PytestToolSpec () ):
3731 if backend is BackendEnum .uv and is_uv_used ():
3832 how_print (
3933 f"Run 'uv run pytest --cov' to run your tests with { self .name } ."
Original file line number Diff line number Diff line change 1818from usethis ._integrations .environ .python import get_supported_minor_python_versions
1919from usethis ._python .version import PythonVersion
2020from usethis ._tool .base import Tool
21+ from usethis ._tool .heuristics import is_likely_used
22+ from usethis ._tool .impl .spec .coverage_py import CoveragePyToolSpec
2123from usethis ._tool .impl .spec .pytest import PytestToolSpec
2224from usethis ._types .backend import BackendEnum
2325from usethis ._types .deps import Dependency
3133class PytestTool (PytestToolSpec , Tool ):
3234 @final
3335 def test_deps (self , * , unconditional : bool = False ) -> list [Dependency ]:
34- from usethis ._tool .impl .base .coverage_py import ( # to avoid circularity; # noqa: PLC0415
35- CoveragePyTool ,
36- )
37-
3836 deps = [Dependency (name = "pytest" )]
39- if unconditional or CoveragePyTool (). is_used ( ):
37+ if unconditional or is_likely_used ( CoveragePyToolSpec () ):
4038 deps += [Dependency (name = "pytest-cov" )]
4139 return deps
4240
You can’t perform that action at this time.
0 commit comments