Skip to content

gh-136744: Remove unnecessary chmod from pydoc.apropos() test. #136746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions Lib/test/test_pydoc/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import _pickle
import pkgutil
import re
import stat
import tempfile
import test.support
import time
Expand Down Expand Up @@ -1303,24 +1302,14 @@ def test_apropos_with_unreadable_dir(self):
@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
Expand Down
Loading