Skip to content

Commit 1df49a4

Browse files
Keep two fixtures but use a neater one-liner and allow both fixtures to be used at once.
Co-authored-by: Matt Graham <[email protected]>
1 parent 76d2463 commit 1df49a4

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

tests/conftest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ def default_config() -> dict[str, str]:
2626
def default_config_with(default_config: dict[str, str]) -> typing.Callable:
2727
"""Extend or modify the default configuration with one additional value."""
2828

29-
def _wrapped_with(key: str, value: str) -> dict[str, str]:
30-
default_config[key] = value
31-
return default_config
29+
def _wrapped_with(**kwargs: str) -> dict[str, str]:
30+
return default_config | kwargs
3231

3332
return _wrapped_with
3433

tests/test_git_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_initialisation_of_git_repo(
1414
) -> None:
1515
"""Checks to see if git was correctly initialised if desired."""
1616
# Run cookiecutter with initialise_git_repository
17-
config = default_config_with("initialise_git_repository", str(init))
17+
config = default_config_with(initialise_git_repository=str(init))
1818
result, test_project_dir = generate_package(config=config)
1919

2020
# check if git is initialised

tests/test_package_generation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_package_generation(
4242
"""Test package generation."""
4343
# Not having a git repo makes it easier to check in/out reference
4444
# data files to the main python-tooling git repository
45-
config = default_config_with("initialise_git_repository", "False")
45+
config = default_config_with(initialise_git_repository="False")
4646
_, test_project_dir = generate_package(config=config)
4747

4848
expected_package_dir = (
@@ -117,7 +117,7 @@ def test_optional_funder(
117117
generate_package: typing.Callable,
118118
) -> None:
119119
"""Test specifying funder or not in package generation."""
120-
config = default_config_with("funder", funder)
120+
config = default_config_with(funder=funder)
121121
_, test_project_dir = generate_package(config)
122122

123123
with (test_project_dir / "README.md").open() as f:

0 commit comments

Comments
 (0)