pytest icon indicating copy to clipboard operation
pytest copied to clipboard

markers: support new ident '|'

Open hfudev opened this issue 1 year ago • 2 comments

Hi pytest team!

While I'm developing a new feature to the pytest-embedded plugin, I realize that | is not allowed in pytest markers. (Inside the pytest-embedded plugin, I'm using | as a separator.)

ERROR: Wrong expression passed to '-m': esp32|esp32p4: at column 6: unexpected character "|"

I'm wondering the reason behind this. so I'm opening this PR.

Thanks! Hanxi

EDIT

actually use | is better than : (which is supported now)

I didn't find a way to define a marker with : inside, since everything past after the first : will be considered as a optional description.

so pytest -m "a:b" will try to search a marker called a:b, but if I put

[pytest]
  a:b: test

only marker a will be added

if we support |, we could define with

[pytest]
  a|b: test

(tested with --strict-marker)

hfudev avatar Apr 30 '24 11:04 hfudev

The test cases are failing, I'll fix them once the idea got approved by you.

hfudev avatar Apr 30 '24 11:04 hfudev

It's unclear to me what exactly this solves

Marker names currently are limited to identifiers

The pipe is commonly used as logic operator in python and im under the impression that using those like that can be costly later

RonnyPfannschmidt avatar Apr 30 '24 13:04 RonnyPfannschmidt

closing due to lack of feedback, im happy to reopen once the discussion happens

RonnyPfannschmidt avatar Jun 19 '24 09:06 RonnyPfannschmidt