Skip to content

Commit e55bfd7

Browse files
authored
Allow non-AMD64 devcontainer, such as ARM (reverts zauberzeug#3328) (zauberzeug#5206)
### Motivation I just checked and we can install `chromium` and `chromium-driver` on ARM64, covering a major use case of developing on Apple Silicon Macs <img width="599" height="99" alt="image" src="https://github.com/user-attachments/assets/b6fb8be5-5778-4225-a143-a6fe9fbc7350" /> I can't trace back which release it was supported, though. So we can revert zauberzeug#3328 and improve devcontainer performance. For those who need AMD64 they can specify it themselves? ### Implementation Revert zauberzeug#3328, drop `--platform=linux/amd64` ### Progress - [x] I chose a meaningful title that completes the sentence: "If applied, this PR will..." - [x] The implementation is complete. - [x] Pytests are not necessary. - [x] Documentation is not necessary.
1 parent 82fa930 commit e55bfd7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 python:3.9
1+
FROM python:3.9
22

33
ENV POETRY_VERSION=2.1.2 \
44
POETRY_NO_INTERACTION=1 \

nicegui/testing/screen_plugin.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,15 @@ def nicegui_remove_all_screenshots() -> None:
6464
@pytest.fixture()
6565
def nicegui_driver(nicegui_chrome_options: webdriver.ChromeOptions) -> Generator[webdriver.Chrome, None, None]:
6666
"""Create a new Chrome driver instance."""
67-
s = Service()
68-
driver_ = webdriver.Chrome(service=s, options=nicegui_chrome_options)
67+
for executable_path in (None, shutil.which('chromedriver'), 'chromedriver'): # Required for ARM devcontainers
68+
try:
69+
s = Service(executable_path=executable_path)
70+
driver_ = webdriver.Chrome(service=s, options=nicegui_chrome_options)
71+
break
72+
except Exception:
73+
continue
74+
else: # no break
75+
raise RuntimeError('Could not start Chrome WebDriver.')
6976
driver_.implicitly_wait(Screen.IMPLICIT_WAIT)
7077
driver_.set_page_load_timeout(4)
7178
yield driver_

0 commit comments

Comments
 (0)