aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2023-04-16 17:06:39 +0100
committerGravatar wookie184 <[email protected]>2023-04-16 17:06:39 +0100
commit5789e3ea29d768be01214c1f360e21b56400fb4b (patch)
tree52906cb642af3666a3d8057b56c5750055b826fa
parentMerge pull request #2541 from python-discord/faster-tests (diff)
Don't collect coverage info by default when running tests
-rw-r--r--pyproject.toml6
-rw-r--r--tests/README.md12
2 files changed, 9 insertions, 9 deletions
diff --git a/pyproject.toml b/pyproject.toml
index d11791b2b..829e1a0d9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -56,9 +56,9 @@ lint = "pre-commit run --all-files"
precommit = "pre-commit install"
build = "docker build -t ghcr.io/python-discord/bot:latest -f Dockerfile ."
push = "docker push ghcr.io/python-discord/bot:latest"
-test-nocov = "pytest -n auto"
-test = "pytest -n auto --cov-report= --cov --ff"
-retest = "pytest -n auto --cov-report= --cov --lf"
+test = "pytest -n auto --ff"
+retest = "pytest -n auto --lf"
+test-cov = "pytest -n auto --cov-report= --cov"
html = "coverage html"
report = "coverage report"
isort = "isort ."
diff --git a/tests/README.md b/tests/README.md
index b7fddfaa2..5052c8381 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -26,12 +26,12 @@ We also use the following package as a test runner:
To ensure the results you obtain on your personal machine are comparable to those generated in the CI, please make sure to run your tests with the virtual environment defined by our [Poetry Project](/pyproject.toml). To run your tests with `poetry`, we've provided the following "script" shortcuts:
-- `poetry run task test-nocov` will run `pytest`.
-- `poetry run task test` will run `pytest` with `pytest-cov`.
+- `poetry run task test` will run `pytest`.
- `poetry run task test path/to/test.py` will run a specific test.
-- `poetry run task report` will generate a coverage report of the tests you've run with `poetry run task test`. If you append the `-m` flag to this command, the report will include the lines and branches not covered by tests in addition to the test coverage report.
+- `poetry run task test-cov` will run `pytest` with `pytest-cov`.
+- `poetry run task report` will generate a coverage report of the tests you've run with `poetry run task test-cov`. If you append the `-m` flag to this command, the report will include the lines and branches not covered by tests in addition to the test coverage report.
-If you want a coverage report, make sure to run the tests with `poetry run task test` *first*.
+If you want a coverage report, make sure to run the tests with `poetry run task test-cov` *first*.
## Running tests
There are multiple ways to run the tests, which one you use will be determined by your goal, and stage in development.
@@ -39,12 +39,12 @@ There are multiple ways to run the tests, which one you use will be determined b
When actively developing, you'll most likely be working on one portion of the codebase, and as a result, won't need to run the entire test suite.
To run just one file, and save time, you can use the following command:
```shell
-poetry run task test-nocov <path/to/file.py>
+poetry run task test <path/to/file.py>
```
For example:
```shell
-poetry run task test-nocov tests/bot/exts/test_cogs.py
+poetry run task test tests/bot/exts/test_cogs.py
```
will run the test suite in the `test_cogs` file.