summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2011-10-06 21:19:06 (GMT)
committerNed Deily <nad@acm.org>2011-10-06 21:19:06 (GMT)
commitcaf5a22c5f864c21d1c13a5aa39986f85e89994d (patch)
tree8d24946123cfa2d1ad5cf20777825d1fd6882da3 /Lib
parent92a81a1eec6f47e67bf20685451f03cc00557419 (diff)
downloadcpython-caf5a22c5f864c21d1c13a5aa39986f85e89994d.zip
cpython-caf5a22c5f864c21d1c13a5aa39986f85e89994d.tar.gz
cpython-caf5a22c5f864c21d1c13a5aa39986f85e89994d.tar.bz2
Issue #7367: Add test case to test_pkgutil for walking path with
an unreadable directory.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_pkgutil.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
index f69af5a..f755e67 100644
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -84,6 +84,17 @@ class PkgutilTests(unittest.TestCase):
del sys.modules[pkg]
+ def test_unreadable_dir_on_syspath(self):
+ # issue7367 - walk_packages failed if unreadable dir on sys.path
+ package_name = "unreadable_package"
+ d = os.path.join(self.dirname, package_name)
+ # this does not appear to create an unreadable dir on Windows
+ # but the test should not fail anyway
+ os.mkdir(d, 0)
+ for t in pkgutil.walk_packages(path=[self.dirname]):
+ self.fail("unexpected package found")
+ os.rmdir(d)
+
class PkgutilPEP302Tests(unittest.TestCase):
class MyTestLoader(object):