While pytest in tox.ini is explicitly set to be 3.3.2, in Fedora 31
we are about to update to a newer version of pytest.
In order to be able to test babel, we need pytest 4.3 support.
This adds support for pytest 4.3 without breaking support for 3.3.2.
def pytest_generate_tests(metafunc):
- if hasattr(metafunc.function, "all_locales"):
- from babel.localedata import locale_identifiers
- metafunc.parametrize("locale", list(locale_identifiers()))
+ if hasattr(metafunc.function, "pytestmark"):
+ for mark in metafunc.function.pytestmark:
+ if mark.name == "all_locales":
+ from babel.localedata import locale_identifiers
+ metafunc.parametrize("locale", list(locale_identifiers()))
+ break