question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow multiple use of `-m` option

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
RonnyPfannschmidtcommented, May 22, 2020

@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

1reaction
RonnyPfannschmidtcommented, May 22, 2020

Both should use append, both need a reset arg, we should evaluate the expressions separately

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found