[TIP] how to access the test discovery protocol programmatically in pytest
Ronny Pfannschmidt
Ronny.Pfannschmidt at gmx.de
Wed Oct 3 10:54:04 PDT 2012
Hi Chris,
you can just do what the terminal plugin does
the pytest_collection_finish(session) hook can access session.items
session.items is are the actual tests (i.e. the leaves of the collection
tree)
note that for finding cases where collection fails you will also need
the pytest_collectreport(report) hook
if you use pytest.main you can just pass in a object with methods that
follow the call signatures i have (can be a module or a instance)
-- Ronny
On 10/02/2012 10:29 PM, Pella,Chris wrote:
> We are calling pytest.main to run tests from our own home-grown
> framework. I understand this is supposed to be an api-less framework,
> but is there a way to access the equivalent results to running py.test
> –collectonly other than redirecting the output to a file and reading the
> file?
>
> Thanks,
>
> Chris
>
> The information contained in this electronic mail transmission
> may be privileged and confidential, and therefore, protected
> from disclosure. If you have received this communication in
> error, please notify us immediately by replying to this
> message and deleting it from your computer without copying
> or disclosing it.
>
>
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
More information about the testing-in-python
mailing list