See Ash Code logo See Ash Code

My tests passed because the shell was not installed

Ashlynn Antrobus
• • 2 min read

My Fish integration tests had a condition that made them disappear from a machine without Fish:

requires_fish = pytest.mark.skipif(
    shutil.which("fish") is None, reason="fish not installed"
)

That is a reasonable way to let a developer run unrelated tests without installing every supported shell. It is much less useful if I read a green test command as evidence that Fish commands worked.

The July 11 repair followed a failure the fake-process tests couldn’t reveal. The real Fish process didn’t behave like the fake.

A Fish shell session showing its version and command completion suggestions.

A separate Fish shell session, not the test run: Fish shell 3.3.1 screenshot, software by ridiculousfish, siteshwar and JanKanis; screenshot by VulcanSphere, GPL version 2; unmodified.

Read the skipped cases

The distinction can be reproduced using the fixed July test file in an isolated checkout. Selecting its real-binary integration class gives these reports under two environments:

Fish absent:
11 skipped, 29 deselected

Fish 3.7.0 available on PATH:
11 passed, 29 deselected

These are reproduction results for the example, not recovered output from the original CI run. The same class was selected in both cases. The deselected tests weren’t part of that selection; the skipped tests were selected but didn’t execute.

In the first environment, pytest can exit successfully without exercising any of those eleven Fish cases. The skip reason explains why.

In the second, the cases actually start Fish. They check output, errors, exit status, directory tracking, parsing, completion, and related behavior. Their passing result applies to the fixed revision and the binary used for that reproduction.

What the fake assumed

The earlier fake stdin object supplied a canned response as soon as the runner wrote a command. That let tests exercise wrapper and sentinel parsing without a subprocess.

The real Fish process waited for EOF on the piped input in the arrangement I was using. My persistent-pipe runner kept that input open, so the expected response didn’t arrive.

The fake had supplied the behavior I needed to prove. A missing real binary meant the integration suite didn’t contradict it.

The repaired backend starts a fresh noninteractive process per execution. Its regression test wraps an execution in a timeout so a return of the old hang becomes a bounded failure instead of an indefinitely stuck suite.

A useful report needs its coverage boundary

For a supported optional dependency, I need at least one test environment where the relevant binary exists. A local skip can remain useful without being the only outcome recorded for that integration.

I’d read that green result as though Fish had run. The skip count was the part I needed to look at.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.