On 12/08/11 02:30, Jacek Generowicz wrote:
>
> 3. Would you have any general advice on how one might approach
> providing a QuickCheck clone on top of pytest?
From your description of QuickCheck, I suggest a modular approach where you do
not implement QuickCheck inside py.test, but instead use py.test as a tool that
performs only part of the work.
Consider this approach:
- QuickCheck reads the definition of the properties.
- It generates the random test data.
- It writes a python file that contains tests suitable for py.test to run.
- It invokes py.test to actually run the tests. Use a py.test plugin to report
test statuses in a form that QuickCheck can easily read. (I can show you an
example if you need help with this.)
- QuickCheck reads the report file to find out how the tests worked. It then
iterates as you described in your original email.
As you described it, QuickCheck has a fundamentally different view of tests
than py.test does. Instead of trying to force the QuickCheck model into the
py.test structure, this alternative uses a control program to implement the
main structure of QuickCheck. That control program uses py.test as a
subroutine to perform the part that py.test is really good at.
You might import pytest and call functions in it, or you might do something as
simple as os.system("py.test tmp.py")
Mark S.
_______________________________________________
py-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/py-dev