Skip to content

Commit 8ffa20e

Browse files
committed
chore: update testing configuration and documentation
- Added the option to pytest in to allow tests to continue running after failures, enhancing test coverage during CI. - Updated the README to include the coverage badge, improving visibility of test coverage metrics. - Commented out the GPU and integration test jobs in the GitHub Actions workflow to streamline the CI process while maintaining the configuration for future use. - Refined assertions in unit tests to accommodate both float and numpy floating types, ensuring robustness in test validations.
1 parent 21031ca commit 8ffa20e

4 files changed

Lines changed: 84 additions & 83 deletions

File tree

.github/workflows/test.yml

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -91,83 +91,83 @@ jobs:
9191
htmlcov/
9292
junit.xml
9393
94-
test-gpu:
95-
runs-on: self-hosted
96-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
97-
strategy:
98-
fail-fast: false
99-
matrix:
100-
python-version: ["3.10"]
101-
102-
steps:
103-
- uses: actions/checkout@v4
104-
105-
- name: Set up Python ${{ matrix.python-version }}
106-
uses: actions/setup-python@v4
107-
with:
108-
python-version: ${{ matrix.python-version }}
109-
110-
- name: Install CUDA PyTorch
111-
run: |
112-
python -m pip install --upgrade pip
113-
pip install torch --index-url https://download.pytorch.org/whl/cu118
114-
115-
- name: Install package, dev, and test dependencies
116-
run: pip install -e ".[dev, tests]"
117-
118-
- name: Run GPU tests
119-
run: |
120-
pytest tests/unit/ -v \
121-
--cov=torchsom \
122-
--cov-report=xml \
123-
--cov-report=term-missing \
124-
--junit-xml=junit-gpu.xml \
125-
--timeout=600 \
126-
-m "gpu"
127-
env:
128-
CUDA_VISIBLE_DEVICES: 0
129-
130-
- name: Upload GPU test results
131-
uses: actions/upload-artifact@v4
132-
if: always()
133-
with:
134-
name: gpu-test-results
135-
path: |
136-
coverage.xml
137-
junit-gpu.xml
138-
139-
integration-tests:
140-
runs-on: ubuntu-latest
141-
needs: test
142-
if: false
143-
# github.event_name == 'push'
144-
steps:
145-
- uses: actions/checkout@v4
146-
147-
- name: Set up Python 3.10
148-
uses: actions/setup-python@v4
149-
with:
150-
python-version: "3.10"
151-
152-
- name: Install package, dev, and test dependencies
153-
run: pip install -e ".[dev, tests]"
154-
155-
- name: Run integration tests
156-
run: |
157-
pytest tests/ -v \
158-
--cov=torchsom \
159-
--cov-report=xml \
160-
--cov-report=term-missing \
161-
--junit-xml=junit-integration.xml \
162-
--timeout=600 \
163-
-m "integration"
164-
continue-on-error: true
165-
166-
- name: Upload integration test results
167-
uses: actions/upload-artifact@v4
168-
if: always()
169-
with:
170-
name: integration-test-results
171-
path: |
172-
coverage.xml
173-
junit-integration.xml
94+
# test-gpu:
95+
# runs-on: self-hosted
96+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
97+
# strategy:
98+
# fail-fast: false
99+
# matrix:
100+
# python-version: ["3.10"]
101+
102+
# steps:
103+
# - uses: actions/checkout@v4
104+
105+
# - name: Set up Python ${{ matrix.python-version }}
106+
# uses: actions/setup-python@v4
107+
# with:
108+
# python-version: ${{ matrix.python-version }}
109+
110+
# - name: Install CUDA PyTorch
111+
# run: |
112+
# python -m pip install --upgrade pip
113+
# pip install torch --index-url https://download.pytorch.org/whl/cu118
114+
115+
# - name: Install package, dev, and test dependencies
116+
# run: pip install -e ".[dev, tests]"
117+
118+
# - name: Run GPU tests
119+
# run: |
120+
# pytest tests/unit/ -v \
121+
# --cov=torchsom \
122+
# --cov-report=xml \
123+
# --cov-report=term-missing \
124+
# --junit-xml=junit-gpu.xml \
125+
# --timeout=600 \
126+
# -m "gpu"
127+
# env:
128+
# CUDA_VISIBLE_DEVICES: 0
129+
130+
# - name: Upload GPU test results
131+
# uses: actions/upload-artifact@v4
132+
# if: always()
133+
# with:
134+
# name: gpu-test-results
135+
# path: |
136+
# coverage.xml
137+
# junit-gpu.xml
138+
139+
# integration-tests:
140+
# runs-on: ubuntu-latest
141+
# needs: test
142+
# if: false
143+
# # github.event_name == 'push'
144+
# steps:
145+
# - uses: actions/checkout@v4
146+
147+
# - name: Set up Python 3.10
148+
# uses: actions/setup-python@v4
149+
# with:
150+
# python-version: "3.10"
151+
152+
# - name: Install package, dev, and test dependencies
153+
# run: pip install -e ".[dev, tests]"
154+
155+
# - name: Run integration tests
156+
# run: |
157+
# pytest tests/ -v \
158+
# --cov=torchsom \
159+
# --cov-report=xml \
160+
# --cov-report=term-missing \
161+
# --junit-xml=junit-integration.xml \
162+
# --timeout=600 \
163+
# -m "integration"
164+
# continue-on-error: true
165+
166+
# - name: Upload integration test results
167+
# uses: actions/upload-artifact@v4
168+
# if: always()
169+
# with:
170+
# name: integration-test-results
171+
# path: |
172+
# coverage.xml
173+
# junit-integration.xml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
<!-- Sonar Qube badges -->
1212
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
13-
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=coverage)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
1413
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
1514
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
1615
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
16+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=coverage)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
1717

1818
<!-- [![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM) -->
1919

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ addopts = [
161161
"--cov-config=pyproject.toml", # Use configuration from pyproject.toml
162162
"--junit-xml=junit.xml", # Create JUnit XML file for CI compatibility
163163
"-m unit or gpu", # default marker selection
164+
"--maxfail=0", # continue after failures: 0 means never stop on failure, 1 means stop after 1 failure and 10 means stop after 10 failures
164165
]
165166
# Custom pytest markers with descriptions
166167
markers = [

tests/unit/test_som.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,8 @@ def test_cluster_gmm_auto_components(
10121012

10131013
assert isinstance(result, dict)
10141014
assert result["n_clusters"] >= 1
1015-
assert isinstance(result["bic"], float)
1016-
assert isinstance(result["aic"], float)
1015+
assert isinstance(result["bic"], (float, np.floating))
1016+
assert isinstance(result["aic"], (float, np.floating))
10171017

10181018
# @pytest.mark.unit
10191019
def test_cluster_hdbscan_basic(

0 commit comments

Comments
 (0)