test(scripts): cover a failing venv and name the extra collections path

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-24 07:25:10 +00:00
1 parent 8c52c91dfd
commit 1d28f1a8bc
2 files changed
+6 -5

No files matched your search

@@ -27,6 +27,7 @@ exit 0
# The base python: `-m venv <dir>` makes a venv whose bin holds a pip stub.
PYTHON_STUB = """#!/usr/bin/env bash
echo "python args=$*" >> "$STUB_LOG"
[ -n "${STUB_FAIL_python:-}" ] && exit 1
[ "$1 $2" = "-m venv" ] || exit 1
mkdir -p "$3/bin"
cp "$STUB_SOURCE" "$3/bin/pip"
@@ -124,7 +125,7 @@ class RunMoleculeInCiImageTest(unittest.TestCase):
line,
)
# The target alone, so a baked copy is not taken as already installed.
self.assertIn(f"acp={self.pins}/collections\n", line + "\n")
self.assertTrue(line.endswith(f"acp={self.pins}/collections"), line)
(runner,) = self.calls("runner")
self.assertIn(f"path={self.pins}/venv/bin:", runner)
self.assertIn(
@@ -142,7 +143,7 @@ class RunMoleculeInCiImageTest(unittest.TestCase):
)
def test_a_failing_install_fails_the_run(self):
for stub in ("pip", "ansible-galaxy"):
for stub in ("python", "pip", "ansible-galaxy"):
with self.subTest(stub=stub):
self.log.write_text("")
shutil.rmtree(self.pins, True)