pytest-dev / pytest-dev/pytest
Allow multiple use of `-m` option
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
Looks like when we use -m more than once, only the last entry is used (on Linux/macOS, at least, haven't tested on Windows).
Ex:
pytest test_me.py -m x -m z
pytest test_me.py -m 'x or y' -m z
Both those examples will only run those tests with the mark z, b/c that's the last -m argument passed in. If we reverse the order, then the other marked tests will run.
Nowadays it's common for command line programs to take in multiple of the same arguments and they usually work in an additive way.
In this case, multiple -m usage would mean an or:
-m x -m z=-m 'x or z'-m 'x or y' -m z=-m '(x or y) or z'
If this is not possible, then fail when using -m multiple times.
My use case is that I have a bash script that adds markers depending on arguments and environment variables and took me a while to figure this out.. having early failure would have saved a lot of time.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two command examples from the issue and tracing how repeated -m arguments are handled. Add coverage for combining multiple markers with OR, or for the requested early failure if additive behavior is not possible; done means the behavior is explicit and no longer silently uses only the last argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100