This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author koobs
Recipients koobs
Date 2013-04-27.15:45:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367077511.6.0.115757701592.issue17809@psf.upfronthosting.co.za>
In-reply-to
Content
After some sleuthing with Ezio (thank you for the help) and some amateur debugging, all conditions in expanduser return the the home directory after stripping trailing slashes.

The assertion in Lib/test/test_posixpath.py:264 compares expanduser(path) with a path obtained directly from pwd.getpwuidpw_dir "without" submitting it to the same treatment,  and thus the test fails when $HOME ends in a "/".

The assertion was added in f11da6cecffd (2011-03-17) in order to show that expanduser() "does" infact derive a path from pw_dir, when $HOME is undefined, as the test indicates by deleting the environment variable

In so far as using exact path equivalence to make that assertion, the 'home' variable in the test either ought to be subjected to the same treatment as paths derived via expanduser(), or the assertion relaxed to use assertIsNotNone.

Given the comment in the test: "# expanduser should fall back to using the password database", my feeling is that the failure case is that no path is returned if a username is not provided in the path passed to expanduser, and as such assertIsNotNone is the more specific assertion, but I'll leave it in the hands of the experts to make the call.
History
Date User Action Args
2013-04-27 15:45:11koobssetrecipients: + koobs
2013-04-27 15:45:11koobssetmessageid: <1367077511.6.0.115757701592.issue17809@psf.upfronthosting.co.za>
2013-04-27 15:45:11koobslinkissue17809 messages
2013-04-27 15:45:11koobscreate