]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131254: ensure that `BROWSER` is not set for `test_webbrowser` on macOS (#131276)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sun, 16 Mar 2025 14:39:30 +0000 (15:39 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Mar 2025 14:39:30 +0000 (15:39 +0100)
Lib/test/test_webbrowser.py

index 870ddd7349f494e83e8e48e11992ccbac3c51883..4c3ea1cd8df13ec6de33ac62782889739f44b638 100644 (file)
@@ -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")