mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-87277: Don't look for X11 browsers on macOS in webbrowser (#24480)
The installation of XQuartz on macOS will unconditionally set the $DISPLAY variable. The X11 server will be launched when a program tries to access the display. This results in launching the X11 server when using the webbrowser module, even though X11 browsers won't be used in practice.
This commit is contained in:
parent
723f4d6698
commit
ca8b1d0958
3 changed files with 20 additions and 1 deletions
|
@ -272,6 +272,17 @@ class BrowserRegistrationTest(unittest.TestCase):
|
|||
self._check_registration(preferred=True)
|
||||
|
||||
|
||||
@unittest.skipUnless(sys.platform == "darwin", "macOS specific test")
|
||||
def test_no_xdg_settings_on_macOS(self):
|
||||
# On macOS webbrowser should not use xdg-settings to
|
||||
# look for X11 based browsers (for those users with
|
||||
# XQuartz installed)
|
||||
with mock.patch("subprocess.check_output") as ck_o:
|
||||
webbrowser.register_standard_browsers()
|
||||
|
||||
ck_o.assert_not_called()
|
||||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
def test_register(self):
|
||||
webbrowser = import_helper.import_fresh_module('webbrowser')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue