summaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
blob: 56fe8bdf9cc0e3dd177c5009b64f6243b6ca84ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import pytest


@pytest.fixture(autouse=True)
def ensure_chdir():
    old_dir = os.getcwd()
    try:
        yield
    finally:
        os.chdir(old_dir)


@pytest.fixture(scope="module")
def test_dir():
    """
    Absolute path to the directory with the tests.
    """
    return os.path.abspath(os.path.dirname(__file__))


@pytest.fixture(scope="session")
def default_locale() -> str:
    return os.environ.get("NIKOLA_LOCALE_DEFAULT", "en")