Skip to content

Commit 4731e04

Browse files
committed
Fix issue with key used in config from pyproject.toml
1 parent 2161ded commit 4731e04

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/render_engine_cli/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def load_config(self, config_file: str = CONFIG_FILE_NAME):
4848
try:
4949
with open(config_file) as stored_config_file:
5050
try:
51-
stored_config = toml.load(stored_config_file).get("tool.render-engine", {}).get("cli", {})
51+
stored_config = (
52+
toml.load(stored_config_file).get("tool", {}).get("render-engine", {}).get("cli", {})
53+
)
5254
except TomlDecodeError as exc:
5355
click.echo(f"Encountered an error while parsing {config_file} - {exc}.")
5456
else:

tests/test_cli.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import frontmatter
22
import pytest
3-
import toml
43
from render_engine import Collection, Page, Site
54

65
from render_engine_cli.utils import (
@@ -106,12 +105,14 @@ def test_split_args_error_handling():
106105

107106
def test_config_loading_with_valid_config(tmp_path, monkeypatch):
108107
"""Tests config loading from pyproject.toml (2025.5.1b1 feature)"""
109-
config_content = {
110-
"tool.render-engine": {"cli": {"module": "myapp", "site": "MySite", "collection": "MyCollection"}}
111-
}
112-
108+
config_content = """
109+
[tool.render-engine.cli]
110+
module = "myapp"
111+
site = "MySite"
112+
collection = "MyCollection"
113+
"""
113114
config_file = tmp_path / "pyproject.toml"
114-
config_file.write_text(toml.dumps(config_content))
115+
config_file.write_text(config_content)
115116

116117
# Change to temp directory for config loading test
117118
monkeypatch.chdir(tmp_path)

0 commit comments

Comments
 (0)