Skip to content

Commit

Permalink
Make codecov only run on Python3.10 (#1545)
Browse files Browse the repository at this point in the history
* Make codecov only run on Python3.10

* Bump to pytest-cov 5.0.0

* Skip gather tests

* Implement feedback

* Make mypy happy

* Implement feedback Malte
  • Loading branch information
IgorSusmelj committed May 22, 2024
1 parent 8878b5b commit 8fc3a2e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,21 @@ jobs:
run: pip install -e '.[all]'
- name: Clean Previous Coverage Data
run: rm -f .coverage
- name: Run Pytest
- name: Run Pytest (Python 3.7)
if: matrix.python == '3.7'
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
pip install pytest-cov==4.1.0
python -m pytest -s -v --runslow --ignore=./lightly/openapi_generated/
- name: Run Pytest with Coverage (Python 3.10)
if: matrix.python == '3.10'
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
pip install pytest-cov==5.0.0
python -m pytest -s -v --runslow --cov=./lightly --cov-report=xml --ignore=./lightly/openapi_generated/
- name: Upload coverage to Codecov
if: matrix.python == '3.10'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 5 additions & 0 deletions tests/utils/test_dist__gather__benchmark_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any, Generator, Tuple

import pytest
Expand Down Expand Up @@ -35,6 +36,10 @@ def close_torch_distributed() -> Generator[None, None, None]:
torch.distributed.destroy_process_group()


@pytest.mark.skipif(
os.getenv("GITHUB_ACTIONS") is not None,
reason="This test is running in parallel and breaks codecov",
)
class TestGatherLayerBenchmarkModule:
"""
Tests that the gather layer works as expected.
Expand Down
5 changes: 5 additions & 0 deletions tests/utils/test_dist__gather__losses.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any, Generator, Tuple, Type

import pytest
Expand Down Expand Up @@ -61,6 +62,10 @@ def close_torch_distributed() -> Generator[None, None, None]:
torch.distributed.destroy_process_group()


@pytest.mark.skipif(
os.getenv("GITHUB_ACTIONS") is not None,
reason="This test is running in parallel and breaks codecov",
)
class TestGatherLayer_Losses:
"""
Tests that the gather layer works as expected.
Expand Down

0 comments on commit 8fc3a2e

Please sign in to comment.