[Python-Dev] fixing tests on windows
Tim Golden
mail at timgolden.me.uk
Tue Apr 1 21:47:29 CEST 2008
Giampaolo Rodola' wrote:
>>> Why not just modifying test_support.unlink() like this?
>>> Surely more convenient than modifying the whole suite.
>>> def unlink(filename):
>>> try:
>>> if os.name == 'nt':
>>> os.rename(filename, filename + ".deleted")
>>> filename = filename + ".deleted"
>>> os.unlink(filename)
>>> except OSError:
>>> pass
Tim Golden
>> Funnily enough, that's exactly what the patch I've
>> put together does.
>
> Sorry but maybe I misunderstood what you said above.
> It seems to me you proposed to add a new "remove_file" function to
> test_support while the solution I suggested was modifying the current
> test_support.unlink() function in a similar manner you proposed and
> have all tests use it wherever it is possible.
I wasn't very clear. What I posted earlier was by way
of a proof-of-concept and did indeed use a "remove"
function. After other people's +1 I have put together
a possible patch which does what you're suggesting.
I haven't posted it yet and I need to work through
the test files checking what the impact would be.
I like your second suggestion BTW, altho' I'd
probably skip the "if os.name == 'nt'" line
and just give it a try in any case.
TJG
More information about the Python-Dev
mailing list