diff options
| author | 2021-02-03 19:17:00 -0500 | |
|---|---|---|
| committer | 2021-02-03 19:17:00 -0500 | |
| commit | 3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 (patch) | |
| tree | a7cf56282e54f05785243bc1e903d6594f2c06ba /tests/conftest.py | |
| parent | 787b97a4cb24330b36f11297c6d3a7a473a907d0 (diff) | |
New upstream version 8.1.2.upstream/8.1.2
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index fbb09c8..56fe8bd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,24 @@ import os import pytest -@pytest.yield_fixture(autouse=True) + +@pytest.fixture(autouse=True) def ensure_chdir(): - x = os.getcwd() - yield - os.chdir(x) + 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") |
