[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2016-01-13 Thread Ezio Melotti

Ezio Melotti added the comment:

Thanks for the patch, however I got several errors while trying to apply it, so 
I ended up backporting d560eece0857 instead.
This can be closed now.

--
assignee:  -> ezio.melotti
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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2016-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e3763d98c46e by Ezio Melotti in branch '2.7':
#7944: close files explicitly in test_tarfile (backport d560eece0857).
https://hg.python.org/cpython/rev/e3763d98c46e

--
nosy: +python-dev

___
Python tracker 

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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2014-08-02 Thread Evans Mungai

Evans Mungai added the comment:

Backport for test_tarfile.py

--
nosy: +evans.mungai
versions: +Python 2.7 -Python 3.3, Python 3.4
Added file: http://bugs.python.org/file36212/issue7944_tarfile_2_7.diff

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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2014-07-31 Thread Mark Lawrence

Mark Lawrence added the comment:

Following on from msg185817 I'd suggest this is closed.

--
nosy: +BreamoreBoy

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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2014-07-31 Thread Brian Curtin

Changes by Brian Curtin br...@python.org:


--
nosy:  -brian.curtin

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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2013-04-01 Thread Mark Lawrence

Mark Lawrence added the comment:

#7232 has been closed so test_tarfile can presumably now be committed, also 
test_os.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2013-04-01 Thread Ezio Melotti

Ezio Melotti added the comment:

FWIW test_tarfile seems to use the with statement on 3.3+ already.
On 2.7 is not always used, but I'm not sure it's worth backporting/fixing the 
remaining occurrences there.
Most of the fixes in the test_os patch have already being applied too.
Either someone updates the current patch and/or proposes new ones, or this can 
probably be closed.

--
keywords: +easy
versions: +Python 3.3, Python 3.4 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-13 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Here is a patch for test_os.py.

--
nosy: +giampaolo.rodola
Added file: http://bugs.python.org/file19218/test_os.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-13 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

I'm not sure that this is a worthwhile exercise unless it can be shown for 
certain that alternate implementations need this.  Otherwise, it just changes 
tests in a way that isn't backwards compatible, makes it more difficult to 
apply patches cleanly, and risks damaging an otherwise good test.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-13 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
resolution: accepted - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-13 Thread Dave Fugate

Dave Fugate dfug...@microsoft.com added the comment:

I guarantee you that IronPython needs this.  I was a tester on IronPython for 
four years, and saw hundreds of random failures due to this specific issue.

My best,

Dave

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-13 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

If you're sure that is still the case, this can proceed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-13 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Backported test_gzip to to release27-maint in r85446.
Backported test_mailbox to to release27-maint in r85447.
Backported test_bz2 to to release27-maint in r85448.

Fixed test_old_mailbox, the original problem file, in release27-maint in r85449.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-12 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Fixed test_gzip in r85400.

--
resolution:  - accepted

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-12 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Fixed test_mailbox in r85401.
Fixed test_marshal in r85402.
Fixed test_bz2 in r85403.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-07-10 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
versions: +Python 3.2 -Python 2.6, Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-21 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

I'm going to go ahead with the patch-per-module approach, but anyone feel free 
to stop me from doing that.

Here's a patch for test_gzip on trunk.

--
Added file: http://bugs.python.org/file16286/issue7944_gzip.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-21 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Here's a patch for test_tempfile on trunk. The rest will just be silently added 
since this is already annoying.

--
Added file: http://bugs.python.org/file16289/issue7944_tempfile.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-20 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Does anyone prefer if this should be done on a patch-per-module basis, or just 
throw together one huge change? 

Also, I've found a few places where context managers aren't supported where 
they probably should be, so I'll spin off separate issues for those.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-20 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

There are several standard library modules that deliberately maintain 
compatibility with earlier versions of Python. The 'with' statement shouldn't 
be used for tests of any modules that still need compatibility with Python 2.4.

--
nosy: +michael.foord

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-16 Thread Dave Fugate

New submission from Dave Fugate dfug...@microsoft.com:

Sprinkled throughout CPython's test modules are snippets of code such as the 
following taken from 2.7A3's test_old_mailbox.py (line 141):
box = mailbox.UnixMailbox(open(self._path, 'r'))

The key thing to observe here is the file being opened yet never has it's 
'close' method explicitly called.  While this is fine for CPython's rather 
predictable garbage collections, it's quite possible that in alternate 
implementations of Python this file object won't be destroyed until well after 
line 141.  This can result in seemingly random failures of CPython's tests 
under alternate implementations of Python.

The solution to this problem would be to consistently use the 'with' statement 
(or alternatively close all open file objects) throughout all CPython test 
modules.

I've gone ahead and submitted an updated (2.7A3) version of test_old_mailbox.py 
which addresses this.  We can find other places where this is going on as well, 
but for the most part the tests already seem to be doing the right thing.

--
components: Tests
files: test_old_mailbox.py
messages: 99425
nosy: midnightdf
severity: normal
status: open
title: Use the 'with' statement in conjunction with 'open' throughout test 
modules
type: feature request
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file16235/test_old_mailbox.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Please use patches to show where the code changed.
(I generated one; it looks good to me)

I would like this kind of patches applied to CPython.
Looking at the Pypy test suite, the following test files seem easy to update:
test_bz2
test_dumbdbm
test_mailbox
test_marshal
test_mmap
test_pkgimport
test_tarfile
test_tempfile
test_traceback

--
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file16237/test_old_mailbox.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7944
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com