Skip to content

Commit

Permalink
grass.gunittest: Fix fail with no config (#2180)
Browse files Browse the repository at this point in the history
Adds an empty section to the parser when no config file is available and returning the section proxy instead of returning and empty dict which has a different API than the section proxy.

Fixes an issue introduced in #2172 which shows in grass-addons CI.
  • Loading branch information
wenzeslaus committed Feb 8, 2022
1 parent 150a0e9 commit 1ece3bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/grass/gunittest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ def get_config(start_directory):
config_file = Path(start_directory) / CONFIG_FILENAME
if config_file.is_file():
config_parser.read(config_file)
else:
# Create an empty section if file is not available.
config_parser.read_dict({"gunittest": {}})
if "gunittest" in config_parser:
return config_parser["gunittest"]
return {}
return config_parser


def main():
Expand Down

0 comments on commit 1ece3bc

Please sign in to comment.