[Python-Dev] [Python-checkins] cpython (2.7): Issue #7367: Add test case to test_pkgutil for walking path with (original) (raw)
Éric Araujo merwok at netwok.org
Fri Oct 7 19:00:25 CEST 2011
- Previous message: [Python-Dev] Summary of Python tracker Issues
- Next message: [Python-Dev] More Buildbot Information in Devguide (Was: Re: cpython (3.2): Issue #11956: Skip test_import.test_unwritable_directory on FreeBSD when run as)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Ned,
Issue #7367: Add test case to testpkgutil for walking path with an unreadable directory. Kudos for fixing this bug, the pydoc one and cleaning the duplicate reports!
diff --git a/Lib/test/testpkgutil.py b/Lib/test/testpkgutil.py --- a/Lib/test/testpkgutil.py +++ b/Lib/test/testpkgutil.py @@ -78,6 +78,17 @@ + def testunreadabledironsyspath(self): + # issue7367 - walkpackages failed if unreadable dir on sys.path + packagename = "unreadablepackage" + d = os.path.join(self.dirname, packagename) + # 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.walkpackages(path=[self.dirname]): + self.fail("unexpected package found") + os.rmdir(d)
This should use a try/finally block (or self.addCleanup, my preference) to make sure rmdir is always called.
Regards
- Previous message: [Python-Dev] Summary of Python tracker Issues
- Next message: [Python-Dev] More Buildbot Information in Devguide (Was: Re: cpython (3.2): Issue #11956: Skip test_import.test_unwritable_directory on FreeBSD when run as)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]