Open TauPan opened 3 years ago
Ooo, this is a good idea! Thank you :)
And I'm glad you find it useful, too. I use it so much that I have a couple Live Templates in PyCharm to quickly add module-level and function-level marks for it :P
monly
for module-level, expanding to pytestmark = __import__('pytest').mark.only
only
for function-level decorator, expanding to @getattr(__import__('pytest').mark, 'only')
(__import__
lets me use them anywhere, without having to have pytest
imported. getattr
is necessary for the decorator form, which, until PEP 614 was released in Python 3.9, does not allow dotted paths after a function call. They're both surrounded by some ugly-ass comments that are really hard to miss in git diffs, so I don't accidentally commit them)
Which is really easy:
But I'm too lazy to write more than this example right now, just wanted to point this out.
And I wanted to say thanks because this is really the easiest way if I have a test with bucketloads of data from fixtures testing many cases and I want to temporarily concentrate on a single one or a subset of those cases.