MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / fixture_environment

Function fixture_environment

tests/test_daemon_open_readiness.py:138–161  ·  view source on GitHub ↗
(work, cache, marker, timeout_ms)

Source from the content-addressed store, hash-verified

136
137
138def 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
164def launch_start(binary, work, cache, marker, port, timeout_ms):

Callers 2

launch_startFunction · 0.85

Calls 4

strFunction · 0.85
getMethod · 0.65
openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected