[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] pygame unittests
- To: <pygame-users@xxxxxxxx>
- Subject: [pygame] pygame unittests
- From: "Nicholas Dudfield" <ndudfield@xxxxxxxxx>
- Date: Fri, 30 May 2008 15:36:13 +1000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 30 May 2008 01:36:30 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:references:in-reply-to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language; bh=sZN4wqDgxPN5rmh/yOE2LmZ/Gm3Q9Xn0HaZXuJ1Vp+I=; b=gkoK+3WwCzfkM/XTPhGbjOB0Ez3Zc8taWroMyuFB116tVr7+crKhqGlQVxa6c77lBsyxgwzc32dW4XLUyZvgW92KNiLjAfGRHnwGXuwlUGIP9zVvEvcmBCN1MR6B3Tj6T5CEod8rhVky4EP8pnxKTsfUYYZCsAflRbpyLv41KY8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:references:in-reply-to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language; b=YuODJk/pQPQpRn9HBGD30CEfAqew9xaMGLJvY4He7hVsX2GOSO4KqlLGrkFtDWt/lsUcPMnNmP1xvKizumUVY7bEf/kz0ES+BpmV7yXdCLLUFgNwDB2engwPB2WZ8r2y85yfbixJU/DJJoa7NPrlF+uD9aK66+Dbv6kMaExsWo8=
- In-reply-to: <003201c8c00c$1266d9d0$c41ea8c0@naomi>
- References: <20080527082511.GA1097@xxxxxxxxxxxxxxxxxxx> <003201c8c00c$1266d9d0$c41ea8c0@naomi>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- Thread-index: Aci/0wowYAjr6AhCQTuCkoVFYhYO/gAOBMEgAILlfFA=
Greetings all,
akalias here, your GSOC student with the Pygame Testing project.
One of the stated goals of my gsoc project is to have a really broad
coverage of tests. And in fact my first coding period was planned to be
spent on that. It's a fairly big task.
To that end I have been working on a unittest stub generator that uses
introspection to create stubs of tests automatically.
Eventually I want the stubber to be able to be used something like this:
gen_stubs.py --needed pygame.color >> color_test.py
That would append stubs for all units (callables) from pygame.color that are
not currently tested. To keep it simple, I would just append the stubs and
people can spend the two seconds manually placing them.
How would you know what functions aren't tested? An idea I am toying with is
to create a consitent naming scheme that we can all agree upon for the tests
(renaming existing tests) that makes it easy to determine which unit's are
already tested.
The idea would be to inspect a module and based upon the names of it's tests
determine which units(functions) are tested.
For example let's look at the method pygame.font.Font.get_ascent:
What information is needed?
pygame. N: All unittests are for pygame
font. N: The tests are categorized into files, eg font_test.py
Font. Y: is a class and unique namespace
get_ascent Y: what if there was pygame.font.get_ascent ?
eg.
class + description optionals separated by double underscore
Class__method__description
pygame.font.Font.get_ascent -> becomes
def test_Font__get_ascent(self)
pygame.font.get_ascent -> becomes
test_get_ascent(self)
test_get_ascent__attacks_when_cornered(self)
...
So for pygame.font.Font.get_ascent if there was existing tests that started
with "test_Font__get_ascent", the proposed utility would skip creating that
stub.
Issues
======
An issue with this naming scheme is methods prefixed or suffixed with
underscores.
If we are only aiming at public methods this is a non issue.
What "private" methods to test? What is the minimum coverage to aim for ?
(the scope of the stub generator is all that's under discussion)
What are peoples thoughts. Is this a path worth venturing down? It would
mean renaming existing tests.