Skip to content

Commit b96cf26

Browse files
committed
ci: optional tests fail in CI
1 parent a980ec2 commit b96cf26

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

.github/workflows/pull-request.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
RUSTC_WRAPPER: "sccache"
1717
# A constant location for the uv cache
1818
UV_CACHE_DIR: /tmp/.uv-cache
19+
CI: "true"
1920

2021

2122
jobs:

tests/integration/conftest.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
from pathlib import Path
55
import pytest
66
import subprocess
7+
import os
78

89

10+
IN_CI = len(os.getenv("CI", "")) > 0
11+
912
@pytest.fixture(scope="session")
1013
def export_test_cases_dir(request):
1114
r = request.config.getoption("--export-test-cases")
@@ -32,9 +35,12 @@ def validate(request, export_test_cases_dir: Path):
3235
# Check if the validator is installed
3336
validator = get_validator()
3437
if validator is None:
35-
pytest.fail("Run `cargo build -p release` to install the validator")
36-
else:
37-
pytest.skip("Skipping validation tests as requested")
38+
if IN_CI:
39+
pytest.fail("Validator not installed")
40+
else:
41+
pytest.skip(
42+
"Skipping validation: Run `cargo build` to install the validator"
43+
)
3844

3945
def validate_json(hugr: str):
4046
# Executes `cargo run -p validator -- validate -`
@@ -74,15 +80,20 @@ def f(hugr: Package, expected: int, fn_name: str = "main"):
7480
import execute_llvm
7581

7682
if not hasattr(execute_llvm, "run_int_function"):
77-
pytest.skip("Skipping llvm execution")
83+
if IN_CI:
84+
pytest.fail("run_int_function not available in CI")
85+
else:
86+
pytest.skip("Skipping llvm execution")
7887

7988
hugr_json: str = hugr.modules[0].to_json()
8089
res = execute_llvm.run_int_function(hugr_json, fn_name)
8190
if res != expected:
8291
raise LLVMException(
8392
f"Expected value ({expected}) doesn't match actual value ({res})"
8493
)
85-
except ImportError:
86-
pytest.skip("Skipping llvm execution")
87-
94+
except ImportError as e:
95+
if IN_CI:
96+
pytest.fail(f"run_int_fn failed in CI: {e}")
97+
else:
98+
pytest.skip("Skipping llvm execution")
8899
return f

0 commit comments

Comments
 (0)