mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
[3.14] gh-136744: Remove unnecessary chmod from pydoc.apropos() test. (GH-136746) (#139242)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com> Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
This commit is contained in:
parent
91d86452c3
commit
997e4711e9
1 changed files with 3 additions and 15 deletions
|
|
@ -11,7 +11,6 @@
|
||||||
import _pickle
|
import _pickle
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import re
|
import re
|
||||||
import stat
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import test.support
|
import test.support
|
||||||
import time
|
import time
|
||||||
|
|
@ -1300,27 +1299,16 @@ def test_apropos_with_unreadable_dir(self):
|
||||||
self.assertEqual(out.getvalue(), '')
|
self.assertEqual(out.getvalue(), '')
|
||||||
self.assertEqual(err.getvalue(), '')
|
self.assertEqual(err.getvalue(), '')
|
||||||
|
|
||||||
@os_helper.skip_unless_working_chmod
|
|
||||||
def test_apropos_empty_doc(self):
|
def test_apropos_empty_doc(self):
|
||||||
pkgdir = os.path.join(TESTFN, 'walkpkg')
|
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)
|
os.mkdir(pkgdir)
|
||||||
self.addCleanup(rmtree, pkgdir)
|
self.addCleanup(rmtree, pkgdir)
|
||||||
init_path = os.path.join(pkgdir, '__init__.py')
|
init_path = os.path.join(pkgdir, '__init__.py')
|
||||||
with open(init_path, 'w') as fobj:
|
with open(init_path, 'w') as fobj:
|
||||||
fobj.write("foo = 1")
|
fobj.write("foo = 1")
|
||||||
current_mode = stat.S_IMODE(os.stat(pkgdir).st_mode)
|
with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout:
|
||||||
try:
|
pydoc.apropos('')
|
||||||
os.chmod(pkgdir, current_mode & ~stat.S_IEXEC)
|
self.assertIn('walkpkg', stdout.getvalue())
|
||||||
with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout:
|
|
||||||
pydoc.apropos('')
|
|
||||||
self.assertIn('walkpkg', stdout.getvalue())
|
|
||||||
finally:
|
|
||||||
os.chmod(pkgdir, current_mode)
|
|
||||||
|
|
||||||
def test_url_search_package_error(self):
|
def test_url_search_package_error(self):
|
||||||
# URL handler search should cope with packages that raise exceptions
|
# URL handler search should cope with packages that raise exceptions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue