pytest-picked
pytest-picked copied to clipboard
run individual tests where code has changed
pytest-picked looks great, but I often have 10s or even hundreds of tests in a single file.
It would be great therefore if this library could pick specific test rather than whole files.
I imagine this would be possible by introspecting git diff or similar.
I think this would be a great feature too! PRs are always welcome! :)
This seems like a really cool project 👏
I just wanted to say that this seems like a great issue, and I believe this feature could potentially open up a lot of other really cool possibilities. For example, I would love to try and integrate this with something like pre-commit to automatically run a small subset of unit tests before committing code. I think that could make for a really great general workflow.
With this in mind, I just wanted to chime in and ask a follow up question related to this issue: do you think it would be possible to not only select tests that tie to relevant changed code, but try to make sense of how how many steps are taken before the affected diffed code is run?
In other words, instead of limiting the scope to any test that touches the changed code would it be possible to optionally limit the scope even further, to tests that call a changed function directly? I'm hoping this could potentially prevent you from running larger integration tests every time.
This might be naïve, but if it was possible to just map how many n steps a test made before getting to relevant changed code, perhaps the feature could be implemented as a setting where you could specify how many maximum n steps to allow.
Do you see this as within the scope of the project and/or as doable technically?
@samuelcolvin is this along the lines of what you were thinking when you created this? I'll create a separate issue otherwise.
EDIT: After reviewing the code and what this would take, I'll self label this as out of scope 👍
+1 this would simile awesome feature. Simile reason for use case, sometimes test file is large or tests can some time to run, so getting it down to run just the tests affected by diff would be great