aboutsummaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py24
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")