[TIP] resume an interrupted pytest test run

Wouter Overmeire lodagro at gmail.com
Mon Jan 29 04:54:38 PST 2018


So I went the plugin-route. First time for me, although I already used
several of the hooks through conftest.py, writing a plugin is new. Luckily
pytest has nice documentation.

I have something basic running now. Save nodeids of all test tests to be
run (pytest_collection_modifyitems) and test by test store the nodeids
(pytest_runtest_makereport) of the completed tests. When restarting pytest
using plugin specific flag the already completed tests will be marked
*pytest.mark.skip*.

Two questions:
- What is *pytest*-way of stopping a run from within a plugin and informing
the user why? I now raise an exception, which is show as an INTERNALERROR.
- How to handle reporting? Is there a way to save report per test, so while
running and not postpone report generation up to the end?


2018-01-24 15:37 GMT+01:00 Bruno Oliveira <nicoddemus at gmail.com>:

> Hi Wouter,
>
> Currently there's no support for that, but I imagine to implement a plugin
> to do that should be relatively easy if you are inclined to. :)
>
> If you go with the route of implementing a plugin, feel free to ask for
> advice on IRC[1] or creating an issue with your questions in the pytest bug
> tracker [2].
>
> Cheers,
> Bruno
>
> [1] https://docs.pytest.org/en/latest/contact.html
> [2] https://github.com/pytest-dev/pytest/issues
>
> On Wed, Jan 24, 2018 at 12:10 PM Wouter Overmeire <lodagro at gmail.com>
> wrote:
>
>> Hi,
>>
>> How can I resume an interrupted pytest test run?
>>
>> Suppose using command line arguments I select a number of tests to be run
>> by pytest. The tests take a while and in the middle of the run there is an
>> issue (for example a power outage) and pytest was stopped. Is it possible
>> to resume an interrupted run?
>>
>> The idea is not to rerun the failed tests, but to run only those tests
>> that did not run in the first run.
>>
>> Wouter
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20180129/40181dc4/attachment.html>


More information about the testing-in-python mailing list