Tests: skip test_get_build_command_in_last_line gracefully when g++ is unavailable
- Dominant language
- Jupyter Notebook
- Stars
- 12
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Description
`tests/test_build_markdown_cpp_cell.py::test_get_build_command_in_last_line` shells out to `g++` to compile C++ snippets extracted from notebook markdown cells, then asserts the exit code is `0`. When `g++` is missing the test fails opaquely with exit code `32512` (`sh: 1: g++: not found`), as happened on the first push that consumed the new pre-built test container (commit 07b9fb8c → fixed in 593c05fd by adding `g++` to `docker/Dockerfile.nmisp-test`).
## Suggested fix
Wrap the test (or the module) with a skip when the toolchain is absent:
```python
import shutil
import pytest
@pytest.mark.skipif(shutil.which("g++") is None, reason="g++ not installed")
def test_get_build_command_in_last_line():
...
```
This makes the failure mode explicit (a clear `SKIPPED` instead of an exit-code-32512 `AssertionError`) the next time someone runs the suite outside the official container, and prevents a recurrence of the silent-toolchain-loss class of regression.
## Why this matters
The current assertion couples the test outcome to the *runtime environment* rather than the *code under test*. A skipif decouples them — the test still verifies build-command extraction when a compiler is available, and clearly signals "no compiler" otherwise.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.