File: conftest.py

package info (click to toggle)
python-babel 2.8.0%2Bdfsg.1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 194,932 kB
  • sloc: xml: 2,069,184; python: 12,072; makefile: 197; sh: 36
file content (18 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import pytest


@pytest.fixture
def os_environ(monkeypatch):
    mock_environ = dict(os.environ)
    monkeypatch.setattr(os, 'environ', mock_environ)
    return mock_environ


def pytest_generate_tests(metafunc):
    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