Skip to content

Resume a stopped test session #8673

Answered by nicoddemus
AndrewFalanga asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @AndrewFalanga,

Currently there's no native support for that, but the OP in the message comments that he managed to write a simple plugin that does this as he intends.

I suggest to follow the same idea, should be relatively simple, here's a quick outline:

  1. Implement pytest_runtest_protocol as a hookwrapper: when the wrapper "ends", it means the test ran to completion, so record the test node id in a specific file on disk.
  2. When the test session finishes (implement pytest_sessionfinish), delete that file from disk to indicate a complete run.
  3. When running for the second time, implement pytest_collection_modifyitems, which then should see if the file exists: if it does, it should remove th…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@AndrewFalanga
Comment options

@AndrewFalanga
Comment options

@graingert
Comment options

@AndrewFalanga
Comment options

@graingert
Comment options

Answer selected by AndrewFalanga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants