|
| 1 | +# Copyright 2026 Arm Limited and/or its affiliates. |
| 2 | +# |
| 3 | +# This source code is licensed under the BSD-style license found in the |
| 4 | +# LICENSE file in the root directory of this source tree. |
| 5 | + |
1 | 6 | import os |
2 | 7 | from typing import Any |
3 | 8 |
|
|
9 | 14 | from executorch.backends.test.suite.runner import run_test |
10 | 15 |
|
11 | 16 |
|
| 17 | +FLOW_TEST_CASE_TIMEOUTS = { |
| 18 | + "backends/test/suite/models/": 1200, |
| 19 | + "backends/test/suite/operators/": 120, |
| 20 | +} |
| 21 | + |
| 22 | + |
12 | 23 | def pytest_collection_modifyitems(config, items): |
13 | 24 | for item in items: |
14 | 25 | callspec = getattr(item, "callspec", None) |
15 | | - if callspec is None: |
16 | | - continue |
17 | | - flow = callspec.params.get("test_runner") |
18 | | - if not isinstance(flow, TestFlow): |
19 | | - continue |
20 | | - test_name = item.originalname or item.name |
21 | | - if flow.should_skip_test(test_name): |
22 | | - item.add_marker( |
23 | | - pytest.mark.skip(reason=f"Skipped by {flow.name} skip_patterns") |
24 | | - ) |
| 26 | + if callspec is not None: |
| 27 | + flow = callspec.params.get("test_runner") |
| 28 | + if isinstance(flow, TestFlow): |
| 29 | + test_name = item.originalname or item.name |
| 30 | + if flow.should_skip_test(test_name): |
| 31 | + item.add_marker( |
| 32 | + pytest.mark.skip(reason=f"Skipped by {flow.name} skip_patterns") |
| 33 | + ) |
| 34 | + |
| 35 | + item_path = str(getattr(item, "path", "")) |
| 36 | + for suite_prefix, timeout_s in FLOW_TEST_CASE_TIMEOUTS.items(): |
| 37 | + if suite_prefix in item_path: |
| 38 | + item.add_marker(pytest.mark.timeout(timeout_s)) |
| 39 | + break |
25 | 40 |
|
26 | 41 |
|
27 | 42 | def pytest_configure(config): |
|
0 commit comments