Skip to content

Commit 75cfc91

Browse files
authored
On macOS hosts, autodetect the system Safari browser (#26897)
On macOS hosts, autodetect the system Safari browser, if no other test browser is present. This is symmetric to looking up Firefox/Chrome in PATH on other OSes. Fixes `emrun.test_no_browser` test on macOS when no EMTEST_BROWSER is set.
1 parent eda04fc commit 75cfc91

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

test/browser_common.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,11 @@ def configure_test_browser():
339339
if not shutil.which(EMTEST_BROWSER):
340340
EMTEST_BROWSER = 'firefox'
341341
if not shutil.which(EMTEST_BROWSER):
342-
# FIXME: This should really be and error, but this code currently also runs for non-browser tests.
343-
EMTEST_BROWSER = 'default-browser-not-found'
342+
if MACOS and os.path.isdir('/Applications/Safari.app'):
343+
EMTEST_BROWSER = '/Applications/Safari.app'
344+
else:
345+
# FIXME: This should really be and error, but this code currently also runs for non-browser tests.
346+
EMTEST_BROWSER = 'default-browser-not-found'
344347

345348
if WINDOWS and '"' not in EMTEST_BROWSER and "'" not in EMTEST_BROWSER:
346349
# On Windows env. vars canonically use backslashes as directory delimiters, e.g.

0 commit comments

Comments
 (0)