(work, cache, marker, timeout_ms)
| 136 | |
| 137 | |
| 138 | def fixture_environment(work, cache, marker, timeout_ms): |
| 139 | env = dict(os.environ) |
| 140 | env["CBM_CACHE_DIR"] = cache |
| 141 | env[OPEN_MARKER_ENV] = marker |
| 142 | env[READY_TIMEOUT_ENV] = str(timeout_ms) |
| 143 | runtime_parent = os.path.join(work, "runtime-" + os.path.basename(cache)) |
| 144 | os.makedirs(runtime_parent, mode=0o700, exist_ok=True) |
| 145 | env[RUNTIME_PARENT_ENV] = runtime_parent |
| 146 | env["CBM_TEST_FAKE_BROWSER_MARKER"] = marker |
| 147 | |
| 148 | # Before the production fix exists, POSIX builds do not know the marker |
| 149 | # seam. A PATH-local opener lets the very same behavior test demonstrate |
| 150 | # the original premature-open RED instead of failing during setup. |
| 151 | if os.name != "nt": |
| 152 | fake_bin = os.path.join(work, "fake-bin") |
| 153 | os.makedirs(fake_bin, exist_ok=True) |
| 154 | opener = "open" if sys.platform == "darwin" else "xdg-open" |
| 155 | opener_path = os.path.join(fake_bin, opener) |
| 156 | if not os.path.exists(opener_path): |
| 157 | with open(opener_path, "w", encoding="utf-8", newline="\n") as handle: |
| 158 | handle.write("#!/bin/sh\nprintf '%s' \"$1\" > \"$CBM_TEST_FAKE_BROWSER_MARKER\"\n") |
| 159 | os.chmod(opener_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) |
| 160 | env["PATH"] = fake_bin + os.pathsep + env.get("PATH", "") |
| 161 | return env |
| 162 | |
| 163 | |
| 164 | def launch_start(binary, work, cache, marker, port, timeout_ms): |
no test coverage detected