Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

Commit 841e5b1

Browse files
committed
fix: fixed broken test for gpt-engineer.toml after renaming of config section
1 parent 2fd75d1 commit 841e5b1

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

gpt_engineer/core/project_config.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
44
The `gpt-engineer.toml` file is a TOML file that contains project-specific configuration used by the GPT Engineer CLI and gptengineer.app.
55
"""
6-
76
from dataclasses import asdict, dataclass, field
87
from pathlib import Path
98

@@ -12,15 +11,15 @@
1211
default_config_filename = "gpt-engineer.toml"
1312

1413
example_config = """
15-
[paths]
16-
base = "./frontend" # base directory to operate in (for monorepos)
17-
src = "./src" # source directory (under the base directory) from which context will be retrieved
18-
1914
[run]
2015
build = "npm run build"
2116
test = "npm run test"
2217
lint = "quick-lint-js"
2318
19+
[paths]
20+
base = "./frontend" # base directory to operate in (for monorepos)
21+
src = "./src" # source directory (under the base directory) from which context will be retrieved
22+
2423
[gptengineer-app] # this namespace is used for gptengineer.app, may be used for internal experiments
2524
project_id = "..."
2625
@@ -33,9 +32,9 @@
3332

3433

3534
@dataclass
36-
class _ProjectConfig:
37-
base_dir: str | None = None
38-
src_dir: str | None = None
35+
class _PathsConfig:
36+
base: str | None = None
37+
src: str | None = None
3938

4039

4140
@dataclass
@@ -74,7 +73,7 @@ def filter_none(d: dict) -> dict:
7473
class Config:
7574
"""Configuration for the GPT Engineer CLI and gptengineer.app via `gpt-engineer.toml`."""
7675

77-
project: _ProjectConfig = field(default_factory=_ProjectConfig)
76+
paths: _PathsConfig = field(default_factory=_PathsConfig)
7877
run: _RunConfig = field(default_factory=_RunConfig)
7978
gptengineer_app: _GptEngineerAppConfig | None = None
8079

@@ -87,8 +86,8 @@ def from_toml(cls, config_file: Path | str):
8786

8887
@classmethod
8988
def from_dict(cls, config_dict: dict):
90-
project = _ProjectConfig(**config_dict.get("project", {}))
9189
run = _RunConfig(**config_dict.get("run", {}))
90+
paths = _PathsConfig(**config_dict.get("paths", {}))
9291

9392
# load optional gptengineer-app section
9493
gptengineer_app_dict = config_dict.get("gptengineer-app", {})
@@ -107,7 +106,7 @@ def from_dict(cls, config_dict: dict):
107106
or None,
108107
)
109108

110-
return cls(project=project, run=run, gptengineer_app=gptengineer_app)
109+
return cls(paths=paths, run=run, gptengineer_app=gptengineer_app)
111110

112111
def to_dict(self) -> dict:
113112
d = asdict(self)

tests/test_project_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def test_config_load():
1919
# load the config from the file
2020
config = Config.from_toml(f.name)
2121

22-
assert config.project.base_dir == "./frontend"
23-
assert config.project.src_dir == "./src"
22+
assert config.paths.base == "./frontend"
23+
assert config.paths.src == "./src"
2424
assert config.run.build == "npm run build"
2525
assert config.run.test == "npm run test"
2626
assert config.run.lint == "quick-lint-js"
@@ -44,7 +44,7 @@ def test_config_load():
4444

4545
def test_config_defaults():
4646
config = Config()
47-
assert config.project.base_dir is None
47+
assert config.paths.base is None
4848
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
4949
config.to_toml(f.name)
5050

0 commit comments

Comments
 (0)