Thomas Holmes <sha...@gmail.com> added the comment:

I agree, I do not feel like the precise changes to the tests feel completely 
ideal.  I feel that this problem stems from the fact that the nameCheck 
function as originally written doesn't seem to completely serve its originally 
intended purpose.

The original issue that caused the modifications of the tests were as follows:

* After adding "test_abs_path()" namecheck would pass the test when it should 
actually fail due to the original assert performing os.path.abspath() on both 
paths.  The obviously solution to this seemed to be to take the abspath of the 
user supplied path (the variable dir in this function) relative or otherwise 
and compare to ndir which is derived from the passed in "name" variable, 
populated by the mkdtemp call.

* The second issue is a somewhat complex case of those asserts passing the 
atypical odd calls of nameCheck from the "test__RandomNameSequence" suite.  
Without absolute pathing of both parameters in the new first assert this test 
began to fail.  This is because the original call was self.namecheck(<file 
name>, '', '', '').  These empty parameters when called with os.path.abspath() 
would return valid paths and these asserts would succeed.  As a result, the 
abspath(join()) call built a proper path into the "name" parameter allowing the 
tests to pass in this case.

* For the sake of cleanliness I decided it made more sense to split the two 
apart.  Make one assert that specifically verifies the path the file/folder is 
being placed in is both absolute and matching and one that will pass the file 
name.  Perhaps the old first assert (or second assert in the patch) can 
actually be removed but I think it may be getting properly tested against in 
one of the other test classes.

I am quite confident there is a much better way to accomplish this but I did 
not wish to change _too_ much of the test on my first stab at this.

I appreciate your feedback very much.  I will work on setting up the 2.7 
environment for working on issues that span the 2x/3x gap.

----------

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

Reply via email to