evo-cli 0.37.2__tar.gz → 0.37.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. {evo_cli-0.37.2 → evo_cli-0.37.4}/PKG-INFO +1 -1
  2. evo_cli-0.37.4/evo_cli/VERSION +1 -0
  3. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_spoofdpi.py +36 -4
  4. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli.egg-info/PKG-INFO +1 -1
  5. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_route.py +51 -0
  6. evo_cli-0.37.2/evo_cli/VERSION +0 -1
  7. {evo_cli-0.37.2 → evo_cli-0.37.4}/Containerfile +0 -0
  8. {evo_cli-0.37.2 → evo_cli-0.37.4}/HISTORY.md +0 -0
  9. {evo_cli-0.37.2 → evo_cli-0.37.4}/LICENSE +0 -0
  10. {evo_cli-0.37.2 → evo_cli-0.37.4}/MANIFEST.in +0 -0
  11. {evo_cli-0.37.2 → evo_cli-0.37.4}/README.md +0 -0
  12. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/__init__.py +0 -0
  13. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/__main__.py +0 -0
  14. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/base.py +0 -0
  15. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/cli.py +0 -0
  16. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/__init__.py +0 -0
  17. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/agent_toy.py +0 -0
  18. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/claude_code.py +0 -0
  19. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/cloudflare.py +0 -0
  20. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/cred.py +0 -0
  21. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/download.py +0 -0
  22. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/fix_claude.py +0 -0
  23. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/gdrive.py +0 -0
  24. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/gh.py +0 -0
  25. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/__init__.py +0 -0
  26. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_dag.py +0 -0
  27. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_git.py +0 -0
  28. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_hub.py +0 -0
  29. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_mirror.py +0 -0
  30. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_model.py +0 -0
  31. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_mutate.py +0 -0
  32. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_paths.py +0 -0
  33. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_render.py +0 -0
  34. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/_server.py +0 -0
  35. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/check.py +0 -0
  36. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/clone.py +0 -0
  37. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/edit.py +0 -0
  38. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/pull.py +0 -0
  39. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/serve.py +0 -0
  40. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/show.py +0 -0
  41. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/views.py +0 -0
  42. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/index-Cs7hXRPJ.css +0 -0
  43. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/index-CuNOlaH7.js +0 -0
  44. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  45. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  46. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  47. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  48. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  49. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  50. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  51. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  52. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  53. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  54. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  55. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  56. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/harness/web/index.html +0 -0
  57. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/hwid.py +0 -0
  58. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/hwid_reset.py +0 -0
  59. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/image.py +0 -0
  60. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/localproxy.py +0 -0
  61. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/mcp.py +0 -0
  62. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/miniconda.py +0 -0
  63. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/netcheck.py +0 -0
  64. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/ngrok.py +0 -0
  65. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/opencode.py +0 -0
  66. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/openvpn.py +0 -0
  67. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/plantuml.py +0 -0
  68. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/__init__.py +0 -0
  69. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_dns.py +0 -0
  70. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_dnswatch.py +0 -0
  71. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_dpi.py +0 -0
  72. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_hosts.py +0 -0
  73. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_page.py +0 -0
  74. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/_probe.py +0 -0
  75. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/check.py +0 -0
  76. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/fix.py +0 -0
  77. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/probe.py +0 -0
  78. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/route/status.py +0 -0
  79. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/serp.py +0 -0
  80. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/site2s.py +0 -0
  81. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/ssh.py +0 -0
  82. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/storage.py +0 -0
  83. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/sysmon.py +0 -0
  84. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/tts.py +0 -0
  85. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/update.py +0 -0
  86. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/commands/wifi.py +0 -0
  87. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/console.py +0 -0
  88. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/__init__.py +0 -0
  89. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/doctor.py +0 -0
  90. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/google_oauth.py +0 -0
  91. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/migrate.py +0 -0
  92. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/oauth_flow.py +0 -0
  93. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/registry.py +0 -0
  94. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/store.py +0 -0
  95. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/credentials/sync.py +0 -0
  96. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/__init__.py +0 -0
  97. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/align.py +0 -0
  98. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/core.py +0 -0
  99. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/creds.py +0 -0
  100. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/errors.py +0 -0
  101. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/gemini.py +0 -0
  102. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/imaging/ncnn.py +0 -0
  103. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/mcp_registry.py +0 -0
  104. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/openvpn.py +0 -0
  105. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/serp/__init__.py +0 -0
  106. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/serp/client.py +0 -0
  107. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/serp/creds.py +0 -0
  108. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/serp/errors.py +0 -0
  109. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/serp/install.py +0 -0
  110. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/serp/render.py +0 -0
  111. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/__init__.py +0 -0
  112. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/chunking.py +0 -0
  113. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/core.py +0 -0
  114. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/creds.py +0 -0
  115. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/errors.py +0 -0
  116. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/gemini.py +0 -0
  117. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/http.py +0 -0
  118. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/openai.py +0 -0
  119. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/player.py +0 -0
  120. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli/tts/vbee.py +0 -0
  121. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli.egg-info/SOURCES.txt +0 -0
  122. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli.egg-info/dependency_links.txt +0 -0
  123. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli.egg-info/entry_points.txt +0 -0
  124. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli.egg-info/requires.txt +0 -0
  125. {evo_cli-0.37.2 → evo_cli-0.37.4}/evo_cli.egg-info/top_level.txt +0 -0
  126. {evo_cli-0.37.2 → evo_cli-0.37.4}/pyproject.toml +0 -0
  127. {evo_cli-0.37.2 → evo_cli-0.37.4}/setup.cfg +0 -0
  128. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/__init__.py +0 -0
  129. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/fake_evo_agents.py +0 -0
  130. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/fixtures/hub/contract-0.2.0.json +0 -0
  131. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/fixtures/hub/mirror-demo.yaml +0 -0
  132. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_agent_toy.py +0 -0
  133. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_claude_code.py +0 -0
  134. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_cli.py +0 -0
  135. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_console.py +0 -0
  136. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_cred.py +0 -0
  137. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_download.py +0 -0
  138. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_fix_claude.py +0 -0
  139. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_gdrive.py +0 -0
  140. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_gh.py +0 -0
  141. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_harness.py +0 -0
  142. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_harness_clone.py +0 -0
  143. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_harness_dag.py +0 -0
  144. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_harness_hub.py +0 -0
  145. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_harness_show.py +0 -0
  146. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_image.py +0 -0
  147. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_mcp.py +0 -0
  148. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_ngrok.py +0 -0
  149. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_opencode.py +0 -0
  150. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_openvpn.py +0 -0
  151. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_plantuml.py +0 -0
  152. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_serp.py +0 -0
  153. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_storage.py +0 -0
  154. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_sysmon.py +0 -0
  155. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_tts.py +0 -0
  156. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_update.py +0 -0
  157. {evo_cli-0.37.2 → evo_cli-0.37.4}/tests/test_wifi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evo_cli
3
- Version: 0.37.2
3
+ Version: 0.37.4
4
4
  Summary: Evolution CLI - a developer toolbox for setting up dev machines
5
5
  Author: maycuatroi
6
6
  Project-URL: Homepage, https://github.com/maycuatroi/evo-cli
@@ -0,0 +1 @@
1
+ 0.37.4
@@ -57,6 +57,8 @@ RESOLVERS = {"https": f"DoH ({DOH_URL})", "system": "the system resolver"}
57
57
  DNS_SETTINGS = "/var/run/resolv.conf"
58
58
  # Catches a network that was not answering yet when its settings arrived.
59
59
  DNS_RECHECK_SECONDS = 120
60
+ # How long launchd gets to drop a booted-out job before evo stops retrying its bootstrap.
61
+ BOOTSTRAP_SECONDS = 10
60
62
 
61
63
 
62
64
  def config(dns_mode):
@@ -214,8 +216,22 @@ def _wait(condition, seconds):
214
216
  return condition()
215
217
 
216
218
 
217
- def _start(reload):
218
- """Start or restart the agent and wait for the proxy port. SpoofDPI reads hosts.txt only when it starts."""
219
+ def _bootstrap(label=LABEL):
220
+ """Load an agent.
221
+
222
+ launchctl bootout returns before launchd has let go of the job, and a bootstrap in that window fails
223
+ with "5: Input/output error". So wait for the old job to go, then retry until the new one loads.
224
+ """
225
+ _wait(lambda: not _loaded(label), BOOTSTRAP_SECONDS)
226
+ deadline = time.monotonic() + BOOTSTRAP_SECONDS
227
+ while True:
228
+ result = _launchctl("bootstrap", _domain(), str(agent_path(label)))
229
+ if result.returncode == 0 or time.monotonic() >= deadline:
230
+ return result
231
+ time.sleep(0.5)
232
+
233
+
234
+ def _launch(reload):
219
235
  if _loaded() and not reload:
220
236
  _launchctl("kickstart", "-k", f"{_domain()}/{LABEL}")
221
237
  else:
@@ -224,12 +240,28 @@ def _start(reload):
224
240
  _wait(lambda: not _listening(), 5)
225
241
  if _listening():
226
242
  raise RuntimeError(f"Something else already listens on {listen()}.")
227
- result = _launchctl("bootstrap", _domain(), str(agent_path()))
243
+ result = _bootstrap()
228
244
  if result.returncode != 0:
229
245
  raise RuntimeError(f"launchctl bootstrap failed: {(result.stderr or result.stdout).strip()}")
230
246
  return _wait(_listening, 10)
231
247
 
232
248
 
249
+ def _start(reload):
250
+ """Start or restart the agent and wait for the proxy port. SpoofDPI reads hosts.txt only when it starts.
251
+
252
+ A restart stops the proxy the system already points at. If the port does not come back, the system
253
+ proxy is cleared: left pointing at nothing, it takes every site down, not only the opened ones.
254
+ """
255
+ try:
256
+ up = _launch(reload)
257
+ except RuntimeError:
258
+ clear_system_proxy()
259
+ raise
260
+ if not up:
261
+ clear_system_proxy()
262
+ return up
263
+
264
+
233
265
  def _networksetup(*args):
234
266
  return subprocess.run(
235
267
  ["networksetup", *args], capture_output=True, text=True, stdin=subprocess.DEVNULL, check=False
@@ -417,7 +449,7 @@ def _watch_network():
417
449
  """(Re)load the DNS agent; launchd runs it once on load, then on every change of network."""
418
450
  if _write_dns_agent() or not _loaded(DNS_LABEL):
419
451
  _launchctl("bootout", f"{_domain()}/{DNS_LABEL}")
420
- _launchctl("bootstrap", _domain(), str(agent_path(DNS_LABEL)))
452
+ _bootstrap(DNS_LABEL)
421
453
 
422
454
 
423
455
  def service_state():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evo_cli
3
- Version: 0.37.2
3
+ Version: 0.37.4
4
4
  Summary: Evolution CLI - a developer toolbox for setting up dev machines
5
5
  Author: maycuatroi
6
6
  Project-URL: Homepage, https://github.com/maycuatroi/evo-cli
@@ -455,6 +455,57 @@ def test_forgetting_the_last_host_removes_the_bypass(tmp_path, monkeypatch):
455
455
  assert removed == [True]
456
456
 
457
457
 
458
+ def _fake_launchctl(calls, bootstrap_codes):
459
+ """launchctl whose bootstraps answer with ``bootstrap_codes`` in turn; every other verb succeeds."""
460
+ codes = iter(bootstrap_codes)
461
+
462
+ def run(*args):
463
+ calls.append(args[0])
464
+ code = next(codes) if args[0] == "bootstrap" else 0
465
+ stderr = "Bootstrap failed: 5: Input/output error" if code else ""
466
+ return subprocess.CompletedProcess(["launchctl", *args], code, "", stderr)
467
+
468
+ return run
469
+
470
+
471
+ def test_bootstrap_retries_while_launchd_still_holds_the_booted_out_job(tmp_path, monkeypatch):
472
+ monkeypatch.setattr(_spoofdpi.Path, "home", lambda: tmp_path)
473
+ monkeypatch.setattr(_spoofdpi.time, "sleep", lambda seconds: None)
474
+ loaded = iter([True, False])
475
+ monkeypatch.setattr(_spoofdpi, "_loaded", lambda label=_spoofdpi.LABEL: next(loaded))
476
+ calls = []
477
+ monkeypatch.setattr(_spoofdpi, "_launchctl", _fake_launchctl(calls, [5, 5, 0]))
478
+ assert _spoofdpi._bootstrap().returncode == 0
479
+ assert calls == ["bootstrap"] * 3
480
+
481
+
482
+ def test_a_failed_restart_clears_the_system_proxy(tmp_path, monkeypatch):
483
+ monkeypatch.setattr(_spoofdpi.Path, "home", lambda: tmp_path)
484
+ monkeypatch.setattr(_spoofdpi, "BOOTSTRAP_SECONDS", 0)
485
+ monkeypatch.setattr(_spoofdpi, "_loaded", lambda label=_spoofdpi.LABEL: False)
486
+ monkeypatch.setattr(_spoofdpi, "_listening", lambda timeout=0.5: False)
487
+ monkeypatch.setattr(_spoofdpi, "_launchctl", _fake_launchctl([], [5]))
488
+ cleared = []
489
+ monkeypatch.setattr(_spoofdpi, "clear_system_proxy", lambda: cleared.append(True))
490
+ with pytest.raises(RuntimeError, match="Input/output error"):
491
+ _spoofdpi._start(reload=True)
492
+ assert cleared == [True]
493
+
494
+
495
+ def test_a_proxy_port_that_never_comes_back_clears_the_system_proxy(monkeypatch):
496
+ monkeypatch.setattr(_spoofdpi, "_launch", lambda reload: False)
497
+ cleared = []
498
+ monkeypatch.setattr(_spoofdpi, "clear_system_proxy", lambda: cleared.append(True))
499
+ assert _spoofdpi._start(reload=False) is False
500
+ assert cleared == [True]
501
+
502
+
503
+ def test_a_working_restart_keeps_the_system_proxy(monkeypatch):
504
+ monkeypatch.setattr(_spoofdpi, "_launch", lambda reload: True)
505
+ monkeypatch.setattr(_spoofdpi, "clear_system_proxy", lambda: pytest.fail("cleared a working proxy"))
506
+ assert _spoofdpi._start(reload=False) is True
507
+
508
+
458
509
  def test_forgetting_one_host_restarts_with_the_rest(tmp_path, monkeypatch):
459
510
  monkeypatch.setenv("EVO_ROUTE_HOME", str(tmp_path))
460
511
  _spoofdpi._write_hosts(["medium.com", "x.com"])
@@ -1 +0,0 @@
1
- 0.37.2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes