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

Fail pytest on warnings without unsafe PTY forks (#1430)

Ali Khokhar691604186841
diff --git a/pyproject.toml b/pyproject.toml
index 25b57986..e4c0b882 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "5.3.1"
+version = "5.3.2"
description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"
readme = "README.md"
requires-python = ">=3.14.0"
@@ -109,6 +109,7 @@ skip-magic-trailing-comma = false
[tool.pytest.ini_options]
pythonpath = ["src"]
addopts = "-n auto"
+filterwarnings = ["error"]
testpaths = ["tests"]
markers = [
"live: opt-in local smoke tests that can touch real services",
diff --git a/tests/scripts/_pty_runner.py b/tests/scripts/_pty_runner.py
new file mode 100644
index 00000000..65081137
--- /dev/null
+++ b/tests/scripts/_pty_runner.py
@@ -0,0 +1,15 @@
+"""Run a command behind a PTY from a fresh single-threaded process."""
+
+import os
+import pty
+import sys
+
+
+def main() -> int:
+ spawn = vars(pty)["spawn"]
+ status = spawn(sys.argv[1:])
+ return os.waitstatus_to_exitcode(status)
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/tests/scripts/test_installers.py b/tests/scripts/test_installers.py
index 0da193ff..2467c883 100644
--- a/tests/scripts/test_installers.py
+++ b/tests/scripts/test_installers.py
@@ -214,11 +214,6 @@ printf '%s\n' "$FCC_PS_OUTPUT"
*args: str,
fail_step: str = "",
) -> subprocess.CompletedProcess[str]:
- import errno
- import pty
- import select
- import time
-
env = self.env | {
"FAIL_STEP": fail_step,
"FCC_INSTALLER": str(_repo_root() / "scripts" / "install.sh"),
@@ -230,53 +225,20 @@ printf '%s\n' "$FCC_PS_OUTPUT"
"fcc-installer",
*args,
]
- fork = vars(pty)["fork"]
- wait_without_blocking = vars(os)["WNOHANG"]
- child_pid, master_fd = fork()
- if child_pid == 0:
- os.execve(command[0], command, env)
-
- output = bytearray()
- status: int | None = None
- deadline = time.monotonic() + 30
- try:
- os.write(master_fd, answers.encode())
- while status is None:
- readable, _, _ = select.select([master_fd], [], [], 0.1)
- if readable:
- try:
- output.extend(os.read(master_fd, 65536))
- except OSError as error:
- if error.errno != errno.EIO:
- raise
-
- waited_pid, wait_status = os.waitpid(child_pid, wait_without_blocking)
- if waited_pid == child_pid:
- status = wait_status
- elif time.monotonic() >= deadline:
- os.kill(child_pid, 9)
- os.waitpid(child_pid, 0)
- raise AssertionError("Interactive installer did not finish")
-
- while True:
- readable, _, _ = select.select([master_fd], [], [], 0)
- if not readable:
- break
- try:
- output.extend(os.read(master_fd, 65536))
- except OSError as error:
- if error.errno == errno.EIO:
- break
- raise
- finally:
- os.close(master_fd)
-
- assert status is not None
- return subprocess.CompletedProcess(
- command,
- os.waitstatus_to_exitcode(status),
- output.decode(errors="replace"),
- "",
+ return subprocess.run(
+ [
+ sys.executable,
+ "-W",
+ "error",
+ str(Path(__file__).with_name("_pty_runner.py")),
+ *command,
+ ],
+ input=answers,
+ check=False,
+ capture_output=True,
+ text=True,
+ env=env,
+ timeout=30,
)
def calls(self) -> list[str]:
diff --git a/uv.lock b/uv.lock
index 50459d90..ce7dc8db 100644
--- a/uv.lock
+++ b/uv.lock
@@ -607,7 +607,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "5.3.1"
+version = "5.3.2"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },