[issue11798] Test cases not garbage collected after run

2017-06-30 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 22d4e8fb99b16657eabfe7f9fee2d40a5ef882f6 by Victor Stinner in 
branch '3.6':
bpo-30813: Fix unittest when hunting refleaks (#2502) (#2505)
https://github.com/python/cpython/commit/22d4e8fb99b16657eabfe7f9fee2d40a5ef882f6


--

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 714afccf6e7644d21ce1a39e90bf83cb0c9a74f1 by Victor Stinner in 
branch '3.5':
bpo-30813: Fix unittest when hunting refleaks (#2502) (#2506)
https://github.com/python/cpython/commit/714afccf6e7644d21ce1a39e90bf83cb0c9a74f1


--

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2574

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2570

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread STINNER Victor

STINNER Victor added the comment:


New changeset e4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3 by Victor Stinner in 
branch 'master':
bpo-30813: Fix unittest when hunting refleaks (#2502)
https://github.com/python/cpython/commit/e4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3


--

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2017-06-30 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2563

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2014-09-21 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage:  - resolved
status: open - closed

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



[issue11798] Test cases not garbage collected after run

2013-12-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

It is used, see countTestCases().

--

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



[issue11798] Test cases not garbage collected after run

2013-12-29 Thread Michael Foord

Michael Foord added the comment:

Ah yes, I see - sorry.

--

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



[issue11798] Test cases not garbage collected after run

2013-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

No answer to Xavier's regression? The way this issue is being treated is a bit 
worrying.

--

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



[issue11798] Test cases not garbage collected after run

2013-12-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b668c409c10a by Antoine Pitrou in branch 'default':
Fix breakage in TestSuite.countTestCases() introduced by issue #11798.
http://hg.python.org/cpython/rev/b668c409c10a

--

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



[issue11798] Test cases not garbage collected after run

2013-12-28 Thread Michael Foord

Michael Foord added the comment:

What's the purpose of _removed_tests in your fix, it doesn't appear to be used?

--

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



[issue11798] Test cases not garbage collected after run

2013-12-14 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This seems to break BaseTestSuite.countTestCases when invoked after the 
TestSuite has been run:
  ...
  File Lib/unittest/suite.py, line 42, in countTestCases
cases += test.countTestCases()
AttributeError: 'NoneType' object has no attribute 'countTestCases'

Attached patch attempts to fix it.

--
nosy: +xdegaye
Added file: http://bugs.python.org/file33131/countTestCases.patch

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



[issue11798] Test cases not garbage collected after run

2013-10-06 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +haypo

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



[issue11798] Test cases not garbage collected after run

2013-10-06 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ideally, test specification should be separate from test execution. That is, it 
should be possible to keep the TestCase around (or whatever instantiates it, 
e.g. a factory) but get rid of its per-test-execution attributes.

Perhaps restoring the original __dict__ contents would do the trick?

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Michael Foord

Michael Foord added the comment:

That would only be a shallow copy, so I'm not sure it's worth the effort. The 
test has the opportunity in the setUp to ensure that initial state is correct - 
so I would leave that per test. Obviously sharing state between tests is prima 
facie bad, but any framework reusing test suites is doing that already.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 That would only be a shallow copy, so I'm not sure it's worth the
 effort. The test has the opportunity in the setUp to ensure that
 initial state is correct - so I would leave that per test.

I don't understand your objection. The concern is to get rid of old
state after test execution.

 Obviously
 sharing state between tests is prima facie bad, but any framework
 reusing test suites is doing that already.

What do you mean?

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Michael Foord

Michael Foord added the comment:

On 19 Sep 2013, at 14:06, Antoine Pitrou rep...@bugs.python.org wrote:

 
 Antoine Pitrou added the comment:
 
 That would only be a shallow copy, so I'm not sure it's worth the
 effort. The test has the opportunity in the setUp to ensure that
 initial state is correct - so I would leave that per test.
 
 I don't understand your objection. The concern is to get rid of old
 state after test execution.
 

If the object state includes mutable objects then restoring the previous 
dictionary will just restore the same mutable (and likely mutated) object. To 
*properly* restore state you'd either need to deepcopy the dictionary or 
reinstantiate the testcase (not reuse it in other words). I'd rather leave it 
up to each test to ensure it reinitialises attributes in setUp than add further 
complexity that only does part of the job.

 Obviously
 sharing state between tests is prima facie bad, but any framework
 reusing test suites is doing that already.
 
 What do you mean?

Any framework that is currently reusing test suites is re-using testcase 
instances. They are already sharing state between the runs.

In fact messing with testcase dictionaries is a further possible cause of 
backwards incompatibility for those suites. 

 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11798
 ___

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 If the object state includes mutable objects then restoring the
 previous dictionary will just restore the same mutable (and likely
 mutated) object.

I don't understand what you're talking about. Which mutable objects
exactly? I'm talking about copying the dict before setUp.

  Obviously
  sharing state between tests is prima facie bad, but any framework
  reusing test suites is doing that already.
  
  What do you mean?
 
 Any framework that is currently reusing test suites is re-using
 testcase instances. They are already sharing state between the runs.

They are not sharing it, since setUp will usually create the state
anew. What we're talking about is cleaning up the state after tearDown
is run, instead of waiting for the next setUp call.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Michael Foord

Michael Foord added the comment:

Ah right, my mistake. Before setUp there shouldn't be test state. (Although 
tests are free to do whatever they want in __init__ too and I've seen plenty of 
TestCase subclasses using __init__ when they should be using setUp.)

Essentially though _cleanup is a backwards compatibility feature - and suites 
that need _cleanup as a public api are already living without testcase dict 
cleanup.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That said, I agree that the __dict__ proposal is a hack, but as is the current 
_removetestAtIndex mechanism.

The only clean solution I can think of would be to have two separate classes:
- a TestSpec which contains execution-independent data about a test case, and 
knows how to instantiate it
- a TestCase that is used for the actual test execution, but isn't saved in the 
test suite

Maybe it's possible to do this without any backwards compat problem by making 
TestSuite.__iter__ always return TestCases (but freshly-created ones, from the 
inner test specs). The main point of adaptation would be 
TestLoader.loadTestsFromTestCase().

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Michael Foord

Michael Foord added the comment:

Having TestLoader.loadTestsFromTestCase() return a lazy suite that defers 
testcase instantiation until iteration is a nice idea.

Unfortunately the TestSuite.addTests api iterates over a suite to add new 
tests. i.e. the code that builds a TestSuite for module probably already 
iterates over the suites returned by TestLoader.loadTestsFromTestCase - so the 
change would need to be more pervasive.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Unfortunately the TestSuite.addTests api iterates over a suite to add
 new tests. i.e. the code that builds a TestSuite for module probably
 already iterates over the suites returned by
 TestLoader.loadTestsFromTestCase - so the change would need to be
 more pervasive.

addTests() could easily be tweaked to recognize that it gets passed a
TestSuite, and special-case that.

Also, TestCase objects could probably get an optional spec attribute
pointing to their TestSpec.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-16 Thread Michael Foord

Michael Foord added the comment:

If we're sure suite._cleanupis a *good* api for this then fine to expose it 
(and document) it as a public api. I'll take a look at it in a bit. 

Test suites will still have to do *some* monkeying around to set suite.cleanup 
(presumably in load_tests), so I'm not sure it's much more convenient...

--

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



[issue11798] Test cases not garbage collected after run

2013-09-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I'd rather not propagate more options all the way through, especially 
 as this is some thing that should be decided by the test framework and 
 is unlikely to be something you want to turn on and off per test run
 (which is what command line options are for). Frameworks that want to 
 disable this behaviour should use a TestSuite that overrides
 _removeAtIndex.

That sounds like a completely disproportionate solution. Why would you have to 
override the TestSuite class just to change an option and restore old 
behaviour? Why don't you simply expose the cleanup flag on TestSuite instances?

--
status: closed - open

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



[issue11798] Test cases not garbage collected after run

2013-09-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

For the record, this change broke the --forever option in Tulip's test script, 
which is why I'm caring. Setting the _cleanup flag to False seems to restore 
old behaviour, except that _cleanup is (obviously) a private API.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note: ideally, the --forever flag wouldn't reuse TestCase instances but rather 
create new ones.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-14 Thread Michael Foord

Michael Foord added the comment:

Can that be fixed in tulip?

--

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



[issue11798] Test cases not garbage collected after run

2013-09-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yes, but that's not the point. Legitimate use cases can be broken by the 
change, so at least there should be an easy way to disable the new behaviour.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-01 Thread Michael Foord

Michael Foord added the comment:

I'd rather not propagate more options all the way through, especially as this 
is some thing that should be decided by the test framework and is unlikely to 
be something you want to turn on and off per test run (which is what command 
line options are for). Frameworks that want to disable this behaviour should 
use a TestSuite that overrides _removeAtIndex.

--

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



[issue11798] Test cases not garbage collected after run

2013-09-01 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Ok. Let's close issue.

--
resolution:  - fixed
status: open - closed

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Good catch!
That's because -R run the same test suite several times.
I'm working on patch.

--
resolution: fixed - 
status: closed - open

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 868ad6fa8e68 by Andrew Svetlov in branch 'default':
Temporary disable tests cleanup (issue 11798).
http://hg.python.org/cpython/rev/868ad6fa8e68

--

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Er... your latest commit broke this issue's own tests!

--
nosy: +pitrou

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Tim Peters

Tim Peters added the comment:

All the buildbots are failing due to changeset 868ad6fa8e68 - I'm going to back 
it out.

--
nosy: +tim.peters

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7035b5d8fc0f by Tim Peters in branch 'default':
Back out 868ad6fa8e68 - it left all the buildbots failing.
http://hg.python.org/cpython/rev/7035b5d8fc0f

--

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 39781c3737f8 by Andrew Svetlov in branch 'default':
Issue #11798: fix tests for regrtest -R :
http://hg.python.org/cpython/rev/39781c3737f8

--

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



[issue11798] Test cases not garbage collected after run

2013-08-31 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Now 'regrtest.py -j4 -R : ' passes.
Do we need to add parameter for disabling tests cleanup to TestSuite, 
TestLoader and TestProgrm constructors?

--

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



[issue11798] Test cases not garbage collected after run

2013-08-30 Thread Meador Inge

Meador Inge added the comment:

I see some regressions when reference leak hunting with -j './python -j8 -R :'

test test_ast crashed -- Traceback (most recent call last):
  File /home/meadori/src/cpython/Lib/test/regrtest.py, line 1265, in 
runtest_inne
r
huntrleaks)  File /home/meadori/src/cpython/Lib/test/regrtest.py, line 
1381, in dash_R
indirect_test()
  File /home/meadori/src/cpython/Lib/test/regrtest.py, line 1261, in lambda 
   test_runner = lambda: support.run_unittest(tests)
  File /home/meadori/src/cpython/Lib/test/support/__init__.py, line 1683, in 
run_
unittest
_run_suite(suite)
  File /home/meadori/src/cpython/Lib/test/support/__init__.py, line 1649, in 
_run
_suite
result = runner.run(suite)
  File /home/meadori/src/cpython/Lib/test/support/__init__.py, line 1548, in 
run
test(result)
  File /home/meadori/src/cpython/Lib/unittest/suite.py, line 76, in __call__
return self.run(*args, **kwds)
  File /home/meadori/src/cpython/Lib/unittest/suite.py, line 114, in run
test(result)
  File /home/meadori/src/cpython/Lib/unittest/suite.py, line 76, in __call__
return self.run(*args, **kwds)
  File /home/meadori/src/cpython/Lib/unittest/suite.py, line 114, in run
test(result)
TypeError: 'NoneType' object is not callable

--
nosy: +meador.inge

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1c2a37459c70 by Andrew Svetlov in branch 'default':
Issue #11798: TestSuite now drops references to own tests after execution.
http://hg.python.org/cpython/rev/1c2a37459c70

--
nosy: +python-dev

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

This seems to be producing a test failure in test_doctest.  eg:

 
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%203.x/builds/1920

--

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Matt McClure

Matt McClure added the comment:

This might fix it (untested):

diff -r d748d7020192 Lib/test/test_doctest.py
--- a/Lib/test/test_doctest.py  Sat Aug 03 10:09:25 2013 -0400
+++ b/Lib/test/test_doctest.py  Wed Aug 28 15:35:58 2013 -0400
@@ -2329,6 +2329,8 @@
 
 Now, when we run the test:
 
+   suite = doctest.DocFileSuite('test_doctest.txt',
+  ...  optionflags=doctest.DONT_ACCEPT_BLANKLINE)
result = suite.run(unittest.TestResult())
print(result.failures[0][1]) # doctest: +ELLIPSIS
   Traceback ...

--

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 17f23cf029cf by Andrew Svetlov in branch 'default':
Fix tests for #11798
http://hg.python.org/cpython/rev/17f23cf029cf

--

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




[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Sorry. Tests are fixed now.

--

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Looks good but review comments worth to be applied or rejected with reasonable 
note.

--
nosy: +asvetlov

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread Matt McClure

Matt McClure added the comment:

Andrew,

I didn't understand your message. Are you asking me to change the patch 
somehow? Or asking Michael to review and apply it?

Best,
Matt

--

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Matt, I've added new patch.

Will commit it after tomorrow if nobody object.

--
Added file: http://bugs.python.org/file31483/issue11798.diff

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread Michael Foord

Michael Foord added the comment:

Go ahead and commit. The functionality and patch are good.

--

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Matt, would you sign licence agreement http://www.python.org/psf/contrib/ ?
The Python Software Fondation is asking all contributors to sign it.
Thanks.

--

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread Matt McClure

Matt McClure added the comment:

Andrew,

I signed the agreement as matthewlmcclure and as matthewlmcclure-gmail. Is 
there any way I can merge those two user accounts?

I believe the original patch was Tom Wardill's. I just updated his patch.

--
nosy: +matthewlmcclure

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



[issue11798] Test cases not garbage collected after run

2013-08-27 Thread R. David Murray

R. David Murray added the comment:

There is no easy way to merge accounts in roundup.  If you've submitted the 
agreement, your * should show up in a bit :)

--

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



[issue11798] Test cases not garbage collected after run

2013-08-17 Thread Simon Charette

Changes by Simon Charette charett...@gmail.com:


--
nosy: +charettes

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



[issue11798] Test cases not garbage collected after run

2013-08-04 Thread Matt McClure

Matt McClure added the comment:

Michael Foord fuzzyman at voidspace.org.uk writes:
 On 2 Aug 2013, at 19:19, Antoine Pitrou solipsis at pitrou.net wrote:
  The patch is basically ready for commit, except for a possible doc
  addition, no?
 
 Looks to be the case, reading the patch it looks fine. I'm currently on
 holiday until Monday. If anyone is motivated to do the docs too and 
 commit that would be great. Otherwise I'll get to it on my return.

It looks like the patch is based on what will become 3.4. Would backporting it 
to 2.7 be feasible?  What's involved in doing so?

I took a crack at the docs. I'm attaching an updated patch.

--
nosy: +matthewlmclure

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



[issue11798] Test cases not garbage collected after run

2013-08-04 Thread Matt McClure

Changes by Matt McClure matthewlmccl...@gmail.com:


Added file: 
http://bugs.python.org/file31154/11798-20130803-matthewlmcclure.patch

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



[issue11798] Test cases not garbage collected after run

2013-08-04 Thread Michael Foord

Michael Foord added the comment:

This smells like a new feature to me (it's certainly a fairly significant 
change in behaviour) and isn't appropriate for backporting to 2.7.

It can however go into unittest2.

I agree with David that a destructive iteration using pop is more likely to 
cause backwards-compatibility issues.

--

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



[issue11798] Test cases not garbage collected after run

2013-08-04 Thread Michael Foord

Michael Foord added the comment:

The doc patch looks good, thanks Matt. I'll read it through properly before 
committing.

--

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



[issue11798] Test cases not garbage collected after run

2013-08-03 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
nosy:  -exarkun

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



[issue11798] Test cases not garbage collected after run

2013-08-03 Thread R. David Murray

R. David Murray added the comment:

Terry: I would not be in favor of using the normal iter, since iterating a 
collection doesn't normally empty it, and there may be tools that iterate a 
test suite outside of test execution.  Adding a pop_iter method would be a 
backward compatibility issue, since replacement test suites would not have 
that method.  I think the current patch is the best bet for maintaining 
backward compatibility.

--
nosy: +r.david.murray

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



[issue11798] Test cases not garbage collected after run

2013-08-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If the iterator for 'self' were de-structive, if it removed (popped) the test 
from whatever structure holds it before yielding it, the messiness of enumerate 
and the new ._removeTestAtIndex method would not be needed and 'for test in 
self' would work as desired. If considered necessary,  new method .pop_iter, 
used in 'for test in self.pop_iter', would make it obvious that the iteration 
empties the collection.

--
nosy: +terry.reedy

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



[issue11798] Test cases not garbage collected after run

2013-05-04 Thread Guido van Rossum

Guido van Rossum added the comment:

Just to be self-referential here's a link to #17908.

--
nosy: +gvanrossum

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



[issue11798] Test cases not garbage collected after run

2012-10-02 Thread Michael Foord

Michael Foord added the comment:

The patch looks good to me, although there probably needs to be a note in the 
TestSuite docs too. I'll apply this to Python 3.4, which leaves plenty of time 
for people to object.

Note that people needing the old behaviour can subclass TestSuite and provide a 
dummy implementation of _removeTestAtIndex.

--

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



[issue11798] Test cases not garbage collected after run

2012-09-30 Thread Tom Wardill

Tom Wardill added the comment:

Patch attached using setting test to None after execution.

--
keywords: +patch
nosy: +tomwardill
Added file: http://bugs.python.org/file27352/11798.patch

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



[issue11798] Test cases not garbage collected after run

2012-09-28 Thread Michael Foord

Changes by Michael Foord mich...@voidspace.org.uk:


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

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



[issue11798] Test cases not garbage collected after run

2011-06-01 Thread Fabio Zadrozny

Fabio Zadrozny fab...@users.sourceforge.net added the comment:

Sure, will try to get a patch for next week...

--

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



[issue11798] Test cases not garbage collected after run

2011-05-26 Thread Fabio Zadrozny

Fabio Zadrozny fab...@users.sourceforge.net added the comment:

So Michal, it seems no objections were raised?

--

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



[issue11798] Test cases not garbage collected after run

2011-05-26 Thread Michael Foord

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

Sure, let's do it. Fabio, care to provide patch with tests and doc changes? 
(For 3.3.)

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Fabio Zadrozny

New submission from Fabio Zadrozny fab...@users.sourceforge.net:

Right now, when doing a test case, one must clear all the variables created in 
the test class, and I believe this shouldn't be needed...

E.g.:

class Test(TestCase):
  def setUp(self):
self.obj1 = MyObject()

  ...

  def tearDown(self):
del self.obj1

Ideally (in my view), right after running the test, it should be 
garbage-collected and the explicit tearDown wouldn't be needed (as the test 
would garbage-collected, that reference would automatically die), because this 
is currently very error prone... (and probably a source of leaks for any 
sufficiently big test suite).

If that's accepted, I can provide a patch.

--
components: Library (Lib)
messages: 133225
nosy: fabioz
priority: normal
severity: normal
status: open
title: Test cases not garbage collected after run
type: behavior
versions: Python 2.7, Python 3.2

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

You don't have to clear them; you just have to finalize them. Anyway, this is 
essentially impossible to do in a backward compatible way given that TestCases 
are expected to stay around.

--
nosy: +benjamin.peterson

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Jean-Paul Calderone

Jean-Paul Calderone invalid@example.invalid added the comment:

Trial lets test cases get garbaged collected.  When we noticed this wasn't 
happening, we treated it as a bug and fixed it.  No one ever complained about 
the change.  I don't see any obvious way in which an application would even be 
able to tell the difference (a user can tell the difference by looking at top). 
 In what case do you think this change would result in broken application code?

--
nosy: +exarkun

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Fabio Zadrozny

Fabio Zadrozny fab...@users.sourceforge.net added the comment:

I do get the idea of the backward incompatibility, although I think it's really 
minor in this case.

Just for some data, the pydev test runner has had a fix to clear those test 
cases for quite a while already and no one has complained about it (it actually 
makes each of the tests None after run, so, if someone tries to access it after 
that, it would be pretty clear that it's not there anymore).

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

2011/4/7 Jean-Paul Calderone rep...@bugs.python.org:

 Jean-Paul Calderone invalid@example.invalid added the comment:

 Trial lets test cases get garbaged collected.  When we noticed this wasn't 
 happening, we treated it as a bug and fixed it.  No one ever complained about 
 the change.  I don't see any obvious way in which an application would even 
 be able to tell the difference (a user can tell the difference by looking at 
 top).  In what case do you think this change would result in broken 
 application code?

I thought unittest was just handed a bunch of TestCase instances and
couldn't do much about insuring they were garbage collected.

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Jean-Paul Calderone

Jean-Paul Calderone invalid@example.invalid added the comment:

 I thought unittest was just handed a bunch of TestCase instances and couldn't 
 do much about insuring they were garbage collected.

True.  But unittest could ensure that it doesn't keep a reference to each 
TestCase instance after it finishes running it.  Then, if no one else has a 
reference either, it can be garbage collected.

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Michael Foord

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

A TestSuite (which is how tests are collected to run) holds all the tests and 
therefore keeps them all alive for the duration of the test run. (I presume 
this is the issue anyway.)

How would you solve this - by having calling a TestSuite (which is how a test 
run is executed) remove members from themselves after each test execution? (Any 
failure tracebacks etc stored by the TestResult would also have to not keep the 
test alive.)

My only concern would be backwards compatibility due to the change in behaviour.

--
assignee:  - michael.foord
nosy: +michael.foord

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Fabio Zadrozny

Fabio Zadrozny fab...@users.sourceforge.net added the comment:

The current code I use in PyDev is below -- another option could be not adding 
the None to the list of tests, but removing it, but I find that a bit worse 
because in the current way if someone tries to access it after it's ran, it'll 
become clear it was removed.

def run(self, result):
for index, test in enumerate(self._tests):
if result.shouldStop:
break
test(result)

# Let the memory be released! 
self._tests[index] = None

return result


I think the issue with the test result storing the test is much more difficult 
to deal with (because currently most unit test frameworks probably rely on 
having it there), so, that's probably not something I'd try to fix as it'd 
probably break many clients... in which case it should be expected that the 
test is kept alive if it fails -- but as the idea is that all has to turn green 
anyways, I don't see this as a big issue :)

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Jean-Paul Calderone

Jean-Paul Calderone invalid@example.invalid added the comment:

Here's Trial's implementation: 
http://twistedmatrix.com/trac/browser/trunk/twisted/trial/runner.py#L138

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Michael Foord

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

Not keeping tests alive for the whole run seems like a good thing and either 
implementation seems fine to me. I'd be interested to hear if anyone else had 
any backwards compatibility concerns though.

--

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

 Not keeping tests alive for the whole run seems like a
 good thing 

+1

 and either implementation seems fine to me.

I slightly prefer Fabio;s assignment to None approach (for subtle reasons that 
I can't articulate at the moment).

--
nosy: +rhettinger

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



[issue11798] Test cases not garbage collected after run

2011-04-07 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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