Remove ntfy: notifications go only through the app notification stream

Server: drop ntfy publishing (stage hooks, run outbox, chat attention, chat
tool notify, auto-switch and schedule notices), the chat push outbox (its
table is dropped at startup), ntfy status/endpoints and PIPELINES_NTFY_*.
The app_notifications stream, subscribe/clear and kinds are unchanged.
Notification settings keep run_finished/chat_needs_you/chat_reply_finished;
ntfy_enabled is accepted and ignored and its stored row is never read.

Stage type=ntfy is rejected: "ntfy stages were removed; notifications go to
the Pipelines apps — use the stage notify hook". The notify hook remains.

Installer: no ntfy build, accounts, config or supervisor child; manifest
gets top-level "mode" (legacy ntfy.mode still read). Reinstall retires an
old ntfy (safe PID-file stop, deletes binary, config, data dir, token, log,
with a note in logs/install.log); uninstall cleans leftovers.

App: ntfy settings section replaced by "Notification events"; texts updated.
Docs: docs/ntfy.md folded into docs/notifications.md; install, docker, cli,
author skill references updated; security review M1 marked resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 23:24:24 +00:00
parent 806b5eca46
commit fc7dbb0ac0
138 changed files with 1958 additions and 4651 deletions
+119 -191
View File
@@ -3,6 +3,7 @@ import io
import json
import os
import plistlib
import shutil
from contextlib import redirect_stdout
from pathlib import Path
import subprocess
@@ -18,41 +19,13 @@ manage_spec = importlib.util.spec_from_file_location("pipelines_manage", Path(__
manage = importlib.util.module_from_spec(manage_spec)
manage_spec.loader.exec_module(manage)
TOKEN = "tk_" + "a" * 29
NTFY_VERSION = "2.11.0"
NTFY_MODULE = "heckel.io/ntfy/v2"
def resolution():
"""The shape resolve_ntfy returns: an exact tag to build the server from."""
return {"repository": "binwiederhier/ntfy", "module": NTFY_MODULE,
"version": NTFY_VERSION, "tag": "v" + NTFY_VERSION}
class _Served:
def poll(self):
return None
def terminate(self):
pass
def wait(self, timeout=None):
return 0
def fake_ntfy_serve(command, **kwargs):
"""`ntfy serve` creates its account database next to its configuration."""
config = Path(command[command.index("--config") + 1])
(config.parent / "auth.db").write_bytes(b"")
return _Served()
OPENSSL = shutil.which("openssl")
class Recorder:
def __init__(self, token=TOKEN, volumes=(), image="pipelines-pipelines:latest",
def __init__(self, volumes=(), image="pipelines-pipelines:latest",
fail_create=False, fail_copy=False, fail_volume_ls=False, fail_build=False, fail_web=False,
host_model="fixture/host-default"):
self.calls = []
self.token = token
self.volumes = volumes
self.image = image
self.fail_create = fail_create
@@ -61,18 +34,8 @@ class Recorder:
self.fail_build = fail_build
self.fail_web = fail_web
self.host_model = host_model
self._module_cache = None
self.kwargs = []
def module_cache(self):
"""A stand-in Go module cache holding the pinned ntfy module source."""
if self._module_cache is None:
self._module_cache = tempfile.mkdtemp(prefix="gomodcache-")
source = Path(self._module_cache) / f"{NTFY_MODULE}@{resolution()['tag']}"
source.mkdir(parents=True)
(source / "go.mod").write_text(f"module {NTFY_MODULE}\n")
return self._module_cache
def __call__(self, command, **kwargs):
command = list(command)
self.calls.append(command)
@@ -106,8 +69,6 @@ class Recorder:
code = 1
else:
Path(command[3]).write_bytes(b"migrated")
elif command[0] == "go" and command[1:3] == ["env", "GOMODCACHE"]:
stdout = self.module_cache() + "\n"
elif command[0] == "go" and command[1:2] == ["build"]:
if self.fail_build:
code = 1
@@ -117,8 +78,6 @@ class Recorder:
output = Path(command[command.index("-o") + 1])
output.write_bytes(b"#!/bin/sh\n")
output.chmod(0o755)
if command[0].endswith("ntfy") and "token" in command:
stdout = f"token {self.token} created for pipeline-publisher\n"
return subprocess.CompletedProcess(command, code, stdout=stdout, stderr="")
def has(self, *parts):
@@ -138,12 +97,15 @@ class SetupNativeTests(unittest.TestCase):
# A disposable XDG config home keeps the client default out of the real
# user configuration during tests.
return setup_native.Setup(directory, prefix=Path(directory) / "prefix", runner=recorder,
resolver=resolution, popen=fake_ntfy_serve,
environ={"XDG_CONFIG_HOME": str(Path(directory) / "config"),
"PIPELINES_WEB_PASSWORD": "chosen tulip orbit canyon"})
"PIPELINES_WEB_PASSWORD": "chosen tulip orbit canyon",
# The update signing key stays in scratch too, made
# with the host OpenSSL (shutil.which is patched).
"PIPELINES_UPDATE_SIGNING_KEY": str(Path(directory) / "update-key.pem"),
"PIPELINES_OPENSSL": OPENSSL or ""})
@staticmethod
def which_all(opencode="/usr/bin/opencode", pi=None, cc="/usr/bin/cc"):
def which_all(opencode="/usr/bin/opencode", pi=None):
mapping = {"go": "/usr/bin/go", "python3": "/usr/bin/python3",
"git": "/usr/bin/git", "curl": "/usr/bin/curl", "node": "/usr/bin/node",
"launchctl": "/bin/launchctl", "systemctl": "/usr/bin/systemctl"}
@@ -151,8 +113,6 @@ class SetupNativeTests(unittest.TestCase):
mapping["opencode"] = opencode
if pi:
mapping["pi"] = pi
if cc:
mapping["cc"] = cc
return lambda name: mapping.get(name)
def test_reinstall_preserves_network_settings_and_explicit_flags_override(self):
@@ -160,17 +120,17 @@ class SetupNativeTests(unittest.TestCase):
installer = self.installer(directory, Recorder())
prefix = installer.resolve_prefix()
prefix.mkdir()
manifest = {"server_port": 8090, "ntfy_port": 8091,
manifest = {"server_port": 8090,
"bind_address": "127.0.0.2",
"web": {"port": 8096, "host": "127.0.0.1"}}
(prefix / setup_native.MARKER).write_text(json.dumps(manifest))
args = setup_native.arguments([])
installer.preserve_network_settings(prefix, args)
self.assertEqual((args.port, args.ntfy_port, args.web_port), (8090, 8091, 8096))
self.assertEqual((args.port, args.web_port), (8090, 8096))
self.assertEqual((args.bind_address, args.web_host), ("127.0.0.2", "127.0.0.1"))
args = setup_native.arguments(["--web-port=8082", "--port", "8080"])
installer.preserve_network_settings(prefix, args)
self.assertEqual((args.port, args.ntfy_port, args.web_port), (8080, 8091, 8082))
self.assertEqual((args.port, args.web_port), (8080, 8082))
(prefix / setup_native.MARKER).unlink()
args = setup_native.arguments([])
installer.preserve_network_settings(prefix, args)
@@ -447,7 +407,7 @@ class SetupNativeTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "OpenCode was not found"):
installer.harness()
def test_full_run_writes_manifest_tokens_and_config_without_harness_install(self):
def test_full_run_writes_manifest_and_config_without_harness_install_or_ntfy(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()
installer = self.installer(directory, recorder)
@@ -462,8 +422,10 @@ class SetupNativeTests(unittest.TestCase):
self.assertEqual(config["prefix"], str(prefix.resolve()))
self.assertEqual(config["server_port"], 8080)
self.assertEqual(config["bind_address"], "127.0.0.1")
self.assertEqual(config["ntfy"]["mode"], "native")
self.assertEqual(config["topic"], "pipelines")
self.assertEqual(config["mode"], "native")
self.assertEqual(manage.install_mode(config), "native")
for key in ("ntfy", "ntfy_port", "topic", "username", "public_url"):
self.assertNotIn(key, config)
self.assertEqual(config["opencode"], "/usr/bin/opencode")
self.assertEqual(config["pi"], "")
self.assertEqual(config["opencode_env"]["PIPELINES_DEFAULT_MODEL"], "fixture/host-default")
@@ -478,25 +440,17 @@ class SetupNativeTests(unittest.TestCase):
self.assertTrue(Path(config["registration"]).is_file())
self.assertTrue(recorder.has("start", "--prefix", str(prefix.resolve())))
self.assertEqual((prefix / setup_native.MARKER).stat().st_mode & 0o777, 0o600)
token_path = prefix / "secrets/publisher-token"
self.assertEqual(token_path.read_text(), TOKEN + "\n")
self.assertEqual(token_path.stat().st_mode & 0o777, 0o600)
text = (prefix / "data/ntfy/server.yml").read_text()
for needle in ('listen-http:', 'base-url: "http://192.168.1.20:8090"', 'cache-file:', 'auth-file:',
'auth-default-access: "deny-all"', 'enable-login: true', 'attachment-cache-dir:',
'attachment-expiry-duration:', 'attachment-total-size-limit:',
'attachment-file-size-limit:'):
self.assertIn(needle, text)
self.assertNotIn("topic", text)
self.assertFalse((prefix / "secrets/publisher-token").exists())
self.assertFalse((prefix / "data/ntfy").exists())
self.assertFalse((prefix / "bin/ntfy").exists())
self.assertNotIn("ntfy", Path(config["registration"]).read_text())
self.assertTrue(recorder.has(str(prefix.resolve() / "bin/pipelines"), "skill", "install"))
self.assertTrue(recorder.has("access", "pipeline-publisher", "pipelines", "write-only"))
self.assertTrue(recorder.has("access", "phone-reader", "pipelines", "read-only"))
self.assertFalse(any("ntfy" in part for call in recorder.calls for part in call))
discovery = [call for call in recorder.calls if call[0].endswith("opencode")]
self.assertEqual(discovery, [["/usr/bin/opencode", "api", "get", "/api/model/default"]])
self.assertFalse(any("pipelines-tui" in part for call in recorder.calls for part in call))
self.assertFalse(any(TOKEN in part for call in recorder.calls for part in call))
def test_reinstall_keeps_existing_publisher_token(self):
def test_reinstall_keeps_settings_and_prints_web_urls_last(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()
installer = self.installer(directory, recorder)
@@ -505,22 +459,100 @@ class SetupNativeTests(unittest.TestCase):
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"):
installer.run(setup_native.arguments(["--web-port", "8096"]))
before = (prefix / "secrets/publisher-token").read_text()
def refuse_resolution():
raise AssertionError("re-resolved ntfy despite a verified installed binary")
installer.resolver = refuse_resolution
recorder.calls.clear()
with redirect_stdout(io.StringIO()) as output:
installer.run(setup_native.arguments([]))
self.assertEqual((prefix / "secrets/publisher-token").read_text(), before)
self.assertEqual(manage.load(prefix)["web"]["port"], 8096)
self.assertEqual(output.getvalue().splitlines()[-4:], [
" http://localhost:8096/", " http://127.0.0.1:8096/",
"OpenCode is required (default stage and chat harness) and is set up by ./install.",
"Next: set up your agent harnesses: pipelines harness setup claude|codex|opencode|pi"])
self.assertFalse(any("token" in call for call in recorder.calls), "reinstall re-created the token")
self.assertNotIn("ntfy", output.getvalue())
def legacy_install(self, installer, prefix):
"""An install from before ntfy was removed, on disk."""
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"), \
redirect_stdout(io.StringIO()):
installer.run(setup_native.arguments([]))
manifest = json.loads((prefix / setup_native.MARKER).read_text())
manifest.pop("mode")
manifest.update(ntfy_port=8090, topic="pipelines", public_url="http://192.168.1.20:8090",
username="phone-reader",
ntfy={"mode": "native", "bin": str(prefix.resolve() / "bin/ntfy"), "version": "v2.38.1",
"config": str(prefix.resolve() / "data/ntfy/server.yml"),
"base_url": "http://192.168.1.20:8090"})
(prefix / setup_native.MARKER).write_text(json.dumps(manifest))
(prefix / "data/ntfy/attachments").mkdir(parents=True)
for name in ("bin/ntfy", "logs/ntfy.log", "data/ntfy/server.yml", "data/ntfy/auth.db"):
(prefix / name).write_text("old")
(prefix / "secrets/publisher-token").write_text("tk_secretsecret\n")
(prefix / "ntfy.pid").write_text("4321")
return manifest
def test_reinstall_retires_the_old_ntfy(self):
for running in (True, False):
with self.subTest(running=running), tempfile.TemporaryDirectory() as directory:
installer = self.installer(directory, Recorder())
prefix = Path(directory) / "prefix"
self.legacy_install(installer, prefix)
installer.install_log = prefix / "logs/install.log"
installer.install_log.write_text("earlier\n")
alive = [running]
killed = []
def command_line(pid):
return f"{prefix.resolve()}/bin/ntfy serve --config x" if pid == 4321 and alive[0] else None
def kill(pid, sig):
killed.append((pid, sig))
alive[0] = False
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"), \
patch.object(setup_native.manage, "process_command", side_effect=command_line), \
patch.object(setup_native.manage.os, "kill", side_effect=kill), \
redirect_stdout(io.StringIO()) as output:
installer.run(setup_native.arguments([]))
self.assertEqual(killed, [(4321, setup_native.manage.signal.SIGTERM)] if running else [])
for path in setup_native.manage.legacy_ntfy_paths(prefix):
self.assertFalse(path.exists(), path)
self.assertTrue((prefix / "data").is_dir())
config = manage.load(prefix)
self.assertEqual(config["mode"], "native")
for key in ("ntfy", "ntfy_port", "topic", "username", "public_url"):
self.assertNotIn(key, config)
log = installer.install_log.read_text()
self.assertIn("Retiring ntfy (version v2.38.1)", log)
self.assertIn(str(prefix.resolve() / "bin/ntfy"), log)
self.assertNotIn("tk_secretsecret", log)
self.assertEqual("Stopped the old ntfy server process." in log, running)
self.assertIn("Retired the old ntfy notification server", output.getvalue())
# A second reinstall has nothing left to retire.
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"), \
redirect_stdout(io.StringIO()) as output:
installer.run(setup_native.arguments([]))
self.assertEqual(installer.install_log.read_text().count("Retiring ntfy"), 1)
self.assertNotIn("ntfy", output.getvalue())
def test_reinstall_never_signals_a_reused_ntfy_pid(self):
with tempfile.TemporaryDirectory() as directory:
installer = self.installer(directory, Recorder())
prefix = Path(directory) / "prefix"
self.legacy_install(installer, prefix)
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"), \
patch.object(setup_native.manage, "process_command", return_value="/usr/bin/sleep 1000"), \
patch.object(setup_native.manage.os, "kill", side_effect=AssertionError("signalled a reused PID")), \
redirect_stdout(io.StringIO()):
installer.run(setup_native.arguments([]))
self.assertFalse((prefix / "ntfy.pid").exists())
self.assertFalse((prefix / "bin/ntfy").exists())
def test_upgrade_keeps_an_all_interfaces_web_host_with_a_warning_and_lan_is_opt_in(self):
with tempfile.TemporaryDirectory() as directory:
@@ -562,97 +594,10 @@ class SetupNativeTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "Invalid --web-host"):
installer.run(setup_native.arguments(["--web-host", "everywhere"]))
def test_ntfy_is_built_from_the_pinned_module(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()
installer = self.installer(directory, recorder)
prefix = Path(directory) / "prefix"
installer.prepare_layout(prefix)
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()):
path = installer.build_ntfy(prefix, resolution())
self.assertTrue(path.is_file())
self.assertTrue(path.stat().st_mode & 0o100)
self.assertTrue(recorder.has("go", "mod", "download", f"{NTFY_MODULE}@v{NTFY_VERSION}"))
build = next(call for call in recorder.calls if call[:2] == ["go", "build"] and call[-1] == ".")
self.assertIn("-trimpath", build)
self.assertIn(setup_native.NTFY_BUILD_TAGS, build)
self.assertTrue(any(f"-X main.version=v{NTFY_VERSION}" in part for part in build))
self.assertTrue(build[build.index("-o") + 1].endswith("/ntfy"))
kwargs = next(kw for call, kw in zip(recorder.calls, recorder.kwargs)
if call[:2] == ["go", "build"] and call[-1] == ".")
self.assertEqual(kwargs.get("env", {}).get("CGO_ENABLED"), "1")
def test_ntfy_install_handles_system_temp_on_another_filesystem(self):
with tempfile.TemporaryDirectory() as directory:
installer = self.installer(directory, Recorder())
prefix = Path(directory) / "prefix"
installer.prepare_layout(prefix)
installed = prefix / "bin/ntfy"
installed.write_bytes(b"previous binary")
replace = os.replace
def cross_device_guard(source, destination):
# Model /tmp on a separate mount from the installation prefix.
if not Path(source).is_relative_to(prefix / "bin"):
import errno
raise OSError(errno.EXDEV, "Invalid cross-device link")
return replace(source, destination)
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.os, "replace", side_effect=cross_device_guard):
installer.build_ntfy(prefix, resolution())
self.assertNotEqual(installed.read_bytes(), b"previous binary")
self.assertEqual(installed.stat().st_mode & 0o777, 0o755)
self.assertEqual(list((prefix / "bin").glob(".ntfy-*")), [])
def test_ntfy_build_is_reused_for_the_same_version(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()
installer = self.installer(directory, recorder)
prefix = Path(directory) / "prefix"
installer.prepare_layout(prefix)
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()):
installer.build_ntfy(prefix, resolution())
installer.write_manifest(prefix, {"ntfy": {"version": "v" + NTFY_VERSION}})
recorder.calls.clear()
installer.build_ntfy(prefix, resolution())
self.assertFalse(any(call[:2] == ["go", "build"] for call in recorder.calls),
"rebuilt ntfy for an already installed version")
def test_missing_c_compiler_fails_actionably(self):
installer = setup_native.Setup("/tmp", runner=Recorder(), resolver=resolution, environ={})
with patch.object(setup_native.shutil, "which", side_effect=self.which_all(cc=None)):
with self.assertRaisesRegex(ValueError, "No C compiler found"):
installer.require_compiler()
def test_ntfy_build_failure_is_reported(self):
with tempfile.TemporaryDirectory() as directory:
installer = self.installer(directory, Recorder(fail_build=True))
prefix = Path(directory) / "prefix"
installer.prepare_layout(prefix)
installed = prefix / "bin/ntfy"
installed.write_bytes(b"previous binary")
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()):
with self.assertRaisesRegex(ValueError, "build failed"):
installer.build_ntfy(prefix, resolution())
self.assertEqual(installed.read_bytes(), b"previous binary")
self.assertEqual(list((prefix / "bin").glob(".ntfy-*")), [])
def test_publisher_token_is_never_overwritten(self):
with tempfile.TemporaryDirectory() as directory:
prefix = Path(directory) / "prefix"
(prefix / "secrets").mkdir(parents=True)
path = prefix / "secrets/publisher-token"
setup_native.tokens.save_token(f"token {TOKEN} created", path, 0o600)
self.assertEqual(path.stat().st_mode & 0o777, 0o600)
with self.assertRaises(ValueError):
setup_native.tokens.save_token(f"token {TOKEN} created", path, 0o600)
self.assertEqual(path.read_text(), TOKEN + "\n")
def test_migration_copies_docker_data_only_when_absent(self):
with tempfile.TemporaryDirectory() as directory:
prefix = Path(directory) / "prefix"
(prefix / "data/ntfy").mkdir(parents=True)
(prefix / "data").mkdir(parents=True)
recorder = Recorder(volumes=("pipelines_pipelines-data", "pipelines_ntfy-data"))
installer = self.installer(directory, recorder)
self.assertTrue(installer.migrate_docker(prefix, replace=False))
@@ -660,7 +605,10 @@ class SetupNativeTests(unittest.TestCase):
self.assertTrue(any(call[:2] == ["docker", "cp"] and call[2].endswith("-wal")
for call in installer.runner.calls),
"the SQLite write-ahead log sidecar must be copied with the database")
self.assertEqual((prefix / "data/ntfy/auth.db").read_bytes(), b"migrated")
# ntfy's old Docker volume is not migrated: nothing uses it.
self.assertFalse((prefix / "data/ntfy").exists())
self.assertFalse(any("pipelines_ntfy-data" in part for call in recorder.calls
if call[1:2] == ["create"] for part in call))
def test_migration_keeps_existing_native_data_without_opt_in(self):
with tempfile.TemporaryDirectory() as directory:
@@ -693,7 +641,7 @@ class SetupNativeTests(unittest.TestCase):
with tempfile.TemporaryDirectory() as directory:
installer = setup_native.Setup(directory, prefix=Path(directory) / "prefix",
runner=no_docker, resolver=resolution, environ={})
runner=no_docker, environ={})
self.assertEqual(installer.docker_volumes(), ())
def test_requested_migration_failure_aborts(self):
@@ -705,23 +653,6 @@ class SetupNativeTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "install aborted"):
installer.migrate_docker(prefix, replace=False)
def test_full_run_migrates_docker_auth_store_before_native_accounts(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder(volumes=("pipelines_ntfy-data",))
installer = self.installer(directory, recorder)
prefix = Path(directory) / "prefix"
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"):
installer.run(setup_native.arguments([]))
# The migrated store must survive bootstrap instead of being shadowed.
self.assertEqual((prefix / "data/ntfy/auth.db").read_bytes(), b"migrated")
copy_index = next(i for i, call in enumerate(recorder.calls)
if call[0] == "docker" and call[1:2] == ["cp"])
add_index = next(i for i, call in enumerate(recorder.calls)
if "pipeline-publisher" in call and "user" in call)
self.assertLess(copy_index, add_index, "auth store migrated after native accounts were created")
def test_missing_local_image_aborts_migration(self):
with tempfile.TemporaryDirectory() as directory:
prefix = Path(directory) / "prefix"
@@ -994,8 +925,7 @@ class SetupNativeTests(unittest.TestCase):
shadow_dir = directory / "earlier"
shadow = self._fake_pipelines(shadow_dir / "pipelines", "old-version", "aaaa")
before = shadow.read_bytes()
installer = setup_native.Setup(directory, prefix=prefix, runner=subprocess.run,
resolver=resolution, environ={})
installer = setup_native.Setup(directory, prefix=prefix, runner=subprocess.run, environ={})
with patch.object(setup_native.shutil, "which", side_effect=lambda name: str(shadow) if name == "pipelines" else None):
output = io.StringIO()
with redirect_stdout(output):
@@ -1015,8 +945,7 @@ class SetupNativeTests(unittest.TestCase):
directory = Path(directory)
prefix = directory / "prefix"
installed = self._fake_pipelines(prefix / "bin/pipelines", "same-version", "cccc")
installer = setup_native.Setup(directory, prefix=prefix, runner=subprocess.run,
resolver=resolution, environ={})
installer = setup_native.Setup(directory, prefix=prefix, runner=subprocess.run, environ={})
with patch.object(setup_native.shutil, "which", return_value=str(installed)):
output = io.StringIO()
with redirect_stdout(output):
@@ -1027,7 +956,7 @@ class SetupNativeTests(unittest.TestCase):
def test_check_path_shadow_is_silent_without_a_path_binary(self):
with tempfile.TemporaryDirectory() as directory:
installer = setup_native.Setup(directory, prefix=Path(directory) / "prefix",
runner=subprocess.run, resolver=resolution, environ={})
runner=subprocess.run, environ={})
with patch.object(setup_native.shutil, "which", return_value=None):
output = io.StringIO()
with redirect_stdout(output):
@@ -1053,8 +982,7 @@ class SetupNativeTests(unittest.TestCase):
installed = self._fake_pipelines(prefix / "bin/pipelines", "new-version", "bbbb")
shadow = self._fake_pipelines(directory / "earlier/pipelines", "old-version", "aaaa")
runner = VersionRunner()
installer = setup_native.Setup(directory, prefix=prefix, runner=runner,
resolver=resolution, environ={})
installer = setup_native.Setup(directory, prefix=prefix, runner=runner, environ={})
with patch.object(setup_native.shutil, "which", return_value=str(shadow)):
output = io.StringIO()
with redirect_stdout(output):