smarie / python-pytest-steps

A tiny package to ease the creation of test steps with shared intermediate results/state.
https://smarie.github.io/python-pytest-steps/
BSD 3-Clause "New" or "Revised" License
57 stars 5 forks source link

Pytest marks on generator test step? #42

Open dimko opened 3 years ago

dimko commented 3 years ago

Hello, is it possible somehow when using generator steps to mark a specific step, for example, with the @pytest.mark.xfail, skip or other marks? Thank you in advance.

smarie commented 3 years ago

Thanks @dimko for this feedback ! In the current version it is not possible to mark specific steps.

However you can use pytest.xfail() and pytest.skip() directly in the test code instead, this works fine (see documentation).

In the future, we could imagine to support usage of pytest.param(..., marks=) around each step name such as :

@test_steps('step_a', pytest.param('step_b', marks=pytest.mark.foo), 'step_c')
def test_blah():
    ...

I guess that this would be the most natural way to declare marks on specific steps.

dimko commented 3 years ago

Thanks @smarie!