classification
Title: test_mailbox fails if file or dir named by support.TESTFN exists
Type: behavior Stage: committed/rejected
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, petri.lehtinen, pitrou, python-dev, r.david.murray, vinay.sajip
Priority: normal Keywords: patch

Created on 2012-02-29 13:56 by vinay.sajip, last changed 2012-03-06 20:08 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
test_mailbox.diff vinay.sajip, 2012-02-29 13:56 Remove any existing test file, use shutil.rmtree review
test-changes.diff vinay.sajip, 2012-02-29 19:19 Misc. changes related to support.TESTFN droppings review
Repositories containing patches
http://hg.python.org/sandbox/vsajip#fix14158
Messages (9)
msg154630 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-02-29 13:56
test_mailbox fails if another failed test leaves a file or directory with the name given by support.TESTFN. The attached patch rectifies this, and also uses existing stdlib functionality (shutil.rmtree) to remove a directory tree recursively on tearDown.
msg154632 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-02-29 14:18
Why not just call the helper in setUp?  Otherwise, it looks good to me.

This is a bug fix and should be backported, I believe.
msg154633 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-02-29 14:39
> test_mailbox fails if another failed test leaves a file or directory
> with the name given by support.TESTFN. The attached patch rectifies this

You should find which test left the file and fix that test instead.
msg154635 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-02-29 14:45
> You should find which test left the file and fix that test instead.

Ideally yes, but it's easier said than done. When the failure occurred, there were many failures, and I couldn't locate the place where the file was being left behind. It was a while ago - I was remiss in not logging the issue then, but real life intervened :-(
msg154706 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-03-01 17:27
Updated patch available on Rietveld - I'll commit it four hours from now if there are no objections.
msg154721 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-02 01:24
New changeset 707586c70195 by Vinay Sajip in branch '3.2':
Closes #14158: improved resilience to test files left behind.
http://hg.python.org/cpython/rev/707586c70195

New changeset a92e73dfbff6 by Vinay Sajip in branch 'default':
Closes #14158: merged test file resilience fix from 3.2.
http://hg.python.org/cpython/rev/a92e73dfbff6
msg154734 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-02 05:40
Is 2.7 not affected?
msg154754 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-03-02 09:08
> Is 2.7 not affected?

It might be, but the code for regrtest looked somewhat different. I will revisit this once the buildbots have run for a few days with the 3.x changes, to confirm that they are OK. Marking as pending to remind me.
msg155035 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-06 20:08
New changeset 1112c2f602b3 by Vinay Sajip in branch '2.7':
Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
http://hg.python.org/cpython/rev/1112c2f602b3
History
Date User Action Args
2012-03-06 20:08:09python-devsetstatus: pending -> closed

messages: + msg155035
2012-03-02 09:08:55vinay.sajipsetstatus: closed -> pending

messages: + msg154754
2012-03-02 05:40:21eric.araujosetnosy: + eric.araujo
messages: + msg154734
2012-03-02 01:24:24python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg154721

resolution: fixed
stage: committed/rejected
2012-03-01 17:27:15vinay.sajipsetmessages: + msg154706
2012-02-29 19:19:08vinay.sajipsetfiles: + test-changes.diff
2012-02-29 19:17:59vinay.sajipsethgrepos: + hgrepo115
2012-02-29 14:45:45vinay.sajipsetmessages: + msg154635
2012-02-29 14:39:23pitrousetnosy: + pitrou
messages: + msg154633
2012-02-29 14:18:15r.david.murraysetmessages: + msg154632
versions: + Python 2.7, Python 3.2
2012-02-29 13:56:33vinay.sajipsettype: behavior
2012-02-29 13:56:21vinay.sajipcreate