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: Port tests to unittest (Part 2)
Type: Stage:
Components: Tests Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, doerwalter, georg.brandl, jlgijsbers, nnorwitz, rhettinger, tim.peters
Priority: normal Keywords: patch

Created on 2003-05-13 10:45 by doerwalter, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_array.py doerwalter, 2003-05-13 10:45
test_winsound.py doerwalter, 2003-05-13 10:45
test_mimetools.py doerwalter, 2003-05-18 23:46
test_mimetools.py rhettinger, 2003-05-21 13:04 Modified test_mimetools.py
test_mimetools.py doerwalter, 2003-05-22 15:05 Third version with tests for Message
test_posixpath.py doerwalter, 2003-06-16 12:48
fail.txt rhettinger, 2003-06-16 15:44 Output from running test_posixpath.py
test_posixpath.py doerwalter, 2003-06-16 18:09 Fixed for Windows
test_posixpath.py doerwalter, 2003-06-16 19:33 Without getatime() test in test_time()
test_complex.py doerwalter, 2003-06-17 21:36
test_complex.py rhettinger, 2003-06-17 23:49 test_complex.py with raymond's additions
test_compile.py rhettinger, 2003-06-20 19:26 test_compile.py
test_pep263.py doerwalter, 2003-08-09 15:47
test_longexp.py doerwalter, 2003-08-09 15:48
test_structseq.py nobody, 2003-08-30 17:03
test_slice.py doerwalter, 2003-08-31 19:49
test_slice.py rhettinger, 2003-08-31 23:52 Revised test_slice
test_slice.py rhettinger, 2003-08-31 23:53 Revised test_slice
seq_tests.py doerwalter, 2003-11-27 19:48 Part of the test_types changes
list_tests.py doerwalter, 2003-11-27 19:50 Part of the test_types changes
test_list.py doerwalter, 2003-11-27 19:51 Part of the test_types changes
test_tuple.py doerwalter, 2003-11-27 19:51 Part of the test_types changes
test_userlist.py doerwalter, 2003-11-27 19:52 Part of the test_types changes
test_types.py.diff doerwalter, 2003-11-27 19:54 Part of the test_types changes
improve-cov.diff nnorwitz, 2003-12-11 05:52 test_md5 and test_weakref
test_future.diff nnorwitz, 2003-12-11 06:05
test_future_pyunit.diff doerwalter, 2003-12-13 20:18 ported to PyUnit
test_binascii.py doerwalter, 2003-12-18 23:49
test_dict.py doerwalter, 2004-04-03 11:06
dict_diff.txt doerwalter, 2004-05-27 19:04 Marged dict tests
test_unpack_doctest.py jlgijsbers, 2004-08-18 13:23
test_zipfile_unittest.py jlgijsbers, 2004-08-18 13:24
test_unpack_doctest.py jlgijsbers, 2004-08-19 15:14 corrected
test_inspect_unittest.diff jlgijsbers, 2004-08-20 15:06
test__locale.py brett.cannon, 2004-08-27 03:44
Messages (78)
msg43710 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-13 10:45
Here are the next test scripts ported to PyUnit:
test_winsound and test_array. For test_array many
additional tests have been added (code coverage is at 91%)
msg43711 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-17 23:35
Logged In: YES 
user_id=80475

The approach of using tests.append() is elegant and 
makes it easier to verify that no tests are being omitted.
msg43712 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-18 00:50
Logged In: YES 
user_id=89016

Checked in as:
Lib/test/test_array.py 1.20
Lib/test/test_winsound.py 1.5
Lib/test/output/test_winsound delete

> The approach of using tests.append() is elegant and
> makes it easier to verify that no tests are being omitted.

The most elegant approach would probably be a metaclass that
collects all TestCase subclasses that get defined. Classes
that only serve as a base class could be skipped by
specifying a certain class attribute.
msg43713 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-18 01:04
Logged In: YES 
user_id=80475

I don't think metaclasses or module introspection would 
help whenever there are classes that derive from TestCase 
but are not meant to be run directly (their subclasses have 
the setup/teardown/or class data).  test_sets.py has 
examples of that kind of thing.
msg43714 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-18 01:45
Logged In: YES 
user_id=89016

But this can be solved with a special non-inheritable class
attribute:

class BaseTest(unittest.TestCase):
    run = False

Then the metaclass can do the following:
def __new__(cls, name, bases, dict):
    if "run" not in dict:
       dict["run"]  = True
    cls = type.__new__(cls, name, bases, dict)
    if cls.run:
        tests.append(cls)
    return cls
msg43715 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-18 01:59
Logged In: YES 
user_id=80475

Good call.

Instead of using metaclasses, perhaps add a module 
introspector function to test_support:

def findtestclasses(mod):
    tests = []
    for elem in dir(mod):
        member = getattr(mod, elem)
        if type(member) != type: continue
        if issubclass(member, unittest.TestCase):
            tests.append(member)
    return tests
msg43716 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-18 02:52
Logged In: YES 
user_id=89016

But how do I pass the module object from inside the module?
And skipping abstract classes seems to be more work in this
version: If skipping is done via a class attribute, derived
classes have to explicitely reset this flag because of
interitance.
msg43717 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-18 03:18
Logged In: YES 
user_id=80475

Get the module with sys.modules:
  tests = test_support.findtestclasses(sys.modules
[__name__])
  test_support.unittest(*tests)

Yeah, the inheritance thing is a problem.  I was trying to 
avoid having to modify unittest.TestCase to have a 
metaclass.  The control of the module is kept in a 
separate SF project and one of its goals is to be backward 
compatible through 1.5.2 (meaning no metaclasses).

A possible workaround is to define a modified testcase in 
test_support so that people don't import unittest directly 
anymore:

test_support.py
-------------------------
import unittest
class SmartTestCase(unittest.TestCase):
    __metaclass__ = autotracktests
    pass

test_sets.py
------------------
class TestBasicOps(test_support.SmartTestCase):
    run = False
. . .
class TestBasicOpsEmpty(TestBasicOps):
    def setUp(self):
    . . .

Still, this is starting to seem a bit magical and tricky.
msg43718 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-18 23:46
Logged In: YES 
user_id=89016

Agreed, this is too much magic for too little gain.

Back to business: Here is test_mimetools ported to PyUnit.
Tests for mimetools.Message are still missing. If you can
think of any tests please add them.
msg43719 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-21 13:04
Logged In: YES 
user_id=80475

Attaching a slightly modified test_mimetools which covers 
more encodings and has a stronger set test.
msg43720 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-22 15:05
Logged In: YES 
user_id=89016

I've attached a third version of test_mimetools.py that does
some checks for the mimetools.Message class.
msg43721 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-22 16:18
Logged In: YES 
user_id=80475

test_mimetools.py is ready.
msg43722 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-05-22 17:33
Logged In: YES 
user_id=89016

Checked in as:
Lib/test/output/test_mimetools delete
Lib/test/test_mimetools.py 1.4
msg43723 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-16 12:48
Logged In: YES 
user_id=89016

Here's the next one: test_posixpath.py with many additional
tests.
msg43724 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-16 15:44
Logged In: YES 
user_id=80475

The test file now has dependencies that do not apply to 
windows.  The failure messages are attached.
msg43725 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-16 15:59
Logged In: YES 
user_id=80475

Assigning to Brett to give experience doing a detail review on 
this type of change.

* examine every line of the diff and consider whether there is 
any semantic change (exceptions raised, etc).

* apply the diff and run the test suite

* in the interactive mode, call-up each function and make 
sure it behaves as expected (this is necessary because the 
test coverage is very low).

* verify that the whitespace has been cleaned up.

* look for missing changes (such as use of +=)
msg43726 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-16 16:04
Logged In: YES 
user_id=80475

The previous comment applied to another patch.
It should have said:

Assigning to Brett to make sure the patch runs on the Mac.  
Don't accept this one until it has guards that allow the tests 
to run on Windows.
msg43727 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-16 18:09
Logged In: YES 
user_id=89016

I didn't realize that test_posixpath must work on Windows
too. Here's a new version.
msg43728 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-06-16 18:20
Logged In: YES 
user_id=357491

Just wanting to work me like a dog, huh, Raymond?  =)

And to clarify for my and Walter's benefit, when you say guards, 
you mean that the tests don't crap out and say they failed on 
Windows, right?  I thought posixpath was not meant to work 
under Windows.
msg43729 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-16 19:09
Logged In: YES 
user_id=80475


Walter, there is one failure left:
======================================
================================
FAIL: test_time (__main__.PosixPathTest)
-------------------------------------------------------------------
---
Traceback (most recent call last):
  File "test_posixpath.py", line 125, in test_time
    self.assert_(
  File "C:\PY23\lib\unittest.py", line 268, in failUnless
    if not expr: raise self.failureException, msg
AssertionError




Brett, after Walter revises the patch, just load the patch and 
make sure the test runs on the Mac.  Between the three of 
us, we can validate the suite on three different platforms.  
Cheers.

msg43730 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-16 19:33
Logged In: YES 
user_id=89016

Strange, I didn't get this failure here, but I got it on my
laptop at home. I've removed the comparison with the
getatime() value from test_time(). I hope this fixes it.
msg43731 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-16 19:41
Logged In: YES 
user_id=80475

Okay, it runs fine here.  Once Brett confirms that it runs on 
the Mac, go ahead and load it.

P.S. Your improved test_mimetools.py helped detect a latent 
error in mimetools.py when it was run under Windows.  Tim 
made the fix this weekend.
msg43732 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-16 19:51
Logged In: YES 
user_id=89016

The joys of unittesting: Breaking code to make it better! ;)
msg43733 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-06-16 21:55
Logged In: YES 
user_id=357491

OK, all tests pass cleanly.  Applied as revision 1.6.
msg43734 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-17 12:06
Logged In: YES 
user_id=89016

I'd like to keep this patch open, as it is an ongoing task
(the next test scripts to be converted will be test_complex
and then maybe test_marshal)
msg43735 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-17 21:36
Logged In: YES 
user_id=89016

Here's the next one: text_complex.py.

There one test that's currently commented out, because it
crashes Python on Alpha (see http://www.python.org/sf/756093.

The old test scripts states that tests for the constructor
are in test_builtin, but I've added many tests to this
script, so this is no longer true. We could move the tests
to test_builtin, but IMHO that doesn't make sense, we'd
better move the rest of the constructor tests from
test_builtin to test_complex.

I'd like to have a version of assertAlmostEqual() in
unittest.py that can cope with complex numbers, but this
would have to be coordinated with the standalone version of
PyUnit (and it would probably have to wait until the 2.4
cycle starts) (I noticed that there is no assertAlmostEqual
in the code on pyunit.sf.net anyway.)
msg43736 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-17 23:49
Logged In: YES 
user_id=80475

I added a few tests.  If they are fine with you, go ahead and 
commit.
msg43737 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-18 14:27
Logged In: YES 
user_id=89016

Checked in as:
Lib/test/test_builtin.py 1.21
Lib/test/test_complex.py 1.10

(I've moved the constructor tests from test_builtin to
test_complex)
msg43738 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-18 19:48
Logged In: YES 
user_id=80475

Great!
Can I suggest that test_types.py be next.
msg43739 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-19 09:46
Logged In: YES 
user_id=89016

Maybe test_types.py should be split into several scripts:
test_dict, test_tuple, test_list, test_int, test_long etc.
Some of them already exist (like test_long), some don't. The
constructor tests from test_builtin should probably be moved
to the new test scripts as well. Furthermore we should try
to share as much testing functionality as possible (e.g.
between test_int and test_long, or between test_list and
test_userlist)
msg43740 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-20 19:26
Logged In: YES 
user_id=80475

Here's one for you:

test_compile.py is ready.
msg43741 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-23 11:49
Logged In: YES 
user_id=89016

Are you sure, that the code path is the same in the new
test_argument_handling() as in the old test? I.e. is
"eval('lambda a,a: 0')" the same as "exec 'def f(a, a): pass'"?

The print statement in test_float_literals should be changed
to a comment.

Should the imports in test_unary_minus() be moved to the
start of the script?

Otherwise the test looks (and runs) OK.
msg43742 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-06-23 13:38
Logged In: YES 
user_id=80475

Fixed Walter's review comments and
committed as Lib/test/test_compile.py 1.19
msg43743 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-08-09 15:47
Logged In: YES 
user_id=89016

Here are two simple ones: test_pep263 and test_longexp. I
can't think of any additional tests to add.
msg43744 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-08-30 17:06
Logged In: YES 
user_id=89016

Here's test_structse.py converted with a few additional
tests. If all three scripts are OK, could you check them in
Raymond, as I'll be on vacation for three weeks?
msg43745 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-08-30 17:10
Logged In: YES 
user_id=80475

Will do!
msg43746 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-08-30 23:04
Logged In: YES 
user_id=80475

Done.

See:
Lib/test/test_longexp.py 1.9; previous revision: 1.8
Lib/test/test_pep263.py 1.3; previous revision: 1.2
Lib/test/test_sets.py 1.27; previous revision: 1.26
Lib/test/test_structseq.py 1.5; previous revision: 1.4
Lib/test/output/test_longexp delete; previous revision: 1.3
msg43747 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-08-31 19:49
Logged In: YES 
user_id=89016

Thanks! Here's another one: test_slice.py
msg43748 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-08-31 23:52
Logged In: YES 
user_id=80475

Looks good.
I added a couple of minor tests.
Revised patch attached.
Okay to apply.
msg43749 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-09-02 01:53
Logged In: YES 
user_id=80475

Applied as:
   Lib/test/test_slice.py 1.5.
msg43750 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-11-27 19:48
Logged In: YES 
user_id=89016

Here the first part of the test_types port: list and tuple
tests have been moved to their own scripts: test_tuple.py
and test_list.py. Common tests for tuple, list and UserList
are shared (in seq_test.py and list_test.py)
msg43751 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-12-07 23:49
Logged In: YES 
user_id=80475

Looks good.
msg43752 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-12-08 11:42
Logged In: YES 
user_id=89016

Checked in as:
Lib/test/list_tests.py 1.1
Lib/test/seq_tests.py 1.1
Lib/test/test_list.py 1.1
Lib/test/test_tuple.py 1.1
Lib/test/test_types.py 1.56
Lib/test/test_userlist.py 1.11
Lib/test/output/test_types 1.3

Next will be test_binascii.py before I continue with
test_types.py.
msg43753 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-12-11 05:52
Logged In: YES 
user_id=33168

Attached are two tests (in one file, I'm being lazy, sorry)
to improve test coverage for md5c.c and _weakref.c. 
test_md5 was ported to unittest, weakref, just adds two
little tests to get coverage up to 100%.  If you like, just
go ahead and check in.  You will need to remove
Lib/test/output/test_md5
msg43754 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-12-11 06:05
Logged In: YES 
user_id=33168

Improve coverage for test_future too.  I'm not sure if test
future can be ported to PyUnit.
msg43755 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-12-11 12:36
Logged In: YES 
user_id=89016

md5/weakref patch checked in as:
Lib/test/test_weakref.py 1.33
Lib/test/test_md5.py 1.5
Lib/test/output/test_md5 remove
msg43756 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-12-13 20:18
Logged In: YES 
user_id=89016

Here is a version of test_future ported to PyUnit
(test_future_pyunit.diff). If this makes sense to you Neal,
please check it in.

(BTW, how did you convince CVS to include
badsyntax_future8.py and badsyntax_future9.py in the diff?
Doing a "cvs add" only results in "
Lib/test/badsyntax_future8.py is a new entry, no comparison
available")
msg43757 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-12-13 21:47
Logged In: YES 
user_id=33168

Walter, I didn't get a mail from SF either.  After you do a
cvs add, you need to use -N to cvs diff.  For example, cvs
diff -N new_file_added_to_cvs_but_not_committed.  If you
look carefully, you can see this in the patch on the diff
line for each file.  I'll take a look at the patch.
msg43758 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-12-13 22:46
Logged In: YES 
user_id=33168

Looked good to me, test_future_pyunit.diff checked in as:
 * Lib/test/badsyntax_future3.py 1.2
 * Lib/test/badsyntax_future4.py 1.2
 * Lib/test/badsyntax_future5.py 1.2
 * Lib/test/badsyntax_future6.py 1.2
 * Lib/test/badsyntax_future7.py 1.2
 * Lib/test/badsyntax_future8.py 1.1
 * Lib/test/badsyntax_future9.py 1.1
 * Lib/test/test_future.py 1.7
 * Lib/test/test_future1.py 1.3
 * Lib/test/test_future2.py 1.2
 * Lib/test/output/test_future 1.4
msg43759 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-12-18 23:49
Logged In: YES 
user_id=89016

Here's the next one: test_binascii.py. Code coverage in
binascii.c is at 92% (could be improved by enhancing
test_binhex.py).
msg43760 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-03-13 20:26
Logged In: YES 
user_id=80475

Okay, this one is fine.
msg43761 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-03-15 12:17
Logged In: YES 
user_id=89016

Checked in as:
Lib/test/output/test_binascii delete
Lib/test/test_binascii.py 1.17
msg43762 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-04-03 11:06
Logged In: YES 
user_id=89016

The attached test_dict.py moves the dict tests from 
test_types.py to a new PyUnit test script. Code coverage for 
dictobject.c is at 90.76% (up from 89.51%)
msg43763 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-05-20 16:03
Logged In: YES 
user_id=80475

test_dict is fine.

Consider beefing up the tests for update().  As of Py2.4, it
now takes all the same argument possibilites as dict():
   
     d.update(a=1, b=2)
     d.update([('a', 1), ('b', 2)])

Also, try to link in:
       from test_userdict import TestMappingProtocol

This was supposed to provide tests common to all mappings.
   
msg43764 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-05-25 19:32
Logged In: YES 
user_id=89016

Merging test_dict and test_userdict revealed a difference
between dict and UserDict.UserDict:

>>> import UserDict
>>> d = UserDict.UserDict()
>>> d.update(None)
>>> d
{}
>>> d = {}
>>> d.update(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: iteration over non-sequence

Should we do anything about this?
msg43765 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-05-25 20:21
Logged In: YES 
user_id=80475

IMO, it is fine as is.  I would be suprised if some code
were relying on UserDict.update(None) raising an exception.
 This sort of thing also comes up also in places like the
string and random modules whereever a function or method
with an optional argument gets wrapped by another function.
 The only way around this is to use *args and then you break
code that used the unfortunately named "dict" argument as a
keyword.

msg43766 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-05-25 20:29
Logged In: YES 
user_id=31435

Don't really care myself.  Would be nice if the docstring for 
dict.update() matched the new realities, though <wink>.

BTW, there is a reliable and conventional way to detect 
whether the 'dict' argument was passed to UserDict.update:  
use a unique marker object instead of the universally visible 
None.  Like

_marker = object()

at module level, and

    ...(self, dict=_marker, ...)

in the method defn.  That can't be fooled without deliberate 
intent to deceive.
msg43767 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-05-27 19:04
Logged In: YES 
user_id=89016

dict_diff.txt is a patch that tries to share tests between 
test_dict, test_userdict, test_os, test_shelve and 
test_weakref.
msg43768 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-05-28 20:59
Logged In: YES 
user_id=89016

OK, I've updated the docstring for dict.update() 
(Object/dictobject.c 2.160)
msg43769 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-05-28 23:02
Logged In: YES 
user_id=80475

Looks good.
msg43770 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-05-31 16:31
Logged In: YES 
user_id=89016

OK, checked in as:
Lib/test/mapping_tests.py 1.1
Lib/test/test_os.py 1.22
Lib/test/test_shelve.py 1.7
Lib/test/test_types.py 1.60
Lib/test/test_userdict.py 1.19
Lib/test/test_weakref.py 1.39
msg43771 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-18 13:23
Logged In: YES 
user_id=469548

Is there any problem with porting test scripts to doctest
instead of unittest? doctest is just perfect for test_unpack
(doctest version attached).

I've also ported test_zipfile to unittest (attached as well).
msg43772 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-08-18 19:29
Logged In: YES 
user_id=89016

doctest tests should be OK. The error tests in test_unpack 
can be done with PyUnit too, you either use

self.assertRaises(ValueError, eval, "a,b = Seq()")

or

try:
   a,b = Seq()
except ValueError:
   pass
else:
   self.fail("failed")

test_zipfile_unittest.py looks OK, but should of course be 
named test_zipfile.py when you check it in.

test_unpack_doctest.py gives me:
**********************************************
************************
Failure in example: a == 4 and b == 5 and c == 6
from line #14 of test.test_unpack_doctest.doctests 
in /home/walter/Achtung/Python-
test/dist/src/Lib/test/test_unpack_doctest.pyc
Expected: False
Got: True
**********************************************
************************
1 items had failures:
   1 of  28 in test.test_unpack_doctest.doctests
***Test Failed*** 1 failures.
Traceback (most recent call last):
  File "Lib/test/test_unpack_doctest.py", line 133, in ?
    test_main(verbose=True)
  File "Lib/test/test_unpack_doctest.py", line 130, in test_main
    test_support.run_doctest(test_unpack_doctest, verbose)
  File "/home/walter/Achtung/Python-
test/dist/src/Lib/test/test_support.py", line 318, in 
run_doctest
    raise TestFailed("%d of %d doctests failed" % (f, t))
test.test_support.TestFailed: 1 of 28 doctests failed
msg43773 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-19 15:14
Logged In: YES 
user_id=469548

Hum yes, that was me trying out how doctest fails. The
expected outcome should have been True. Can you try the
corrected version?

Test_zipfile has been checked in as rev 1.11.
msg43774 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-20 15:06
Logged In: YES 
user_id=469548

Another one: ported test_inspect to unittest and moved out
the inspect fodder out into two modules instead of using the
ugly imp.load_source and TESTFN. I also did a bit of
rearrangement so that the TestCase classes mostly match the
sections in the library docs.

I used a separate module (inspect_fodder2)  and class for
the decorators tests. Those are kind of small now, but I'll
check in http://python.org/sf/1011890 after this port and
let it grow without having to update test_getfunctions().
msg43775 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-08-20 16:39
Logged In: YES 
user_id=89016

Raymond, can you take a look at the patches?
msg43776 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-08-24 16:59
Logged In: YES 
user_id=80475

Walter, I'm afraid I don't have time for these right now.
msg43777 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-08-27 03:44
Logged In: YES 
user_id=357491

Just attached a new version of test__locale.  Since it is so small of a file 
and the change so drastic I just uploaded the whole file.

Only drawback is before the test kept testing all locales when there was 
a failure while my implementation stops at the first failure discovered.  
Don't know if it is important to test all locales.
msg43778 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-30 11:00
Logged In: YES 
user_id=469548

Brett: that's just one of the drawbacks of doing data-driven
testing with unittest. I don't think it's terribly
important, so the test is OK to me.
msg43779 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-09-07 02:32
Logged In: YES 
user_id=357491

OK, test__locale has been checked in.
msg43780 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-09-07 20:34
Logged In: YES 
user_id=89016

I'm getting the following error from the new test__locale:
test test__locale failed -- Traceback (most recent call last):
  File "/home/walter/Achtung/Python-codec-
small/dist/src/Lib/test/test__locale.py", line 37, in 
test_lc_numeric
    "%r != %r (%s); "
  File "/home/walter/Achtung/Python-codec-
small/dist/src/Lib/locale.py", line 363, in getlocale
    return _parse_localename(localename)
  File "/home/walter/Achtung/Python-codec-
small/dist/src/Lib/locale.py", line 278, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lv_LV

BTW, could someone have a look at Johannes' test_doctest 
and test_inspect patches?
msg43781 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-09-08 15:37
Logged In: YES 
user_id=469548

Yeah, bug #1023798 reported that and Brett fixed it.
msg43782 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-09-22 18:36
Logged In: YES 
user_id=89016

test_unpack_doctest.py looks good. Please check it in (as 
test_unpack.py)
msg43783 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-09-24 21:42
Logged In: YES 
user_id=469548

Checked in as rev 1.8 of test_unpack.py. Thanks for the review!
msg43784 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-12-06 21:35
Logged In: YES 
user_id=469548

Just reviewed my test_inspect conversion again and didn't
find any faults. Does anyone have the time to review it or
should I just check it in? http://python.org/sf/1011890 is
waiting on this conversion, so I'm aching to go. :)
msg43785 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-12-06 23:36
Logged In: YES 
user_id=89016

What I can say is that the test script passes on my box, so
if you're feeling confident just check it in. Now that
Python 2.4 is out the door a problem in the test shouldn't
be critical.
msg43786 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-12-12 16:20
Logged In: YES 
user_id=469548

Alright, checked in as rev 1.17 of test_inspect.py.
msg55267 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-08-24 19:03
The patches in here have long been applied, and the remaining converts
are handled using individual issues.
History
Date User Action Args
2022-04-10 16:08:44adminsetgithub: 38496
2007-08-24 19:03:13georg.brandlsetstatus: open -> closed
nosy: + georg.brandl
messages: + msg55267
2003-05-13 10:45:17doerwaltercreate