[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-30 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
> Thank you for fixing backported patch and tests Victor.

No problem, thanks for your enhancement of regrtest ;-) I proposed the
idea and you implemented it, great team work!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for fixing backported patch and tests Victor.

--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ef2cacec2e9 by Victor Stinner in branch '2.7':
Issue #22390: Fix test_gzip if unicode filename doesn't work
https://hg.python.org/cpython/rev/6ef2cacec2e9

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread STINNER Victor

STINNER Victor added the comment:

On Windows, test_idle modifies os.environ: TCL_xxx and TIX_xxx (sorry
for "xxx", I don't remember the full variable name) are added. And
test_platform modifies os.environ['PATH'].

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 33e48141d83f by Victor Stinner in branch '2.7':
Issue #22390: Fix test_gzip, remove temporary file
https://hg.python.org/cpython/rev/33e48141d83f

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c5c31adbefeb by Victor Stinner in branch '2.7':
Issue #22390: Fix test_pdb to remove created bar.pyc file
https://hg.python.org/cpython/rev/c5c31adbefeb

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb5c3528d0d7 by Victor Stinner in branch '2.7':
Issue #22390: Fix test_aifc to remove the created file
https://hg.python.org/cpython/rev/fb5c3528d0d7

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 207db4338706 by Victor Stinner in branch '2.7':
Issue #22390: Fix typo in regrtest, support => test_support
https://hg.python.org/cpython/rev/207db4338706

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f40984e7ceea by Serhiy Storchaka in branch '2.7':
Issue #22390: test.regrtest now emits a warning if temporary files or
https://hg.python.org/cpython/rev/f40984e7ceea

New changeset 05e6bab4db8f by Serhiy Storchaka in branch '3.4':
Issue #22390: test.regrtest now emits a warning if temporary files or
https://hg.python.org/cpython/rev/05e6bab4db8f

New changeset bed806c9eb4c by Serhiy Storchaka in branch 'default':
Issue #22390: test.regrtest now emits a warning if temporary files or
https://hg.python.org/cpython/rev/bed806c9eb4c

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread STINNER Victor

STINNER Victor added the comment:

regrtest_warn_lost_files2.patch looks good to me.

I just ran the test suite with "./python -m test -j0 -rW" on Linux, I didn't 
get any warning.

When I modified test_os to create a file "x", it was noticed by your patch.

Go ahead.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-03-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Victor?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2015-02-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about this issue?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-10-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I don't understand why you want to remove more files than before. You may
> open a different issue, or at least explain the rationale.

I thought it would be good idea slightly extend this cleanup while we are 
here. I'm not motivated enough to open a different issue.

Well, here is a patch which removes only TESTFN. It is still improved, uses 
support.unlink and support.rmtree instead of os.unlink and shutil.rmtree.

You can just drop cleanup code at all if you prefer. All is good to me.

> I never see any forgotten test file after running tests, so I don't see why
> you are worried because of them.

This is because regrtest creates temporary directory and goes to it. But when 
you execute Python test directly, test files are created in the current 
directory.

> And with your first patch, we will now
> noticed forgotten files, so we can just fix tests.

But we will noticed only one about test at the time if several tests forgot 
the same file. This will needed several iterations.

--
Added file: http://bugs.python.org/file36894/regrtest_warn_lost_files2.patch

___
Python tracker 

___diff -r 1d5485471457 Lib/test/regrtest.py
--- a/Lib/test/regrtest.py  Mon Oct 13 00:17:23 2014 -0500
+++ b/Lib/test/regrtest.py  Mon Oct 13 11:10:36 2014 +0300
@@ -1031,7 +1031,7 @@ class saved_test_environment:
  # to a thread, so check processes first.
  'multiprocessing.process._dangling', 'threading._dangling',
  'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
- 'support.TESTFN', 'locale', 'warnings.showwarning',
+ 'files', 'locale', 'warnings.showwarning',
 )
 
 def get_sys_argv(self):
@@ -1187,20 +1187,16 @@ class saved_test_environment:
 sysconfig._INSTALL_SCHEMES.clear()
 sysconfig._INSTALL_SCHEMES.update(saved[2])
 
-def get_support_TESTFN(self):
-if os.path.isfile(support.TESTFN):
-result = 'f'
-elif os.path.isdir(support.TESTFN):
-result = 'd'
-else:
-result = None
-return result
-def restore_support_TESTFN(self, saved_value):
-if saved_value is None:
-if os.path.isfile(support.TESTFN):
-os.unlink(support.TESTFN)
-elif os.path.isdir(support.TESTFN):
-shutil.rmtree(support.TESTFN)
+def get_files(self):
+return sorted(fn + ('/' if os.path.isdir(fn) else '')
+  for fn in os.listdir())
+def restore_files(self, saved_value):
+fn = support.TESTFN
+if fn not in saved_value and (fn + '/') not in saved_value:
+if os.path.isfile(fn):
+support.unlink(fn)
+elif os.path.isdir(fn):
+support.rmtree(fn)
 
 _lc = [getattr(locale, lc) for lc in dir(locale)
if lc.startswith('LC_')]
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-10-12 Thread STINNER Victor

STINNER Victor added the comment:

> This allow other tests which leaks the same file to be reported too.

I don't understand your answer. The "fn.startswith(support.TESTFN)" test is not 
used in get_files().

If I understood correctly, your patch changes two things:

- it now reports files created for tests but not deleted (purpose of this issue)
- it removes more files than before

I don't understand why you want to remove more files than before. You may open 
a different issue, or at least explain the rationale.

I never see any forgotten test file after running tests, so I don't see why you 
are worried because of them. And with your first patch, we will now noticed 
forgotten files, so we can just fix tests.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-10-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

How about regrtest_warn_lost_files.patch?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-10-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8cf8bff3569e by Victor Stinner in branch '3.4':
Issue #22390: Remove files created by tests
https://hg.python.org/cpython/rev/8cf8bff3569e

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-17 Thread STINNER Victor

STINNER Victor added the comment:

fix_tests.patch: Fix the 7 tests which create files without removing them. 4 
tests (test_imp, test_pdb, test_source_encoding and test_support) create a 
__pycache__ directory. Maybe this directory should be ignored by regrtest?

--
Added file: http://bugs.python.org/file36647/fix_tests.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I will try to investigate these warnings.

Run tests with the -vv option.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I would prefer to fix tests instead of trying to remove arbitrary files. I'm
> not sure that "fn.startswith(support.TESTFN)" check is safe enough.

This allow other tests which leaks the same file to be reported too.

support.TESTFN contains process ID so it is unique enough.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

I ran the test suite with the patch applied:

7 tests altered the execution environment:
test_imp test_import test_pdb test_posix test_source_encoding
test_support test_threaded_import

I will try to investigate these warnings.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

I would prefer to fix tests instead of trying to remove arbitrary files. I'm 
not sure that "fn.startswith(support.TESTFN)" check is safe enough.

Maybe we should not remove TESTFN neither. You are supposed to be able to run 
tests without regrtest.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. It warns if new files or directories are left after test run 
in current directory and removes those of them which starts with TESTFN (i.e. 
TESTFN_UNICODE, TESTFN + "2", TESTFN + ".py" and other names used in tests).

--
keywords: +patch
nosy: +ezio.melotti, michael.foord, pitrou
stage:  -> patch review
type:  -> enhancement
versions: +Python 2.7, Python 3.4
Added file: http://bugs.python.org/file36601/regrtest_warn_lost_files.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread STINNER Victor

New submission from STINNER Victor:

A change in test_glob of issue #13968 started to fail because a previous test 
created temporary files but didn't remove them.

test.regrtest should at least emit a warning if the temporary directory used to 
run tests is not empty before removing it.

--
components: Tests
messages: 226777
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test.regrtest should complain if a test doesn't remove temporary files
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com