From: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Date: Sun, 16 Mar 2025 14:39:30 +0000 (+0100) Subject: gh-131254: ensure that `BROWSER` is not set for `test_webbrowser` on macOS (#131276) X-Git-Tag: v3.14.0a7~366 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b6cef0f5dcb309096a68fdd04158e0e1313e8ec;p=thirdparty%2FPython%2Fcpython.git gh-131254: ensure that `BROWSER` is not set for `test_webbrowser` on macOS (#131276) --- diff --git a/Lib/test/test_webbrowser.py b/Lib/test/test_webbrowser.py index 870ddd7349f4..4c3ea1cd8df1 100644 --- a/Lib/test/test_webbrowser.py +++ b/Lib/test/test_webbrowser.py @@ -321,7 +321,13 @@ class MockPopenPipe: @unittest.skipUnless(sys.platform == "darwin", "macOS specific test") @requires_subprocess() class MacOSXOSAScriptTest(unittest.TestCase): + def setUp(self): + # Ensure that 'BROWSER' is not set to 'open' or something else. + # See: https://github.com/python/cpython/issues/131254. + env = self.enterContext(os_helper.EnvironmentVarGuard()) + env.unset("BROWSER") + support.patch(self, os, "popen", self.mock_popen) self.browser = webbrowser.MacOSXOSAScript("default")