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.

The -k expression works with double quotes but not single quotes

See original GitHub issue

When using single quotes and trying a conjunction of expressions: -k 'vet_a and vet_a' I get the error message: ERROR: file or directory not found: and

I finally tried double quotes and it worked.

Note: the docs and -h help text using single quotes in the -k examples so at least update those as a quick workaround…

pytest 6.2.4 Windows 8.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bluetechcommented, Dec 23, 2021

On unix systems, ' is the better option because it avoids shell interpolation.

On windows systems, looks like the correct quoting is double quotes (at least according to a random Stack Overflow answer…).

(edit: NOTE: see comments below) So it would be nice I suppose for pytest to use double quotes on windows and single quotes everywhere else in its help text for -k (and any other options which use quotes in their examples, if any).

PR welcome!

0reactions
dolfinuscommented, Mar 24, 2022

-h output is set here: https://github.com/pytest-dev/pytest/blob/176d2d7b4e21b19fb08afdb3f9db61495eff5647/src/_pytest/mark/__init__.py#L86

Also, doesn’t -m option have the same behavior about quotes as -k?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The real difference between 'single quotes' and “double ...
Either two double "" or single '' quote marks next to each other can represent an empty string containing no characters at all....
Read more >
“Double Quotes” vs 'Single Quotes' vs `Backticks` in ...
The same theory applies to double quotes, and you have to use a backslash to escape any double quotes inside double quotes.
Read more >
comparisions only work enclosed by single quotes, not ...
Maybe am I missing something obvious, but it looks like in some case string enclosed by double quotes in CEL expressions create compilation ......
Read more >
Difference Between Single and Double Quotes in Shell Script ...
Double quotes are similar to single quotes except that it allows the shell to interpret dollar sign ($), backtick(`), backslash(\) and ...
Read more >
Difference between single quotes and double ... - Stack Overflow
You'll want to use single quotes where you want double quotes to appear inside the string (e.g. for html attributes) without having to...
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