use pathlib.Path for directories and files
Some checks failed
Ruff / ruff (push) Waiting to run
Pytest / pytest (3.12) (push) Successful in 1m15s
Pytest / pytest (3.13) (push) Has been cancelled
Mypy / mypy (push) Successful in 1m13s
Pytest / pytest (3.14) (push) Has been cancelled

This commit is contained in:
Justus Kuhlmann 2026-03-23 16:15:55 +01:00
commit 8162758cec
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6
13 changed files with 137 additions and 125 deletions

View file

@ -5,21 +5,21 @@ from pathlib import Path
def test_init_folders(tmp_path: Path) -> None:
dataset_path = tmp_path / "test_dataset"
init.create(str(dataset_path))
init.create(dataset_path)
assert os.path.exists(str(dataset_path))
assert os.path.exists(str(dataset_path / "backlogger.db"))
def test_init_folders_no_tracker(tmp_path: Path) -> None:
dataset_path = tmp_path / "test_dataset"
init.create(str(dataset_path), tracker="None")
init.create(dataset_path, tracker="None")
assert os.path.exists(str(dataset_path))
assert os.path.exists(str(dataset_path / "backlogger.db"))
def test_init_config(tmp_path: Path) -> None:
dataset_path = tmp_path / "test_dataset"
init.create(str(dataset_path), tracker="None")
init.create(dataset_path, tracker="None")
config_path = dataset_path / ".corrlib"
assert os.path.exists(str(config_path))
from configparser import ConfigParser
@ -37,7 +37,7 @@ def test_init_config(tmp_path: Path) -> None:
def test_init_db(tmp_path: Path) -> None:
dataset_path = tmp_path / "test_dataset"
init.create(str(dataset_path))
init.create(dataset_path)
assert os.path.exists(str(dataset_path / "backlogger.db"))
conn = sql.connect(str(dataset_path / "backlogger.db"))
cursor = conn.cursor()

View file

@ -39,7 +39,7 @@ def test_set_config(tmp_path: Path) -> None:
value = "test_value"
# config is not yet available
tl.set_config(tmp_path, section, option, value)
config_path = os.path.join(tmp_path, '.corrlib')
config_path = tmp_path / '.corrlib'
config = ConfigParser()
config.read(config_path)
assert config.get('core', 'test_option', fallback="not the value") == "test_value"
@ -48,7 +48,7 @@ def test_set_config(tmp_path: Path) -> None:
option = "test_option2"
value = "test_value2"
tl.set_config(tmp_path, section, option, value)
config_path = os.path.join(tmp_path, '.corrlib')
config_path = tmp_path / '.corrlib'
config = ConfigParser()
config.read(config_path)
assert config.get('core', 'test_option2', fallback="not the value") == "test_value2"
@ -57,7 +57,7 @@ def test_set_config(tmp_path: Path) -> None:
option = "test_option2"
value = "test_value3"
tl.set_config(tmp_path, section, option, value)
config_path = os.path.join(tmp_path, '.corrlib')
config_path = tmp_path / '.corrlib'
config = ConfigParser()
config.read(config_path)
assert config.get('core', 'test_option2', fallback="not the value") == "test_value3"
@ -69,7 +69,7 @@ def test_get_db_file(tmp_path: Path) -> None:
value = "test_value"
# config is not yet available
tl.set_config(tmp_path, section, option, value)
assert tl.get_db_file(tmp_path) == "test_value"
assert tl.get_db_file(tmp_path) == Path("test_value")
def test_cache_enabled(tmp_path: Path) -> None: