MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / wait_for_token

Function wait_for_token

e2e/python/test_sandbox_providers.py:225–237  ·  view source on GitHub ↗
(sb: Sandbox, expected: str)

Source from the content-addressed store, hash-verified

223 return result.stdout.strip()
224
225 def wait_for_token(sb: Sandbox, expected: str) -> None:
226 deadline = time.monotonic() + 35
227 last = None
228 while time.monotonic() < deadline:
229 last = exec_token(sb)
230 if expected == "NOT_SET":
231 matched = last == expected
232 else:
233 matched = _is_placeholder_for_env_key(last, "CUSTOM_ATTACH_TOKEN")
234 if matched:
235 return
236 time.sleep(2)
237 pytest.fail(f"expected {expected!r}, last exec saw {last!r}")
238
239 with sandbox(spec=spec, delete_on_exit=True) as sb:
240 assert exec_token(sb) == "NOT_SET"

Calls 3

exec_tokenFunction · 0.85
failMethod · 0.80

Tested by

no test coverage detected