conftest.py 526 B

123456789101112131415161718
  1. import os
  2. import pytest
  3. @pytest.fixture
  4. def os_environ(monkeypatch):
  5. mock_environ = dict(os.environ)
  6. monkeypatch.setattr(os, 'environ', mock_environ)
  7. return mock_environ
  8. def pytest_generate_tests(metafunc):
  9. if hasattr(metafunc.function, "pytestmark"):
  10. for mark in metafunc.function.pytestmark:
  11. if mark.name == "all_locales":
  12. from babel.localedata import locale_identifiers
  13. metafunc.parametrize("locale", list(locale_identifiers()))
  14. break