From 3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 3 Feb 2021 19:17:00 -0500 Subject: New upstream version 8.1.2. --- tests/conftest.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tests/conftest.py') 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") -- cgit v1.2.3