(sb: Sandbox, expected: str)
| 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" |
no test coverage detected