[Python-Dev] Conventions for functional tests, PyUnit?

Walter Dörwald walter at livinglogic.de
Tue Dec 9 16:20:01 EST 2003

John J Lee wrote:

> On Sun, 7 Dec 2003, Raymond Hettinger wrote:
> [...]
>>Ideally, all repeatable, self verifying tests should be coded using the
>>unittest module and placed in Lib/test.
> [...]
>>Some of tests in the module itself are being left intact for various
>>reasons.  For instance, the random module still has a few tests that
>>need a human eye to authenticate.  Some, like the ones in urllib2 are
>>normally only run when someone updates the module -- they should be left
>>in for convenience but could also have a counterpart in Lib/test so long
>>as the test were marked to run only when -u network was enabled.  As you
> (Ah, hadn't seen the test runner script, so didn't know about -u network,
> thanks.)
> OK, so I can PyUnit-ize the urllib2 functional tests (but leave them there
> so functional tests can conveniently be run separately), and link them to
> Lib/test (so all self-verifying tests get run there).

Personally I'd prefer all tests to be in the test scripts. Otherwise
they clutter up the module without serving any real purpose (except
maybe as documentation).

> One problem, though: doesn't putting functional tests in Lib/test throw
> off Walter Dorwald's unit test coverage numbers?  Perhaps there should be
> a 'functional' resource for test_support.use_resources (so the tests can
> be run with -uall, -functional for coverage measurements)?

What exactly do you mean with 'functional' tests? We certainly don't
need non-functional tests! ;) And why would additional test scripts
throw off the coverage numbers?

    Walter Dörwald

More information about the Python-Dev mailing list