why pytest.mark.usefixtures? (intermediate) anthony explains #098

why pytest.mark.usefixtures? (intermediate) anthony explains #098

anthonywritescode

3 года назад

5,919 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Grzegorz Ryznar
Grzegorz Ryznar - 16.03.2022 01:27

Hello Anthony. I've got question related to fixtures and to xunit-style like setup fixtures (setup_class, setup_method, etc).

@pytest.fixture()
def dummy_fixture():
...

class TestClass:
@classmethod
def setup_class(cls): <- passing dummy_fixture as an argument is not possible
....

def setup_method(self): <- passing dummy_fixture here as argument is not possible too
....


Do you know why pytest does not support this (technical reason, conceptual)? I know that it can be obtained via autouse and proper scope, but using xunit like fixtures is much more explici and it would be great if they will support fixtues.

I would greatly appreciate your response!

Ответить
pmav99
pmav99 - 24.09.2020 10:42

How about a video on the pytest "shenanigans"? Although I doubt it is going to be such a short one)))

Ответить