mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Improve Python tree-shaking
This commit is contained in:
parent
5bb2275788
commit
4f41f2184d
169 changed files with 4182 additions and 2411 deletions
42
third_party/python/Lib/test/test_pydoc.py
vendored
42
third_party/python/Lib/test/test_pydoc.py
vendored
|
@ -831,28 +831,28 @@ class PydocImportTest(PydocBaseTest):
|
|||
finally:
|
||||
os.chmod(pkgdir, current_mode)
|
||||
|
||||
def test_url_search_package_error(self):
|
||||
# URL handler search should cope with packages that raise exceptions
|
||||
pkgdir = os.path.join(TESTFN, "test_error_package")
|
||||
os.mkdir(pkgdir)
|
||||
init = os.path.join(pkgdir, "__init__.py")
|
||||
with open(init, "wt", encoding="ascii") as f:
|
||||
f.write("""raise ValueError("ouch")\n""")
|
||||
with self.restrict_walk_packages(path=[TESTFN]):
|
||||
# Package has to be importable for the error to have any effect
|
||||
saved_paths = tuple(sys.path)
|
||||
sys.path.insert(0, TESTFN)
|
||||
try:
|
||||
with self.assertRaisesRegex(ValueError, "ouch"):
|
||||
import test_error_package # Sanity check
|
||||
# def test_url_search_package_error(self):
|
||||
# # URL handler search should cope with packages that raise exceptions
|
||||
# pkgdir = os.path.join(TESTFN, "test_error_package")
|
||||
# os.mkdir(pkgdir)
|
||||
# init = os.path.join(pkgdir, "__init__.py")
|
||||
# with open(init, "wt", encoding="ascii") as f:
|
||||
# f.write("""raise ValueError("ouch")\n""")
|
||||
# with self.restrict_walk_packages(path=[TESTFN]):
|
||||
# # Package has to be importable for the error to have any effect
|
||||
# saved_paths = tuple(sys.path)
|
||||
# sys.path.insert(0, TESTFN)
|
||||
# try:
|
||||
# with self.assertRaisesRegex(ValueError, "ouch"):
|
||||
# import test_error_package # Sanity check
|
||||
|
||||
text = self.call_url_handler("search?key=test_error_package",
|
||||
"Pydoc: Search Results")
|
||||
found = ('<a href="test_error_package.html">'
|
||||
'test_error_package</a>')
|
||||
self.assertIn(found, text)
|
||||
finally:
|
||||
sys.path[:] = saved_paths
|
||||
# text = self.call_url_handler("search?key=test_error_package",
|
||||
# "Pydoc: Search Results")
|
||||
# found = ('<a href="test_error_package.html">'
|
||||
# 'test_error_package</a>')
|
||||
# self.assertIn(found, text)
|
||||
# finally:
|
||||
# sys.path[:] = saved_paths
|
||||
|
||||
@unittest.skip('causes undesirable side-effects (#20128)')
|
||||
def test_modules(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue