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 anselm.kruis
Recipients anselm.kruis
Date 2017-04-09.20:00:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491768025.09.0.83114690073.issue30028@psf.upfronthosting.co.za>
In-reply-to
Content
The context manager test.support.temp_cwd() creates a temporary directory and removes it on exit. The test runner test.regrtest uses this context manager.

I observed an annoying behaviour of test.support.temp_cwd() on Linux/UNIX: if the code, that runs in the temp_cwd() context forks and if the forked child terminates (without calling exec), then the temporary directory will be removed twice: by the child and by the parent. This can cause errors in the parent, if the parent tries to access the no longer existing directory.

I discovered this problem, when a test in test_multiprocessing_fork failed and the test directory for the complete test.regrtest-run got removed. Of course all other tests failed too.

I propose to modify test.support.temp_cwd() to remove the created directory only, if the process id (os.getpid()) is unchanged. I'll create a pull request.
History
Date User Action Args
2017-04-09 20:00:25anselm.kruissetrecipients: + anselm.kruis
2017-04-09 20:00:25anselm.kruissetmessageid: <1491768025.09.0.83114690073.issue30028@psf.upfronthosting.co.za>
2017-04-09 20:00:25anselm.kruislinkissue30028 messages
2017-04-09 20:00:24anselm.kruiscreate