Robin Roth added the comment:

Antoine's suggestion does not work, because "dirname" does not cover enough 
cases (for example trailing slash, possibly more).

As suggested by him I now use realpath (instead of abspath). I can't come up 
with a symlink-situation that is broken with the old code, but realpath is what 
"ismount" actually means.

I also added a testcase that resembles the issue, i.e. it fails with the old 
code and passes with the fix. 

I mock the "Permission denied" by raising a generic OSError. Mocking can not 
resemble every real-life situation but by simulating all issues reporting and 
then fixing them, one should get a solid test coverage. 

I also took the liberty of minor cleanup in/around the functions changed, i.e. 
remove unused imports and remove single-use variables to make the code easier 
to read.

Attached the updated patch.

----------
Added file: 
http://bugs.python.org/file41041/test_fix_ismount_directory_not_readable.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2466>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to