| 15 | env = dict(os.environ, ATOMIC_NO_DAEMON="1") |
| 16 | |
| 17 | def run(*args, json_output=False): |
| 18 | result = subprocess.run( |
| 19 | [binary, *args], cwd=root, env=env, text=True, capture_output=True |
| 20 | ) |
| 21 | if result.returncode and not (json_output and result.stdout.lstrip().startswith("{")): |
| 22 | raise AssertionError(f"{args}: {result.returncode}\n{result.stdout}\n{result.stderr}") |
| 23 | return json.loads(result.stdout) if json_output else result.stdout |
| 24 | |
| 25 | run("init", "--view", "main") |
| 26 | run("view", "create", "feature", "--draft", "--parent", "main") |