Skip to content

Commit 53a01cb

Browse files
committed
TST: Use consistent name for environment variable and test skip function
1 parent 5abd6e3 commit 53a01cb

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

.github/workflows/test-wheel-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ jobs:
192192
if [[ "$COMPUTE_SANITIZER_VERSION" -ge 202111 ]]; then
193193
SANITIZER_CMD="${SANITIZER_CMD} --padding=32"
194194
fi
195-
echo "CUDA_PYTHON_SANITIZER_RUNNING=1" >> $GITHUB_ENV
195+
echo "CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER=1" >> $GITHUB_ENV
196196
else
197197
SANITIZER_CMD=""
198198
fi

cuda_bindings/docs/source/environment_variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
## Test-Time Environment Variables
1717

18-
- `CUDA_PYTHON_SANITIZER_RUNNING` : When set to 1, tests are skipped that would cause [compute-sanitizer](https://docs.nvidia.com/compute-sanitizer/ComputeSanitizer/index.html) to raise an error.
18+
- `CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER` : When set to 1, tests are skipped that would cause [compute-sanitizer](https://docs.nvidia.com/compute-sanitizer/ComputeSanitizer/index.html) to raise an error.

cuda_bindings/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
skipif_compute_sanitizer_is_running = pytest.mark.skipif(
6-
os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1",
5+
skipif_testing_with_compute_sanitizer = pytest.mark.skipif(
6+
os.environ.get("CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER", "0") == "1",
77
reason="The compute-sanitizer is running, and this test causes an API error.",
88
)

cuda_bindings/tests/test_cuda.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import numpy as np
1313
import pytest
14-
from conftest import skipif_compute_sanitizer_is_running
14+
from conftest import skipif_testing_with_compute_sanitizer
1515

1616
import cuda.cuda as cuda
1717
import cuda.cudart as cudart
@@ -84,7 +84,7 @@ def test_cuda_memcpy():
8484
assert err == cuda.CUresult.CUDA_SUCCESS
8585

8686

87-
@skipif_compute_sanitizer_is_running
87+
@skipif_testing_with_compute_sanitizer
8888
def test_cuda_array():
8989
(err,) = cuda.cuInit(0)
9090
assert err == cuda.CUresult.CUDA_SUCCESS
@@ -238,7 +238,7 @@ def test_cuda_uuid_list_access():
238238
assert err == cuda.CUresult.CUDA_SUCCESS
239239

240240

241-
@skipif_compute_sanitizer_is_running
241+
@skipif_testing_with_compute_sanitizer
242242
def test_cuda_cuModuleLoadDataEx():
243243
(err,) = cuda.cuInit(0)
244244
assert err == cuda.CUresult.CUDA_SUCCESS
@@ -626,7 +626,7 @@ def test_cuda_coredump_attr():
626626
assert err == cuda.CUresult.CUDA_SUCCESS
627627

628628

629-
@skipif_compute_sanitizer_is_running
629+
@skipif_testing_with_compute_sanitizer
630630
def test_get_error_name_and_string():
631631
(err,) = cuda.cuInit(0)
632632
assert err == cuda.CUresult.CUDA_SUCCESS
@@ -956,7 +956,7 @@ def test_CUmemDecompressParams_st():
956956
assert int(desc.dstActBytes) == 0
957957

958958

959-
@skipif_compute_sanitizer_is_running
959+
@skipif_testing_with_compute_sanitizer
960960
def test_all_CUresult_codes():
961961
max_code = int(max(cuda.CUresult))
962962
# Smoke test. CUDA_ERROR_UNKNOWN = 999, but intentionally using literal value.
@@ -989,21 +989,21 @@ def test_all_CUresult_codes():
989989
assert num_good >= 76 # CTK 11.0.3_450.51.06
990990

991991

992-
@skipif_compute_sanitizer_is_running
992+
@skipif_testing_with_compute_sanitizer
993993
def test_cuKernelGetName_failure():
994994
err, name = cuda.cuKernelGetName(0)
995995
assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE
996996
assert name is None
997997

998998

999-
@skipif_compute_sanitizer_is_running
999+
@skipif_testing_with_compute_sanitizer
10001000
def test_cuFuncGetName_failure():
10011001
err, name = cuda.cuFuncGetName(0)
10021002
assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE
10031003
assert name is None
10041004

10051005

1006-
@skipif_compute_sanitizer_is_running
1006+
@skipif_testing_with_compute_sanitizer
10071007
@pytest.mark.skipif(
10081008
driverVersionLessThan(12080) or not supportsCudaAPI("cuCheckpointProcessGetState"),
10091009
reason="When API was introduced",

cuda_bindings/tests/test_cudart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import numpy as np
1212
import pytest
13-
from conftest import skipif_compute_sanitizer_is_running
13+
from conftest import skipif_testing_with_compute_sanitizer
1414

1515
import cuda.cuda as cuda
1616
import cuda.cudart as cudart
@@ -71,7 +71,7 @@ def test_cudart_memcpy():
7171
assertSuccess(err)
7272

7373

74-
@skipif_compute_sanitizer_is_running
74+
@skipif_testing_with_compute_sanitizer
7575
def test_cudart_hostRegister():
7676
# Use hostRegister API to check for correct enum return values
7777
page_size = 80

cuda_core/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def clean_up_cffi_files():
6666
pass # noqa: SIM105
6767

6868

69-
skipif_compute_sanitizer_is_running = pytest.mark.skipif(
70-
os.environ.get("CUDA_PYTHON_SANITIZER_RUNNING", "0") == "1",
69+
skipif_testing_with_compute_sanitizer = pytest.mark.skipif(
70+
os.environ.get("CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER", "0") == "1",
7171
reason="The compute-sanitizer is running, and this test causes an API error.",
7272
)

cuda_core/tests/test_cuda_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
import pytest
6-
from conftest import skipif_compute_sanitizer_is_running
6+
from conftest import skipif_testing_with_compute_sanitizer
77

88
from cuda.bindings import driver, runtime
99
from cuda.core.experimental._utils import cuda_utils
@@ -42,7 +42,7 @@ def test_runtime_cuda_error_explanations_health():
4242

4343

4444
# this test causes an API error when the driver is too old to know about all of the error codes
45-
@skipif_compute_sanitizer_is_running
45+
@skipif_testing_with_compute_sanitizer
4646
def test_check_driver_error():
4747
num_unexpected = 0
4848
for error in driver.CUresult:

cuda_core/tests/test_event.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import numpy as np
1414
import pytest
15-
from conftest import skipif_compute_sanitizer_is_running
15+
from conftest import skipif_testing_with_compute_sanitizer
1616

1717
import cuda.core.experimental
1818
from cuda.core.experimental import Device, EventOptions, LaunchConfig, Program, ProgramOptions, launch
@@ -76,7 +76,7 @@ def test_is_done(init_cuda):
7676
assert event.is_done in (True, False)
7777

7878

79-
@skipif_compute_sanitizer_is_running
79+
@skipif_testing_with_compute_sanitizer
8080
def test_error_timing_disabled():
8181
device = Device()
8282
device.set_current()
@@ -99,7 +99,7 @@ def test_error_timing_disabled():
9999
event2 - event1
100100

101101

102-
@skipif_compute_sanitizer_is_running
102+
@skipif_testing_with_compute_sanitizer
103103
def test_error_timing_recorded():
104104
device = Device()
105105
device.set_current()
@@ -120,7 +120,7 @@ def test_error_timing_recorded():
120120

121121

122122
# TODO: improve this once path finder can find headers
123-
@skipif_compute_sanitizer_is_running
123+
@skipif_testing_with_compute_sanitizer
124124
@pytest.mark.skipif(os.environ.get("CUDA_PATH") is None, reason="need libcu++ header")
125125
@pytest.mark.skipif(tuple(int(i) for i in np.__version__.split(".")[:2]) < (2, 1), reason="need numpy 2.1.0+")
126126
def test_error_timing_incomplete():

cuda_core/tests/test_linker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
import pytest
6-
from conftest import skipif_compute_sanitizer_is_running
6+
from conftest import skipif_testing_with_compute_sanitizer
77

88
from cuda.core.experimental import Device, Linker, LinkerOptions, Program, ProgramOptions, _linker
99
from cuda.core.experimental._module import ObjectCode
@@ -142,7 +142,7 @@ def test_linker_link_invalid_target_type(compile_ptx_functions):
142142

143143

144144
# this test causes an API error when using the culink API
145-
@skipif_compute_sanitizer_is_running
145+
@skipif_testing_with_compute_sanitizer
146146
def test_linker_get_error_log(compile_ptx_functions):
147147
options = LinkerOptions(arch=ARCH)
148148

0 commit comments

Comments
 (0)