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.

classification
Title: test_logging doesn't clean up after itself
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, python-dev, vinay.sajip
Priority: normal Keywords:

Created on 2013-02-27 19:48 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg183176 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2013-02-27 19:48
test_logging leaves behind a file called test.log in the current working directory.  I haven't narrowed down to the specific test, and I'm not sure what other versions are affected.
msg183186 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-02-27 21:21
There are only three logging tests that open a handler to test.log: test_filename, test_filemode and test_incompatible.

AFAIK those tests have remained unchanged over several years, if not months. Is the failure repeatable? Which platform did the failure occur on?
msg183187 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-02-27 21:31
I investigated a little further. The file is created in the test directory (build/test_python_XXXX/) and, I assume, the dir is wiped at the end of the test.

I can go through and do an addCleanup(os.remove, 'test.log') in the relevant tests; that should do it. It probably affects all versions - I'm not sure it's worth bothering to change 2.x versions, though.
msg183190 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2013-02-27 22:18
Thanks for investigating.

Yes, currently regrtest.py deletes the containing directory.  But this doesn't happen when running with plain unittest.  If each test cleans up after itself, this will give us more flexibility in moving from regrtest to a unittest-based approach (there is an issue about this).  Currently, test_logging seems to be one of only a few test modules that don't do this.

It's probably okay to make the fix only in 3.4 since we won't be making progress on moving away from regrtest in maintenance releases.
msg183192 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-27 23:34
New changeset b7f5bff33c22 by Vinay Sajip in branch 'default':
Closes #17313: Deleted test file created by test_logging.
http://hg.python.org/cpython/rev/b7f5bff33c22
History
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61515
2013-02-27 23:34:05python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg183192

resolution: fixed
stage: needs patch -> resolved
2013-02-27 22:18:20chris.jerdoneksetmessages: + msg183190
2013-02-27 21:31:15vinay.sajipsetmessages: + msg183187
2013-02-27 21:21:12vinay.sajipsetmessages: + msg183186
2013-02-27 19:48:48chris.jerdonekcreate