[Patches] [ python-Patches-1550272 ] Add a test suite for unittest

SourceForge.net noreply at sourceforge.net
Wed Mar 7 10:11:45 CET 2007


Patches item #1550272, was opened at 2006-09-01 02:44
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1550272&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tests
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Collin Winter (collinwinter)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add a test suite for unittest

Initial Comment:
This file replaces the current version
Lib/test/test_unittest.py, which only contains a single
test. The attached suite contains 128 tests for the
mission-critical parts of unittest.

A patch will follow shortly that fixes the bugs in
unittest uncovered by this test suite.

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-07 09:11

Message:
Logged In: YES 
user_id=849994
Originator: NO

Committed as part of rev. 54199. Not backporting to 2.5.

----------------------------------------------------------------------

Comment By: Collin Winter (collinwinter)
Date: 2007-01-30 06:30

Message:
Logged In: YES 
user_id=1344176
Originator: YES

Point 1: I vaguely remember having a reason for not doing 'del
sys.modules[module_name]' back when I wrote the suite, but I can't think of
what it is now. I've amended the suite to use that line.

Point 2: I've added a list at the top of things that have yet to be
tested. The TestCase.assert* and TestCase.fail* methods still need explicit
tests, though most are tested implicitly in the test suite itself.

Point 3: I think assertRaises is ugly : )

Point 4: I've given up on resolving a number of the XXXs in 2.x, though
I'm working on a rewrite of unittest for 3.x that will resolve all such
issues.

Thanks!
File Added: test_unittest.py

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2007-01-30 02:15

Message:
Logged In: YES 
user_id=261020
Originator: NO

Oh the irony. :)

This is good stuff.  I have not reviewed the whole patch, but sampling
bits of it it looks fine.  No great danger in committing this, so why not
let's commit it?

Of the following points, I think only the first should block commit of
this patch.  Any comments on that first point?

1. test_loadTestsFromName__module_not_loaded() and
test_loadTestsFromNames__module_not_loaded() -- these may break in future,
and may break e.g. only when running tests in random order, which is 
sometimes done when debugging obscure stuff.  Better to introduce a module
of your own in Lib/test that's guaranteed not to be loaded already -- maybe
test_unittest_fodder.py .  Still, that wouldn't help the case where
somebody is running the tests in a loop, which would cause failures already
(again, this is something people do as part of bug detection / removal).  I
don't know the import internals and I hear they're messy, but perhaps just
del sys.modules[module_name] at the start of each of those two methods is
at least an improvement over what they do now.

2. Would be helpful to list what remains to be tested (for example, there
is no test of assertRaises)

3. Why no use of .assertRaises?

4. Would be nice to resolve some of the XXXes, but I realise that this may
be difficult/impossible given the requirement for backwards-compatibility


----------------------------------------------------------------------

Comment By: Collin Winter (collinwinter)
Date: 2006-09-01 02:52

Message:
Logged In: YES 
user_id=1344176

That promised patch for unittest is #1550273.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1550272&group_id=5470


More information about the Patches mailing list