[ python-Bugs-1635353 ] expanduser tests in test_posixpath fail if $HOME ends in a /

SourceForge.net noreply at sourceforge.net
Sun Jan 14 21:28:45 CET 2007


Bugs item #1635353, was opened at 2007-01-14 21:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1635353&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Marien Zwart (marienz)
Assigned to: Nobody/Anonymous (nobody)
Summary: expanduser tests in test_posixpath fail if $HOME ends in a /

Initial Comment:
test_expanduser in test_posixpath checks if expanduser('~/') equals expanduser('~') + '/'. expanduser checks if the home dir location ends in a / and skips the first character of the appended path if it does (so expanduser('~/foo') with HOME=/spork/ becomes /spork/foo, not /spork//foo). This means that if you run test_posixpath with HOME=/spork/ expanduser('~') and expanduser('~/') both return '/spork/' and the test fails because '/spork//' != '/spork/'.

Possible fixes I can think of: either have expanduser strip the trailing slash from the home directory instead of skipping the first slash from the appended path (so still with HOME=/spork/ expanduser('~') would be '/spork'), or have the test check if expanduser('~') ends in a backslash and check if expanduser('~') is equal to expanduser('~/') in that case.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1635353&group_id=5470


More information about the Python-bugs-list mailing list