aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCody Logan <cody@lokken.dev>2023-11-15 09:41:06 -0800
committerCody Logan <cody@lokken.dev>2023-11-15 09:41:06 -0800
commit5ff82fcacf80f38395edc4f83fdc42b9670d87fd (patch)
treea904017d6cd741eb876ce2ab7ad772483c59e05d /tests
parentc459e3bb9553e31224348b055aaaec3a567613bb (diff)
downloadwikiget-5ff82fcacf80f38395edc4f83fdc42b9670d87fd.tar.gz
wikiget-5ff82fcacf80f38395edc4f83fdc42b9670d87fd.zip
Use monkeypatch.chdir instead of os.chdir
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 3eb99cd..6088029 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -17,7 +17,6 @@
"""Define fixtures used across all tests in this folder."""
-from os import chdir
from pathlib import Path
import pytest
@@ -37,14 +36,18 @@ TEST_FILE_BYTES = (
)
-@pytest.fixture(autouse=True, scope="session")
-def _chdir_to_tmp_dir(tmp_path_factory: pytest.TempPathFactory) -> None:
+@pytest.fixture(autouse=True)
+def _chdir_to_tmp_dir(
+ tmp_path_factory: pytest.TempPathFactory, monkeypatch: pytest.MonkeyPatch
+) -> None:
"""Change to the base temporary directory before running tests.
:param tmp_path_factory: temporary path generator
:type tmp_path_factory: pytest.TempPathFactory
+ :param tmp_path_factory: Pytest monkeypatch helper
+ :type tmp_path_factory: pytest.MonkeyPatch
"""
- chdir(tmp_path_factory.getbasetemp())
+ monkeypatch.chdir(tmp_path_factory.getbasetemp())
@pytest.fixture(scope="session")