Allow multiple use of `-m` option
See original GitHub issueLooks 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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Performing Commits More Quickly with the "-m" and "-a" Options
I could use "git add" and then "git commit", but let's use the "-a" option to do it all in one command. I'll...
Read more >python - What is the purpose of the -m switch? - Stack Overflow
Python allows modules to be uniquely identified in two distinct ways: modulename and filename. In general, modules are identified by modulename in Python...
Read more >git-commit Documentation - Git
Use the given <msg> as the commit message. If multiple -m options are given, their values are concatenated as separate paragraphs. The -m...
Read more >Preprocessor Options (Using the GNU Compiler Collection ...
An -MT option sets the target to be exactly the string you specify. If you want multiple targets, you can specify them as...
Read more >How to Create a Directory in Linux with mkdir Command ...
Building a structure with multiple subdirectories using mkdir requires adding the -p option. This makes sure that mkdir adds any missing parent ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@symonk instead of string joining, i would like to go the safe route of simply running a for loop over the expressions requiring an
all
,reset options would clear the marker/keyword lists, so they could restart in case of addopts/automation putting in things one wants to ignore
Both should use append, both need a reset arg, we should evaluate the expressions separately