From: Miro HronĨok Date: Thu, 14 Mar 2019 18:54:42 +0000 (+0100) Subject: Fix conftest.py compatibility with pytest 4.3 X-Git-Tag: v2.7.0~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b33c95530b0d5e717fd36f5b775137c83c3bcf67;p=thirdparty%2Fbabel.git Fix conftest.py compatibility with pytest 4.3 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. --- diff --git a/tests/conftest.py b/tests/conftest.py index be93b2be..5b14b1ca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,6 +10,9 @@ def os_environ(monkeypatch): 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