Skip to content

Commit 04c4628

Browse files
authored
gh-136744: Remove unnecessary chmod from pydoc.apropos() test. (GH-136746)
Remove unnecessary chmod from pydoc.apropos() test.
1 parent e642a24 commit 04c4628

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

Lib/test/test_pydoc/test_pydoc.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import _pickle
1212
import pkgutil
1313
import re
14-
import stat
1514
import tempfile
1615
import test.support
1716
import time
@@ -1303,24 +1302,14 @@ def test_apropos_with_unreadable_dir(self):
13031302
@os_helper.skip_unless_working_chmod
13041303
def test_apropos_empty_doc(self):
13051304
pkgdir = os.path.join(TESTFN, 'walkpkg')
1306-
if support.is_emscripten:
1307-
# Emscripten's readdir implementation is buggy on directories
1308-
# with read permission but no execute permission.
1309-
old_umask = os.umask(0)
1310-
self.addCleanup(os.umask, old_umask)
13111305
os.mkdir(pkgdir)
13121306
self.addCleanup(rmtree, pkgdir)
13131307
init_path = os.path.join(pkgdir, '__init__.py')
13141308
with open(init_path, 'w') as fobj:
13151309
fobj.write("foo = 1")
1316-
current_mode = stat.S_IMODE(os.stat(pkgdir).st_mode)
1317-
try:
1318-
os.chmod(pkgdir, current_mode & ~stat.S_IEXEC)
1319-
with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout:
1320-
pydoc.apropos('')
1321-
self.assertIn('walkpkg', stdout.getvalue())
1322-
finally:
1323-
os.chmod(pkgdir, current_mode)
1310+
with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout:
1311+
pydoc.apropos('')
1312+
self.assertIn('walkpkg', stdout.getvalue())
13241313

13251314
def test_url_search_package_error(self):
13261315
# URL handler search should cope with packages that raise exceptions

0 commit comments

Comments
 (0)