[TIP] py.test best way to generate a *lot* of tests

Thijs Engels thijs at buckazoids.com
Wed Jun 13 06:22:14 PDT 2012


I am currently experimenting with py.test to validate result which are
written to a database. Hence more functional testing than unittesting.
The database interface is completely dealt with via SQLAlchemy, hence
the tests merely have to iterate over all the objects.

The issue I am currently running into is the fact that the output
consists of sessions, which in itself contains specific data for this
session. The amount of data (objects) is however different per session.
Which if I understand correctly need to be extracted to create a full
list (of objects) for the parametrization. This seems fine if were just
these sessions and their child, but there are more levels, and worse
there are thousands of objects.

I do realize I might be using this test framework for something it was
not really meant for, but is it indeed only possible to have py.test go
through all these objects if the first step is creating (huge) lists
with the actual objects to be fed into the parametrize function?


More information about the testing-in-python mailing list