Skip to content

Commit

Permalink
add project_dir parameter to fire_arg_parsed_event
Browse files Browse the repository at this point in the history
  • Loading branch information
tsv1 committed Jan 5, 2025
1 parent f5b42c1 commit 1d4992b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions tests/plugins/skipper/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ def tmp_dir(tmp_path: Path) -> Path:
async def fire_arg_parsed_event(dispatcher: Dispatcher, *,
file_or_dir: Optional[List[str]] = None,
ignore: Optional[List[str]] = None,
subject: Optional[str] = None) -> None:
await dispatcher.fire(ConfigLoadedEvent(Path(), Config))
subject: Optional[str] = None,
project_dir: Optional[Path] = None) -> None:
project_dir_ = project_dir if project_dir else Config.project_dir

class CustomConfig(Config):
project_dir = project_dir_

await dispatcher.fire(ConfigLoadedEvent(Path(), CustomConfig))

arg_parse_event = ArgParseEvent(ArgumentParser())
await dispatcher.fire(arg_parse_event)
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/skipper/test_skipper_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async def test_select_rel_dir(dirname: str, *, dispatcher: Dispatcher, tmp_dir:
]

rel_path = tmp_dir.relative_to(getcwd())
await fire_arg_parsed_event(dispatcher, file_or_dir=[
await fire_arg_parsed_event(dispatcher, project_dir=tmp_dir, file_or_dir=[
str(rel_path / dirname)
])

Expand Down
1 change: 1 addition & 0 deletions vedro/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@


class Config(core.Config):

# Validate each plugin's configuration, checking for unknown attributes to prevent errors
validate_plugins_configs: bool = True

Expand Down
1 change: 1 addition & 0 deletions vedro/core/config_loader/_config_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Section(cabina.Section):


class Config(cabina.Config, Section):

# Path to the configuration file. By default, it points to the file
# where this class is defined (__file__). At runtime, it is typically
# set to 'vedro.cfg.py' in the project's root directory.
Expand Down

0 comments on commit 1d4992b

Please sign in to comment.