Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Isolate launcher and uninstaller tests from host state (#1428)

Ali Khokhara4c2c372435b
diff --git a/tests/cli/test_entrypoints.py b/tests/cli/test_entrypoints.py
index 8fc7b95a..4786966b 100644
--- a/tests/cli/test_entrypoints.py
+++ b/tests/cli/test_entrypoints.py
@@ -46,6 +46,12 @@ class _JsonResponse:
return json.dumps(self._payload).encode("utf-8")
+def empty_proxy_bypass_env(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.delenv("NO_PROXY", raising=False)
+ monkeypatch.delenv("no_proxy", raising=False)
+
+
def test_cli_scripts_are_registered() -> None:
pyproject = tomllib.loads(
(Path(__file__).resolve().parents[2] / "pyproject.toml").read_text(
@@ -318,6 +324,7 @@ def test_claude_child_env_targets_current_proxy_config() -> None:
def test_launch_claude_passes_args_and_child_env(
monkeypatch: pytest.MonkeyPatch,
+ empty_proxy_bypass_env: None,
) -> None:
from free_claude_code.cli.launchers.claude import launch
@@ -371,6 +378,7 @@ def test_launch_claude_passes_args_and_child_env(
def test_launch_codex_passes_responses_config_and_child_env(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
+ empty_proxy_bypass_env: None,
) -> None:
from free_claude_code.cli.launchers.codex import launch
@@ -586,6 +594,7 @@ def test_pi_launcher_builds_scoped_session_command_and_proxy_env(
def test_launch_pi_registers_bundled_extension_for_sessions(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
+ empty_proxy_bypass_env: None,
) -> None:
from free_claude_code.cli.launchers.pi import launch
diff --git a/tests/scripts/test_uninstallers.py b/tests/scripts/test_uninstallers.py
index c15c8245..52e3f393 100644
--- a/tests/scripts/test_uninstallers.py
+++ b/tests/scripts/test_uninstallers.py
@@ -132,6 +132,16 @@ def posix_uninstall_harness(tmp_path: Path) -> PosixUninstallHarness:
_write_executable(bin_dir / "claude", "#!/bin/sh\nexit 0\n")
_write_executable(bin_dir / "codex", "#!/bin/sh\nexit 0\n")
_write_executable(bin_dir / "pi", "#!/bin/sh\nexit 0\n")
+ _write_executable(
+ bin_dir / "pgrep",
+ """#!/bin/sh
+[ -n "${FCC_RUNNING_COMMAND:-}" ] || exit 1
+case "$*" in
+ *"$FCC_RUNNING_COMMAND"*) printf '4242\n'; exit 0 ;;
+ *) exit 1 ;;
+esac
+""",
+ )
_write_executable(
bin_dir / "uv",
"""#!/bin/sh
@@ -199,6 +209,7 @@ printf '%s\n' "$FAKE_UNAME"
"CALL_LOG": str(log),
"FAKE_TOOL_BIN": str(tool_bin),
"FAKE_UNAME": "Darwin",
+ "FCC_RUNNING_COMMAND": "",
"FAIL_STEP": "",
}
)
@@ -351,6 +362,24 @@ def test_uninstall_sh_rejects_invalid_options_before_mutation(
assert posix_uninstall_harness.calls() == []
[email protected]("command_name", FCC_COMMANDS)
+def test_uninstall_sh_rejects_running_fcc_before_mutation(
+ posix_uninstall_harness: PosixUninstallHarness,
+ command_name: str,
+) -> None:
+ posix_uninstall_harness.env["FCC_RUNNING_COMMAND"] = command_name
+
+ result = posix_uninstall_harness.run()
+
+ assert result.returncode != 0
+ assert command_name in result.stderr
+ assert posix_uninstall_harness.fcc_home.exists()
+ assert all(
+ (posix_uninstall_harness.tool_bin / name).exists() for name in FCC_COMMANDS
+ )
+ assert posix_uninstall_harness.calls() == []
+
+
@pytest.mark.parametrize(
("command_name", "process_args"),
(