Tests: skip test_get_build_command_in_last_line gracefully when g++ is unavailable

Open Beginner friendly
#368 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp, python
Domain
testing-qa

Research direction

Open tests/test_build_markdown_cpp_cell.py and locate test_get_build_command_in_last_line. Check how the test invokes g++ and verify the behavior when g++ is unavailable. Done means the test is explicitly skipped without g++ and still runs its existing assertion when g++ is installed.

Written by the indexing model from the issue text.

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:

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.

Dominant language
Jupyter Notebook
Stars
12
Forks
75
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kangwonlee/nmisp

All issues in kangwonlee/nmisp

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.