mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-31014: Fix the webbrowser module. (GH-7267)
webbrowser._synthesize() called webbrowser.register() with outdated signature. Co-Authored-By: John Still <john@jmsdvl.com>
This commit is contained in:
parent
0830858aee
commit
25b804a9c2
3 changed files with 25 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
|||
import webbrowser
|
||||
import unittest
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
from unittest import mock
|
||||
from test import support
|
||||
|
@ -290,6 +292,23 @@ class ImportTest(unittest.TestCase):
|
|||
webbrowser.get('fakebrowser')
|
||||
self.assertIsNotNone(webbrowser._tryorder)
|
||||
|
||||
def test_synthesize(self):
|
||||
webbrowser = support.import_fresh_module('webbrowser')
|
||||
name = os.path.basename(sys.executable).lower()
|
||||
webbrowser.register(name, None, webbrowser.GenericBrowser(name))
|
||||
webbrowser.get(sys.executable)
|
||||
|
||||
def test_environment(self):
|
||||
webbrowser = support.import_fresh_module('webbrowser')
|
||||
try:
|
||||
browser = webbrowser.get().name
|
||||
except (webbrowser.Error, AttributeError) as err:
|
||||
self.skipTest(str(err))
|
||||
with support.EnvironmentVarGuard() as env:
|
||||
env["BROWSER"] = browser
|
||||
webbrowser = support.import_fresh_module('webbrowser')
|
||||
webbrowser.get()
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue