portacode 2.2.20.dev2__py3-none-any.whl → 2.2.20.dev3__py3-none-any.whl
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.
- portacode/_version.py +2 -2
- portacode/browser_cli.py +10 -0
- portacode/tests/test_browser_cli.py +20 -0
- {portacode-2.2.20.dev2.dist-info → portacode-2.2.20.dev3.dist-info}/METADATA +1 -1
- {portacode-2.2.20.dev2.dist-info → portacode-2.2.20.dev3.dist-info}/RECORD +9 -9
- {portacode-2.2.20.dev2.dist-info → portacode-2.2.20.dev3.dist-info}/WHEEL +0 -0
- {portacode-2.2.20.dev2.dist-info → portacode-2.2.20.dev3.dist-info}/entry_points.txt +0 -0
- {portacode-2.2.20.dev2.dist-info → portacode-2.2.20.dev3.dist-info}/licenses/LICENSE +0 -0
- {portacode-2.2.20.dev2.dist-info → portacode-2.2.20.dev3.dist-info}/top_level.txt +0 -0
portacode/_version.py
CHANGED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.2.20.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 2, 20, '
|
|
21
|
+
__version__ = version = '2.2.20.dev3'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 2, 20, 'dev3')
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
portacode/browser_cli.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
|
+
import os
|
|
5
6
|
import re
|
|
6
7
|
import time
|
|
7
8
|
from pathlib import Path
|
|
@@ -9,8 +10,17 @@ from pathlib import Path
|
|
|
9
10
|
import click
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
_MANAGED_BROWSERS_PATH = Path("/opt/ms-playwright")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _configure_managed_browser_path() -> None:
|
|
17
|
+
if _MANAGED_BROWSERS_PATH.is_dir():
|
|
18
|
+
os.environ.setdefault("PLAYWRIGHT_BROWSERS_PATH", str(_MANAGED_BROWSERS_PATH))
|
|
19
|
+
|
|
20
|
+
|
|
12
21
|
def run_browser_script(*, url: str, script: str, output_dir: Path, record_video: bool,
|
|
13
22
|
width: int, height: int, timeout_ms: int) -> dict:
|
|
23
|
+
_configure_managed_browser_path()
|
|
14
24
|
from playwright.sync_api import sync_playwright
|
|
15
25
|
|
|
16
26
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from unittest.mock import patch
|
|
4
5
|
|
|
5
6
|
from click.testing import CliRunner
|
|
6
7
|
|
|
7
8
|
from portacode.cli import cli
|
|
9
|
+
from portacode import browser_cli
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
def test_browser_run_accepts_inline_python_and_returns_json(tmp_path):
|
|
@@ -29,3 +31,21 @@ def test_browser_run_propagates_failure_exit_code(tmp_path):
|
|
|
29
31
|
with patch("portacode.browser_cli.run_browser_script", return_value={"ok": False, "error": "boom"}):
|
|
30
32
|
result = CliRunner().invoke(cli, ["browser", "run", "--script", "raise Exception()"])
|
|
31
33
|
assert result.exit_code == 1
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_managed_browser_cache_is_used_when_available(monkeypatch):
|
|
37
|
+
monkeypatch.delenv("PLAYWRIGHT_BROWSERS_PATH", raising=False)
|
|
38
|
+
monkeypatch.setattr(Path, "is_dir", lambda self: True)
|
|
39
|
+
|
|
40
|
+
browser_cli._configure_managed_browser_path()
|
|
41
|
+
|
|
42
|
+
assert os.environ["PLAYWRIGHT_BROWSERS_PATH"] == "/opt/ms-playwright"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_explicit_browser_cache_is_preserved(monkeypatch):
|
|
46
|
+
monkeypatch.setenv("PLAYWRIGHT_BROWSERS_PATH", "/custom/browsers")
|
|
47
|
+
monkeypatch.setattr(Path, "is_dir", lambda self: True)
|
|
48
|
+
|
|
49
|
+
browser_cli._configure_managed_browser_path()
|
|
50
|
+
|
|
51
|
+
assert os.environ["PLAYWRIGHT_BROWSERS_PATH"] == "/custom/browsers"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
portacode/README.md,sha256=R76fnJCKOnLiBEirTtc7fj4A6j5vAN1pdYMGNGqu1cs,1215
|
|
2
2
|
portacode/__init__.py,sha256=Hwk8wm5KA79qi06r0qKJKT2kjUlHrWaDtH4CyhnWFw8,1086
|
|
3
3
|
portacode/__main__.py,sha256=jmHTGC1hzmo9iKJLv-SSYe9BSIbPPZ2IOpecI03PlTs,296
|
|
4
|
-
portacode/_version.py,sha256=
|
|
5
|
-
portacode/browser_cli.py,sha256=
|
|
4
|
+
portacode/_version.py,sha256=xR-mQLYC-0jlUaXaWS3oI_Upv2CL_dNrFL_lo8-Yxks,535
|
|
5
|
+
portacode/browser_cli.py,sha256=Bwo3H63IywdBB4XLpWccQfE4LN5nu6zL0sz3LACK5PA,4942
|
|
6
6
|
portacode/cli.py,sha256=k6wApK6PclUhyAmfOR91lHVA7zbA4IbcAsr0LSumYxk,40645
|
|
7
7
|
portacode/codex_loopback_proxy.py,sha256=RJ4oATShAf-m0RYlugIe6b6MzYrpb6aQ8f-xrx2AilI,24788
|
|
8
8
|
portacode/codex_prepare.py,sha256=VxIklS9cb9GF6fcFt7H_NN0AVXcnEzsGJmsaPliNXco,27595
|
|
@@ -104,7 +104,7 @@ portacode/link_capture/bin/__pycache__/link_capture_wrapper.cpython-38.pyc,sha25
|
|
|
104
104
|
portacode/static/js/test-ntp-clock.html,sha256=bUow9sifIuLNPqKvuPbpQozmEE6RhdCI4Plib3CqUmw,2130
|
|
105
105
|
portacode/static/js/utils/ntp-clock.js,sha256=t9moJyAGGU054BVtuGuSETVstlj1AoxVy44i4y9QWSs,6940
|
|
106
106
|
portacode/tests/test_automation_v2_inputs.py,sha256=iySvkskbqxFm7hSz19zNDwu8wGHvJkvHE-IQ3PKc42Q,2103
|
|
107
|
-
portacode/tests/test_browser_cli.py,sha256=
|
|
107
|
+
portacode/tests/test_browser_cli.py,sha256=M0L4v1oRe3cD40boZqGx_gTvytAPk9nLZlCy8e4fLbo,1902
|
|
108
108
|
portacode/tests/test_cli_service_logs.py,sha256=Fog68tVDMEe8zOcpfA1ukPRodhgjOwbTQ6Rm4leH6dQ,1733
|
|
109
109
|
portacode/tests/test_codex_app_server.py,sha256=xUiCno_Gx3Z5KrrhoxN38c5nGJBDgJ9bT7TDvFGZDMs,13993
|
|
110
110
|
portacode/tests/test_codex_handlers.py,sha256=vmwpifku1Dk7TI89H2z8nZQHueHa669NXxUbVghsreA,32083
|
|
@@ -132,7 +132,7 @@ portacode/utils/diff_apply.py,sha256=ArkT-vEQ7iyA1Nfqufq1AiNtRLhoCMnC75FCRh2kNgI
|
|
|
132
132
|
portacode/utils/diff_renderer.py,sha256=S76StnQ2DLfsz4Gg0m07UwPfRp8270PuzbNaQq-rmYk,13850
|
|
133
133
|
portacode/utils/ntp_clock.py,sha256=VqCnWCTehCufE43W23oB-WUdAZGeCcLxkmIOPwInYHc,2499
|
|
134
134
|
portacode/utils/runtime_paths.py,sha256=G9ROho5f5gnDhoQ7vpEAX2XifBzoJTvqTylkF2Hkx8E,1660
|
|
135
|
-
portacode-2.2.20.
|
|
135
|
+
portacode-2.2.20.dev3.dist-info/licenses/LICENSE,sha256=iiV44E3po4OL77NL8diCk3WtYvCNGu6gUci2TYxVUgQ,5520
|
|
136
136
|
test_modules/README.md,sha256=Do_agkm9WhSzueXjRAkV_xEj6Emy5zB3N3VKY5Roce8,9274
|
|
137
137
|
test_modules/__init__.py,sha256=1LcbHodIHsB0g-g4NGjSn6AMuCoGbymvXPYLOb6Z7F0,53
|
|
138
138
|
test_modules/test_device_online.py,sha256=QtYq0Dq9vME8Gp2O4fGSheqVf8LUtpsSKosXXk56gGM,1654
|
|
@@ -158,8 +158,8 @@ testing_framework/core/playwright_manager.py,sha256=asMe7zQg8Kp3a71F7pv92OiFt63B
|
|
|
158
158
|
testing_framework/core/runner.py,sha256=t3fq0mGCVUCE_TbieEPwmLKjxe44ez29SzW8G33ACME,19746
|
|
159
159
|
testing_framework/core/shared_cli_manager.py,sha256=BESSNtyQb7BOlaOvZmm04T8Uezjms4KCBs2MzTxvzYQ,8790
|
|
160
160
|
testing_framework/core/test_discovery.py,sha256=2FZ9fJ8Dp5dloA-fkgXoJ_gCMC_nYPBnA3Hs2xlagzM,4928
|
|
161
|
-
portacode-2.2.20.
|
|
162
|
-
portacode-2.2.20.
|
|
163
|
-
portacode-2.2.20.
|
|
164
|
-
portacode-2.2.20.
|
|
165
|
-
portacode-2.2.20.
|
|
161
|
+
portacode-2.2.20.dev3.dist-info/METADATA,sha256=-VCXtNW2BFfy7kwjrkJA-sFzfPVOtJdqsWUfG9I4F1A,12851
|
|
162
|
+
portacode-2.2.20.dev3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
163
|
+
portacode-2.2.20.dev3.dist-info/entry_points.txt,sha256=0cV_SuIztVnLWACUY5KMR8K8pWdAsLiaFbLXE5He0rk,151
|
|
164
|
+
portacode-2.2.20.dev3.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
|
|
165
|
+
portacode-2.2.20.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|