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

Add test coverage #183

Merged
merged 5 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
run: |
mypy itscalledsoccer
ruff check itscalledsoccer
- name: Pytest
- name: Run Pytest and generate coverage file
run: |
pytest
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=itscalledsoccer tests/ | tee pytest-coverage.txt
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
10 changes: 9 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ For more information, see the [venv documentation](https://docs.python.org/3/lib
The following command will install the appropriate dependencies in the virtual environment you just created.

```sh
pip install ".[dev]"
pip install ".[test]"
```

#### Make your changes
Expand Down Expand Up @@ -209,6 +209,14 @@ ruff format itscalledsoccer
pytest
```

Whenever you add or modify code, you should ensure that your changes have test coverage. To create a test coverage report, run the below command.

```sh
pytest --cov=itscalledsoccer --cov-report=html
```
Open htmlcov/index.html in a browser and review the generated coverage report.


#### Open a pull request

Once the tests are in good shape and the code has been linted and formatted, you're ready to open a pull request (PR). The [GitHub docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) provide great instructions on how to do just that.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Repository = "https://github.com/American-Soccer-Analysis/itscalledsoccer"
test = [
"types-requests",
"pytest",
"pytest-cov",
"mypy",
"ruff",
"mkdocs",
Expand Down
Loading