fix(verify-manual): use a real temp file instead of /dev/stdin for the registry round-trip test
Generate documentation / build-docs (push) Successful in 3m30s
Generate documentation / build-docs (push) Successful in 3m30s
fish 3.7 (Ubuntu 24.04's packaged version, used in CI) rejects 'source /dev/stdin' when it's backed by a pipe, with "'/dev/stdin' is not a file" -- fish 4.8 (local dev) accepts it. Writing the generated registry to a real temp file sources identically across fish versions.
This commit is contained in:
+22
-12
@@ -1097,8 +1097,16 @@ def test_render_registry_is_valid_fish_and_round_trips():
|
|||||||
"""Sourcing render()'s output must leave the two arrays in the exact
|
"""Sourcing render()'s output must leave the two arrays in the exact
|
||||||
shape __fish_config_op_registry_lookup expects -- checked via the real
|
shape __fish_config_op_registry_lookup expects -- checked via the real
|
||||||
lookup helper (functions/__fish_config_op_registry_lookup.fish, Task
|
lookup helper (functions/__fish_config_op_registry_lookup.fish, Task
|
||||||
2) rather than re-parsing the generated text by hand."""
|
2) rather than re-parsing the generated text by hand.
|
||||||
|
|
||||||
|
Written to a real temp file rather than piped through `source
|
||||||
|
/dev/stdin`: fish 3.7 (Ubuntu 24.04's packaged version, used in CI)
|
||||||
|
rejects `/dev/stdin` with "is not a file" when it's backed by a pipe,
|
||||||
|
even though fish 4.8 accepts it -- sourcing an actual file on disk is
|
||||||
|
the portable form across fish versions.
|
||||||
|
"""
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
|
||||||
import generate_component_registry as gcr
|
import generate_component_registry as gcr
|
||||||
|
|
||||||
@@ -1109,17 +1117,19 @@ def test_render_registry_is_valid_fish_and_round_trips():
|
|||||||
text = gcr.render(registry)
|
text = gcr.render(registry)
|
||||||
|
|
||||||
repo = Path(__file__).parent.parent
|
repo = Path(__file__).parent.parent
|
||||||
proc = subprocess.run(
|
with tempfile.TemporaryDirectory() as d:
|
||||||
[
|
registry_path = Path(d) / "registry.fish"
|
||||||
"fish", "-c",
|
registry_path.write_text(text)
|
||||||
f"source {repo}/functions/__fish_config_op_registry_lookup.fish; "
|
proc = subprocess.run(
|
||||||
"source /dev/stdin; "
|
[
|
||||||
"__fish_config_op_registry_lookup rm ''; echo status=$status",
|
"fish", "-c",
|
||||||
],
|
f"source {repo}/functions/__fish_config_op_registry_lookup.fish; "
|
||||||
input=text,
|
f"source {registry_path}; "
|
||||||
capture_output=True,
|
"__fish_config_op_registry_lookup rm ''; echo status=$status",
|
||||||
text=True,
|
],
|
||||||
)
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
assert "aliases/filesystem" in proc.stdout, f"unexpected output: {proc.stdout!r} {proc.stderr!r}"
|
assert "aliases/filesystem" in proc.stdout, f"unexpected output: {proc.stdout!r} {proc.stderr!r}"
|
||||||
assert "status=0" in proc.stdout, f"lookup did not report found: {proc.stdout!r}"
|
assert "status=0" in proc.stdout, f"lookup did not report found: {proc.stdout!r}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user