From: Russell Keith-Magee Date: Mon, 22 Sep 2025 14:26:13 +0000 (+0100) Subject: gh-136744: Remove unnecessary chmod from pydoc.apropos() test. (GH-136746) X-Git-Tag: v3.15.0a1~235 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04c4628345b841ae9792ea007d7beffd2846f017;p=thirdparty%2FPython%2Fcpython.git gh-136744: Remove unnecessary chmod from pydoc.apropos() test. (GH-136746) Remove unnecessary chmod from pydoc.apropos() test. --- diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index 40cdee5c6c3d..31f0a1eb2cbf 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -11,7 +11,6 @@ import keyword import _pickle import pkgutil import re -import stat import tempfile import test.support import time @@ -1303,24 +1302,14 @@ class PydocImportTest(PydocBaseTest): @os_helper.skip_unless_working_chmod def test_apropos_empty_doc(self): pkgdir = os.path.join(TESTFN, 'walkpkg') - if support.is_emscripten: - # Emscripten's readdir implementation is buggy on directories - # with read permission but no execute permission. - old_umask = os.umask(0) - self.addCleanup(os.umask, old_umask) os.mkdir(pkgdir) self.addCleanup(rmtree, pkgdir) init_path = os.path.join(pkgdir, '__init__.py') with open(init_path, 'w') as fobj: fobj.write("foo = 1") - current_mode = stat.S_IMODE(os.stat(pkgdir).st_mode) - try: - os.chmod(pkgdir, current_mode & ~stat.S_IEXEC) - with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout: - pydoc.apropos('') - self.assertIn('walkpkg', stdout.getvalue()) - finally: - os.chmod(pkgdir, current_mode) + with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout: + pydoc.apropos('') + self.assertIn('walkpkg', stdout.getvalue()) def test_url_search_package_error(self): # URL handler search should cope with packages that raise exceptions