Преглед на файлове

grass.gunittest: Fix fail with no config (#2180)

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.
Vaclav Petras преди 3 години
родител
ревизия
1ece3bc558
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      python/grass/gunittest/main.py

+ 4 - 1
python/grass/gunittest/main.py

@@ -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():