Skip to content

Commit 13563a6

Browse files
committed
Run slow tests in separate job
1 parent 101b487 commit 13563a6

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ jobs:
3636
runs-on: ${{ matrix.os }}
3737
steps:
3838
- uses: actions/checkout@v4
39-
with:
40-
fetch-depth: 1 # Fetch the latest commit to inspect its message
4139

4240
- name: Set up Python ${{ matrix.python-version }}
4341
uses: actions/setup-python@v5
@@ -53,16 +51,9 @@ jobs:
5351
run: |
5452
python -m pip list
5553
56-
- name: Fetch latest commit message
57-
id: get_commit_message
58-
run: echo "COMMIT_MESSAGE=$(git log -2 --pretty=%B)" >> $GITHUB_ENV
59-
6054
- name: Test with PyTest
61-
env:
62-
COMMIT_MESSAGE: ${{ env.COMMIT_MESSAGE }}
6355
run: |
64-
echo "COMMIT_MESSAGE: ${{ env.COMMIT_MESSAGE }}"
65-
pytest -v -rsx -n 2 --cov=segmentation_models_pytorch --cov-report=xml --cov-config=pyproject.toml
56+
pytest -v -rsx -n 2 --cov=segmentation_models_pytorch --cov-report=xml --cov-config=pyproject.toml -k "not logits_match"
6657
6758
- name: Upload coverage reports to Codecov
6859
uses: codecov/codecov-action@v5
@@ -71,11 +62,26 @@ jobs:
7162
slug: qubvel-org/segmentation_models.pytorch
7263
if: matrix.os == 'macos-latest' && matrix.python-version == '3.12'
7364

65+
test_logits_match:
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
- name: Set up Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: "3.9"
73+
- name: Install dependencies
74+
run: |
75+
python -m pip install uv
76+
python -m uv pip install --system -r requirements/required.txt -r requirements/test.txt
77+
- name: Test with PyTest
78+
run: RUN_SLOW=1 pytest -v -rsx -n 2 -k "logits_match"
79+
7480
minimum:
7581
runs-on: ubuntu-latest
7682
steps:
7783
- uses: actions/checkout@v4
78-
- name: Set up Python ${{ matrix.python-version }}
84+
- name: Set up Python
7985
uses: actions/setup-python@v5
8086
with:
8187
python-version: "3.9"
@@ -87,4 +93,4 @@ jobs:
8793
run: |
8894
python -m pip list
8995
- name: Test with pytest
90-
run: pytest -v -rsx -n 2
96+
run: pytest -v -rsx -n 2 -k "not logits_match"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ markers = [
6969
"unet",
7070
"unetplusplus",
7171
"upernet",
72+
"logits_match",
7273
]
7374

7475
[tool.coverage.run]

tests/models/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
2+
import pytest
23
import inspect
34
import tempfile
45
import unittest
56
from functools import lru_cache
7+
from huggingface_hub import hf_hub_download
68

79
import torch
810
import segmentation_models_pytorch as smp
@@ -174,9 +176,8 @@ def test_save_load_with_hub_mixin(self):
174176

175177
@slow_test
176178
@requires_torch_greater_or_equal("2.0.1")
179+
@pytest.mark.logits_match
177180
def test_preserve_forward_output(self):
178-
from huggingface_hub import hf_hub_download
179-
180181
model = smp.from_pretrained(self.hub_checkpoint).eval()
181182

182183
input_tensor_path = hf_hub_download(

tests/models/test_segformer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class TestSegformerModel(base.BaseModelTester):
1212

1313
@slow_test
1414
@requires_torch_greater_or_equal("2.0.1")
15+
@pytest.mark.logits_match
1516
def test_load_pretrained(self):
1617
hub_checkpoint = "smp-hub/segformer-b0-512x512-ade-160k"
1718

0 commit comments

Comments
 (0)