[Python-Dev] Really dumb test observation

Skip Montanaro skip@mojam.com (Skip Montanaro)
Tue, 11 Jul 2000 22:59:28 -0500 (CDT)


I was working on Python module coverage test generation tonight (sample
results in the morning!).  I noticed that coverage of the random module
wasn't very good (30%-40% lines executed).  There was no regression test
case for that module, but I saw there was a random.test() function, so I
created the following simple regression test:

    import random
    random.test()

Statement coverage jumped immediately to nearly 90%.

Seems to me that if a module defines a test() function and we have no
regression test file for the module, that the above trick may increase code
coverage significantly.

(Actually, perhaps in these cases the test() function and related bits
should be copied to the relevant regression test file to avoid invisible
coupling between the module and its regression test output.)

Skip