gh-131254: ensure that BROWSER is not set for test_webbrowser on macOS (#131276)

This commit is contained in:
Bénédikt Tran 2025-03-16 15:39:30 +01:00 committed by GitHub
parent 3185e3115c
commit 9b6cef0f5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -321,7 +321,13 @@ def close(self):
@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")