Skip to content

Commit 015ca0d

Browse files
committed
group tests by example time
1 parent 7232bcc commit 015ca0d

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.github/workflows/examples.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
matrix:
1919
os: [ubuntu-latest-16-cores, macos-latest, windows-latest-8-cores]
2020
pyv: ['3.9', '3.12']
21+
group: ['get_started', 'llm_and_nlp or computer_vision', 'multimodal']
2122
steps:
2223
- uses: actions/checkout@v4
2324

@@ -34,4 +35,4 @@ jobs:
3435
uv --version
3536
3637
- name: Run examples
37-
run: nox -s examples -p ${{ matrix.pyv }}
38+
run: nox -s examples -p ${{ matrix.pyv }} -- -m "${{ matrix.group }}"

examples/get_started/torch-loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def forward(self, x):
6464
optimizer = optim.Adam(model.parameters(), lr=0.001)
6565

6666
# Train the model
67-
num_epochs = 1
67+
num_epochs = 3
6868
for epoch in range(num_epochs):
6969
for i, data in enumerate(train_loader):
7070
inputs, labels = data

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ namespaces = false
118118
addopts = "-rfEs -m 'not benchmark and not examples'"
119119
markers = [
120120
"benchmark: benchmarks.",
121-
"e2e: End-to-end tests"
121+
"e2e: End-to-end tests",
122+
"examples: All examples",
123+
"computer_vision: Computer vision examples",
124+
"get_started: Get started examples",
125+
"llm_and_nlp: LLM and NLP examples",
126+
"multimodal: Multimodal examples",
122127
]
123128
asyncio_mode = "auto"
124129
filterwarnings = [

tests/examples/test_examples.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,28 @@ def smoke_test(example: str):
6464

6565

6666
@pytest.mark.examples
67+
@pytest.mark.get_started
6768
@pytest.mark.parametrize("example", get_started_examples)
6869
def test_get_started_examples(example):
6970
smoke_test(example)
7071

7172

7273
@pytest.mark.examples
74+
@pytest.mark.llm_and_nlp
7375
@pytest.mark.parametrize("example", llm_and_nlp_examples)
7476
def test_llm_and_nlp_examples(example):
7577
smoke_test(example)
7678

7779

7880
@pytest.mark.examples
81+
@pytest.mark.multimodal
7982
@pytest.mark.parametrize("example", multimodal_examples)
8083
def test_multimodal(example):
8184
smoke_test(example)
8285

8386

8487
@pytest.mark.examples
88+
@pytest.mark.computer_vision
8589
@pytest.mark.parametrize("example", computer_vision_examples)
8690
def test_computer_vision_examples(example):
8791
smoke_test(example)

0 commit comments

Comments
 (0)