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

Run cov in src and not in tests #925

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
source_pkgs = huggingface_hub
18 changes: 6 additions & 12 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ on:
branches:
- main
- ci_*
paths-ignore:
- "js/**"
- "api-inference-community/**"
pull_request:
types: [assigned, opened, synchronize, reopened]
paths-ignore:
- "js/**"
- "api-inference-community/**"

env:
HUGGINGFACE_CO_STAGING: yes
Expand Down Expand Up @@ -42,10 +36,10 @@ jobs:
- run: |
if [[ "${{ matrix.test_repository }}" == "Repository only" ]]
then
pytest --cov -Werror::FutureWarning --log-cli-level=INFO -sv ./tests/test_repository.py -k RepositoryTest
pytest --cov=src --cov-config=.coveragerc -Werror::FutureWarning --log-cli-level=INFO -sv ./tests/test_repository.py -k RepositoryTest

else
pytest --cov -Werror::FutureWarning --log-cli-level=INFO -sv ./tests/ -k 'not RepositoryTest'
pytest --cov=src --cov-config=.coveragerc -Werror::FutureWarning --log-cli-level=INFO -sv ./tests/ -k 'not RepositoryTest'
fi

- name: Upload coverage reports to Codecov with GitHub Action
Expand All @@ -70,7 +64,7 @@ jobs:
pip install --upgrade pip
pip install .[testing,torch]

- run: pytest --cov -Werror::FutureWarning -sv ./tests/test_hubmixin*
- run: pytest --cov=src --cov-config=.coveragerc -Werror::FutureWarning -sv ./tests/test_hubmixin*

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Expand All @@ -95,7 +89,7 @@ jobs:
pip install --upgrade pip
pip install .[testing,tensorflow]

- run: pytest --cov -Werror::FutureWarning -sv ./tests/test_keras*
- run: pytest --cov=src --cov-config=.coveragerc -Werror::FutureWarning -sv ./tests/test_keras*

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Expand All @@ -119,7 +113,7 @@ jobs:
pip install --upgrade pip
pip install .[testing,fastai]

- run: pytest --cov -Werror::FutureWarning -sv ./tests/test_fastai*
- run: pytest --cov=src --cov-config=.coveragerc -Werror::FutureWarning -sv ./tests/test_fastai*

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Expand All @@ -144,7 +138,7 @@ jobs:
pip install --upgrade pip
pip install .[testing]

- run: RUN_GIT_LFS_TESTS=1 pytest --cov -Werror::FutureWarning -sv ./tests/ -k "HfLargefilesTest"
- run: RUN_GIT_LFS_TESTS=1 pytest --cov=src --cov-config=.coveragerc -Werror::FutureWarning -sv ./tests/ -k "HfLargefilesTest"

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3