Skip to content

Commit 07272dc

Browse files
committed
Skip source-only cuda.core tests for installed wheels
1 parent 1723666 commit 07272dc

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

cuda_core/tests/test_build_hooks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535

3636
from cuda.pathfinder import get_cuda_path_or_home
3737

38+
_skip_if_source_tree_unavailable = pytest.mark.skipif(
39+
os.environ.get("CUDA_CORE_TEST_SKIP_SOURCE_TREE_TESTS") == "1",
40+
reason="cuda.core source tree is unavailable in this test environment",
41+
)
42+
3843

3944
def _load_build_hooks():
4045
"""Load build_hooks module from source without permanently modifying sys.path.
@@ -245,6 +250,7 @@ def fake_cythonize(ext_modules, **kwargs):
245250
return Path(captured["build_dir"])
246251

247252

253+
@_skip_if_source_tree_unavailable
248254
class TestGeneratedSourceDirIsKeyed:
249255
"""Generated C++ must not be shared between CUDA majors.
250256

cuda_core/tests/test_rt_layout.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
storage or a body lives behind rt.hpp, which only _rt.pyx names.
1818
"""
1919

20+
import os
2021
import re
2122
from pathlib import Path
2223

2324
import pytest
2425

26+
_skip_if_source_tree_unavailable = pytest.mark.skipif(
27+
os.environ.get("CUDA_CORE_TEST_SKIP_SOURCE_TREE_TESTS") == "1",
28+
reason="cuda.core source tree is unavailable in this test environment",
29+
)
30+
2531
CORE = Path(__file__).resolve().parent.parent / "cuda" / "core"
2632
RT = CORE / "_cpp" / "rt"
2733
HEADERS = sorted(RT.glob("*.hpp"))
@@ -51,12 +57,14 @@ def include_closure(path):
5157
return sorted(seen)
5258

5359

60+
@_skip_if_source_tree_unavailable
5461
@pytest.mark.agent_authored(model="claude-fable-5-1")
5562
def test_python_h_is_spelled_only_in_py_hpp():
5663
spellers = [p.name for p in HEADERS + SOURCES if "<Python.h>" in read(p)]
5764
assert spellers == ["py.hpp"]
5865

5966

67+
@_skip_if_source_tree_unavailable
6068
@pytest.mark.agent_authored(model="claude-fable-5-1")
6169
def test_neutral_files_do_not_name_python():
6270
"""Every header except the seam and the umbrellas, and every source that does
@@ -76,6 +84,7 @@ def test_in_tree_includes_are_bare_sibling_names_that_exist():
7684
assert (RT / name).is_file(), f"{path.name} includes {name!r}, which does not exist"
7785

7886

87+
@_skip_if_source_tree_unavailable
7988
@pytest.mark.agent_authored(model="claude-fable-5-1")
8089
def test_umbrellas_are_named_only_by_their_cython_file():
8190
for path in HEADERS + SOURCES:
@@ -87,6 +96,7 @@ def test_umbrellas_are_named_only_by_their_cython_file():
8796
assert named == {"_cpp/rt/rt.hpp": {"_rt.pyx"}, "_cpp/rt/handles.hpp": {"_rt.pxd"}}
8897

8998

99+
@_skip_if_source_tree_unavailable
90100
@pytest.mark.agent_authored(model="claude-fable-5-1")
91101
def test_consumer_closure_is_types_and_the_python_seam():
92102
closure = {p.name for p in include_closure(RT / "handles.hpp")}
@@ -98,6 +108,7 @@ def test_consumer_closure_is_types_and_the_python_seam():
98108
assert not re.search(r"^(static|thread_local)\b", text, re.M), f"{name} defines storage"
99109

100110

111+
@_skip_if_source_tree_unavailable
101112
@pytest.mark.agent_authored(model="claude-fable-5-1")
102113
def test_pxd_functions_are_not_called_by_name_inside_the_module():
103114
"""Cython emits a static prototype for each cdef function the .pxd declares, so

0 commit comments

Comments
 (0)