Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve README section for running tests #199

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,21 @@ all environments:
tox
```

Or you can run the tests via pytest with one of the following commands:
It is also possible to run only a special environment, e.g. `tox -e flake8` for
the linter, `tox -e py38` for running tests at the specified Python version (the
interpreter needs to be installed for this version) or `tox -e cov` for the
coverage report (see details below). These environments are configured in
`tox.ini`.

To ensure files are passing the style check, invoke `black .` to apply
correct formatting.

If you are running into issues installing dependencies (resulting in an error
like "Could not build wheels…"), try to remove the temporary `.tox` directory
(or the subfolder for the problematic environment within).

### Run tests via `pytest`
You can also run the tests via `pytest` with one of the following commands:

```
pytest
Expand All @@ -75,19 +89,18 @@ python3 -m pytest
./.tox/cov/bin/py.test
```

To get a coverage report, do:

To test only certain functions, there are several possibilities:
```
tox -e cov
./.tox/cov/bin/coverage html
pytest tests/test_openqa_review.py::test_reminder_comments_on_referenced_bugs_are_posted
pytest -k test_reminder_comments_on_referenced_bugs_are_posted
```

Then you will find a coverage report under `coverage_html/`.
### Generate coverage report
Run the following commands to generate a coverage report under `coverage_html/`:

To test only certain functions, there are several possibilities:
```
pytest tests/test_openqa_review.py::test_reminder_comments_on_referenced_bugs_are_posted
pytest -k test_reminder_comments_on_referenced_bugs_are_posted
tox -e cov
./.tox/cov/bin/coverage html
```

### Rules for commits
Expand Down