From aec3c628fb6196dd2d3cbfba84fe70a66c727833 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 1 May 2026 12:46:35 +0200 Subject: fix: clean up config module - remove self-import pattern, pass path explicitly in tests --- tests/test_config.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/test_config.py b/tests/test_config.py index 6b3417f..f19bfdd 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,29 +1,25 @@ -import pytest from pathlib import Path -import tempfile, os from core.config import Config, DEFAULT_CONFIG_PATH -def test_config_loads_defaults_when_missing(tmp_path, monkeypatch): - monkeypatch.setattr("core.config.DEFAULT_CONFIG_PATH", tmp_path / "config.toml") - cfg = Config.load() +def test_config_loads_defaults_when_missing(tmp_path): + path = tmp_path / "config.toml" + cfg = Config.load(path) assert cfg.blog_repo == "" assert cfg.transart_script == "/home/danix/bin/transart.py" assert cfg.typora_bin == "typora" -def test_config_round_trips(tmp_path, monkeypatch): +def test_config_round_trips(tmp_path): path = tmp_path / "config.toml" - monkeypatch.setattr("core.config.DEFAULT_CONFIG_PATH", path) cfg = Config(blog_repo="/some/path", transart_script="/bin/x", typora_bin="typora") - cfg.save() - loaded = Config.load() + cfg.save(path) + loaded = Config.load(path) assert loaded.blog_repo == "/some/path" -def test_config_is_complete_false_when_blog_repo_empty(tmp_path, monkeypatch): - monkeypatch.setattr("core.config.DEFAULT_CONFIG_PATH", tmp_path / "config.toml") - cfg = Config.load() +def test_config_is_complete_false_when_blog_repo_empty(tmp_path): + path = tmp_path / "config.toml" + cfg = Config.load(path) assert cfg.is_complete() is False -def test_config_is_complete_true_when_all_set(tmp_path, monkeypatch): - monkeypatch.setattr("core.config.DEFAULT_CONFIG_PATH", tmp_path / "config.toml") +def test_config_is_complete_true_when_all_set(): cfg = Config(blog_repo="/some/repo", transart_script="/bin/x", typora_bin="typora") assert cfg.is_complete() is True -- cgit v1.2.3