Skip to content

Commit 9b125c3

Browse files
Test: add SKIP_TENSOR_TESTS env variable and apply it
1 parent 19178ad commit 9b125c3

File tree

7 files changed

+75
-10
lines changed

7 files changed

+75
-10
lines changed

.github/workflows/check-onemath.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ jobs:
133133
if: env.rerun-tests-on-failure != 'true'
134134
run: |
135135
python -m pytest -ra --pyargs dpnp.tests
136+
env:
137+
SKIP_TENSOR_TESTS: 1
138+
SYCL_CACHE_PERSISTENT: 1
139+
140+
- name: Run tensor tests
141+
if: env.rerun-tests-on-failure != 'true'
142+
run: |
143+
python -m pytest -ra --pyargs dpnp.tests.tensor
136144
env:
137145
SYCL_CACHE_PERSISTENT: 1
138146

@@ -150,6 +158,24 @@ jobs:
150158
mamba activate ${{ env.test-env-name }}
151159
152160
python -m pytest -ra --pyargs dpnp.tests
161+
env:
162+
SKIP_TENSOR_TESTS: 1
163+
SYCL_CACHE_PERSISTENT: 1
164+
165+
- name: ReRun tensor tests on Linux
166+
if: env.rerun-tests-on-failure == 'true'
167+
id: run_tensor_tests
168+
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
169+
with:
170+
timeout_minutes: ${{ env.rerun-tests-timeout }}
171+
max_attempts: ${{ env.rerun-tests-max-attempts }}
172+
retry_on: any
173+
command: |
174+
. $CONDA/etc/profile.d/conda.sh
175+
. $CONDA/etc/profile.d/mamba.sh
176+
mamba activate ${{ env.test-env-name }}
177+
178+
python -m pytest -ra --pyargs dpnp.tests.tensor
153179
env:
154180
SYCL_CACHE_PERSISTENT: 1
155181

@@ -239,6 +265,14 @@ jobs:
239265
if: env.rerun-tests-on-failure != 'true'
240266
run: |
241267
python -m pytest -ra --pyargs dpnp.tests
268+
env:
269+
SKIP_TENSOR_TESTS: 1
270+
SYCL_CACHE_PERSISTENT: 1
271+
272+
- name: Run tensor tests
273+
if: env.rerun-tests-on-failure != 'true'
274+
run: |
275+
python -m pytest -ra --pyargs dpnp.tests.tensor
242276
env:
243277
SYCL_CACHE_PERSISTENT: 1
244278

@@ -256,5 +290,23 @@ jobs:
256290
mamba activate ${{ env.test-env-name }}
257291
258292
python -m pytest -ra --pyargs dpnp.tests
293+
env:
294+
SKIP_TENSOR_TESTS: 1
295+
SYCL_CACHE_PERSISTENT: 1
296+
297+
- name: ReRun tensor tests on Linux
298+
if: env.rerun-tests-on-failure == 'true'
299+
id: run_tensor_tests_branch
300+
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
301+
with:
302+
timeout_minutes: ${{ env.rerun-tests-timeout }}
303+
max_attempts: ${{ env.rerun-tests-max-attempts }}
304+
retry_on: any
305+
command: |
306+
. $CONDA/etc/profile.d/conda.sh
307+
. $CONDA/etc/profile.d/mamba.sh
308+
mamba activate ${{ env.test-env-name }}
309+
310+
python -m pytest -ra --pyargs dpnp.tests.tensor
259311
env:
260312
SYCL_CACHE_PERSISTENT: 1

.github/workflows/conda-package.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,12 @@ jobs:
220220
- name: Run tests
221221
if: env.rerun-tests-on-failure != 'true'
222222
run: |
223+
export SKIP_TENSOR_TESTS=1
223224
if [[ "${{ matrix.python }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then
224225
export DPNP_TEST_ALL_INT_TYPES=1
225-
python -m pytest -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
226+
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
226227
else
227-
python -m pytest -n auto -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
228+
python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests
228229
fi
229230
230231
- name: Run tests
@@ -239,12 +240,13 @@ jobs:
239240
. $CONDA/etc/profile.d/conda.sh
240241
. $CONDA/etc/profile.d/mamba.sh
241242
mamba activate ${{ env.test-env-name }}
243+
export SKIP_TENSOR_TESTS=1
242244
243245
if [[ "${{ matrix.python }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then
244246
export DPNP_TEST_ALL_INT_TYPES=1
245-
python -m pytest -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
247+
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
246248
else
247-
python -m pytest -n auto -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
249+
python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests
248250
fi
249251
250252
- name: Run tensor tests
@@ -402,11 +404,12 @@ jobs:
402404
if: env.rerun-tests-on-failure != 'true'
403405
shell: pwsh
404406
run: |
407+
$env:SKIP_TENSOR_TESTS=1
405408
if (${{ matrix.python }} -eq ${{ env.python-ver-test-all-dtypes }}) {
406409
$env:DPNP_TEST_ALL_INT_TYPES=1
407-
python -m pytest -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
410+
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
408411
} else {
409-
python -m pytest -n auto -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
412+
python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests
410413
}
411414
412415
- name: Run tests
@@ -419,11 +422,12 @@ jobs:
419422
retry_on: any
420423
shell: pwsh
421424
command: |
425+
$env:SKIP_TENSOR_TESTS=1
422426
if ( ${{ matrix.python }} -eq ${{ env.python-ver-test-all-dtypes }} ) {
423427
$env:DPNP_TEST_ALL_INT_TYPES=1
424-
python -m pytest -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
428+
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
425429
} else {
426-
python -m pytest -n auto -ra --deselect=tests/tensor --pyargs ${{ env.package-name }}.tests
430+
python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests
427431
}
428432
429433
- name: Run tensor tests

.github/workflows/generate_coverage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ jobs:
130130
conda activate coverage
131131
[ -f /opt/intel/oneapi/setvars.sh ] && source /opt/intel/oneapi/setvars.sh
132132
git clean -fxd
133+
export SKIP_TENSOR_TESTS=1
133134
python scripts/gen_coverage.py
134135
135136
- name: Total number of coverage attempts

conda-recipe/run_test.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ if %errorlevel% neq 0 exit 1
3737
"%PYTHON%" -m dpctl -f
3838
if %errorlevel% neq 0 exit 1
3939

40-
"%PYTHON%" -m pytest -ra --pyargs dpnp --deselect=tests/tensor
40+
set SKIP_TENSOR_TESTS=1
41+
"%PYTHON%" -m pytest -ra --pyargs dpnp
4142
if %errorlevel% neq 0 exit 1
4243

44+
set SKIP_TENSOR_TESTS=
4345
"%PYTHON%" -m pytest -ra --pyargs dpnp.tests.tensor
4446
if %errorlevel% neq 0 exit 1

conda-recipe/run_test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ set -e
3737

3838
$PYTHON -c "import dpnp; print(dpnp.__version__)"
3939
$PYTHON -m dpctl -f
40-
$PYTHON -m pytest -ra --pyargs dpnp --deselect=tests/tensor
40+
41+
SKIP_TENSOR_TESTS=1 $PYTHON -m pytest -ra --pyargs dpnp
4142

4243
$PYTHON -m pytest -ra --pyargs dpnp.tests.tensor

dpnp/tests/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
float16_types = bool(os.getenv("DPNP_TEST_FLOAT_16", 0))
55
complex_types = bool(os.getenv("DPNP_TEST_COMPLEX_TYPES", 0))
66
bool_types = bool(os.getenv("DPNP_TEST_BOOL_TYPES", 0))
7+
skip_tensor_tests = bool(int(os.getenv("SKIP_TENSOR_TESTS", 0)))
78

89

910
infra_warnings_enable = bool(os.getenv("DPNP_INFRA_WARNINGS_ENABLE", 0))

dpnp/tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def pytest_configure(config):
9797
# Equivalent to norecursedirs = tests_perf
9898
config.addinivalue_line("norecursedirs", "tests_perf")
9999

100+
# Equivalent to norecursedirs = tests/tensor (conditional)
101+
if dtype_config.skip_tensor_tests:
102+
config.addinivalue_line("norecursedirs", "tests/tensor")
103+
100104
# Register pytest markers
101105
config.addinivalue_line(
102106
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"

0 commit comments

Comments
 (0)