diff --git a/tests/conftest.py b/tests/conftest.py index bf630c4..18b7021 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,7 +15,5 @@ def fixtures_dir(): @pytest.fixture(autouse=True) def temporary_logs_dir(monkeypatch, tmp_path): - def temp_user_log_dir(*args, **kwargs): - return tmp_path - - monkeypatch.setattr(platformdirs, "user_log_dir", temp_user_log_dir) + monkeypatch.setattr("bw_simapro_csv.main.user_log_dir", lambda *args, **kwargs: tmp_path) + yield tmp_path diff --git a/tests/test_header.py b/tests/test_header.py index dfd7c13..3402112 100644 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -1,9 +1,15 @@ from datetime import datetime +from pathlib import Path from bw_simapro_csv import SimaProCSV from bw_simapro_csv.header import SimaProCSVType +def test_log_file_patching(fixtures_dir: Path, temporary_logs_dir: Path): + obj = SimaProCSV(fixtures_dir / "allocation.csv") + assert str(temporary_logs_dir) in str(obj.logs_dir) + + def test_basic_header_extraction(fixtures_dir): obj = SimaProCSV(fixtures_dir / "allocation.csv") assert obj.header == {