diff --git a/README.md b/README.md index 3edcad3e..d19a0ed9 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ $ uvx usethis init ☐ Add test files to the '/tests' directory with the format 'test_*.py'. ☐ Add test functions with the format 'test_*()'. ☐ Run 'uv run pytest' to run the tests. +☐ Run 'uv run pytest --cov' to run your tests with Coverage.py. ``` To use Ruff on an existing project, run: diff --git a/src/usethis/_toolset/test.py b/src/usethis/_toolset/test.py index 13dff4b3..eda670c6 100644 --- a/src/usethis/_toolset/test.py +++ b/src/usethis/_toolset/test.py @@ -1,5 +1,6 @@ -from usethis._core.tool import use_pytest +from usethis._core.tool import use_coverage_py, use_pytest def use_test_frameworks(remove: bool = False, how: bool = False): use_pytest(remove=remove, how=how) + use_coverage_py(remove=remove, how=how) diff --git a/tests/usethis/_integrations/uv/test_init.py b/tests/usethis/_integrations/uv/test_init.py index 7928937f..e037a32a 100644 --- a/tests/usethis/_integrations/uv/test_init.py +++ b/tests/usethis/_integrations/uv/test_init.py @@ -11,7 +11,7 @@ from usethis._test import change_cwd -class TestTestOpinionatedUVInit: +class TestOpinionatedUVInit: def test_empty_dir(self, tmp_path: Path): # Act with change_cwd(tmp_path): diff --git a/tests/usethis/_interface/test_init.py b/tests/usethis/_interface/test_init.py index c6ef09ba..b70e894d 100644 --- a/tests/usethis/_interface/test_init.py +++ b/tests/usethis/_interface/test_init.py @@ -39,6 +39,7 @@ def test_pre_commit_included(self, tmp_path: Path): "☐ Add test files to the '/tests' directory with the format 'test_*.py'.\n" "☐ Add test functions with the format 'test_*()'.\n" "☐ Run 'uv run pytest' to run the tests.\n" + "☐ Run 'uv run pytest --cov' to run your tests with Coverage.py.\n" ) # Check the pre-commit hooks are added in the correct order @@ -87,6 +88,7 @@ def test_readme_example(self, tmp_path: Path): ☐ Add test files to the '/tests' directory with the format 'test_*.py'. ☐ Add test functions with the format 'test_*()'. ☐ Run 'uv run pytest' to run the tests. +☐ Run 'uv run pytest --cov' to run your tests with Coverage.py. """ ) @@ -156,6 +158,7 @@ def test_bitbucket_docstyle_and_status(self, tmp_path: Path): "☐ Add test files to the '/tests' directory with the format 'test_*.py'.\n" "☐ Add test functions with the format 'test_*()'.\n" "☐ Run 'uv run pytest' to run the tests.\n" + "☐ Run 'uv run pytest --cov' to run your tests with Coverage.py.\n" "✔ Adding Bitbucket Pipelines configuration.\n" "☐ Run your pipeline via the Bitbucket website.\n" )