serhii.net

In the middle of the desert you can say anything you want

23 Feb 2022

pytest sharing data between test files through pytest.configure

python - How to share global variables between tests? - Stack Overflow:

import pytest

def pytest_configure():
    pytest.my_symbol = MySymbol()

allows then to use pytest.my_symbol elsewhere, it’s a part of global pytest namespace now.

That said, fixtures are still the preferred way it seems (todo - how are they shared between files?)

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus