summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_webbrowser.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-07-08 07:22:32 (GMT)
committerGitHub <noreply@github.com>2018-07-08 07:22:32 (GMT)
commit25b804a9c21c735ce322877f105ebab2539ccfc1 (patch)
tree864aaead0e0372f44e477c30cba826e9e2ca497f /Lib/test/test_webbrowser.py
parent0830858aeedecc9ece60349f8c31c2690d1a99f8 (diff)
downloadcpython-25b804a9c21c735ce322877f105ebab2539ccfc1.zip
cpython-25b804a9c21c735ce322877f105ebab2539ccfc1.tar.gz
cpython-25b804a9c21c735ce322877f105ebab2539ccfc1.tar.bz2
bpo-31014: Fix the webbrowser module. (GH-7267)
webbrowser._synthesize() called webbrowser.register() with outdated signature. Co-Authored-By: John Still <john@jmsdvl.com>
Diffstat (limited to 'Lib/test/test_webbrowser.py')
-rw-r--r--Lib/test/test_webbrowser.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_webbrowser.py b/Lib/test/test_webbrowser.py
index 7a396bd..71f2e27 100644
--- a/Lib/test/test_webbrowser.py
+++ b/Lib/test/test_webbrowser.py
@@ -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()