Parse provided json to get configuration Empty default json: { "testfiles": [], "breakfailed": true, "onlyfailed": false, "verb": 3, "dump": 0, "docs": 0, "crc": true, "preexec": {}, "global_preexec": "", "outputfile": null, "
(config_path, verb=3)
| 307 | # Careful note: all data not included will be set by default. |
| 308 | # Use -c as first argument !! |
| 309 | def parse_config_file(config_path, verb=3): |
| 310 | """Parse provided json to get configuration |
| 311 | Empty default json: |
| 312 | { |
| 313 | "testfiles": [], |
| 314 | "breakfailed": true, |
| 315 | "onlyfailed": false, |
| 316 | "verb": 3, |
| 317 | "dump": 0, |
| 318 | "docs": 0, |
| 319 | "crc": true, |
| 320 | "preexec": {}, |
| 321 | "global_preexec": "", |
| 322 | "outputfile": null, |
| 323 | "local": true, |
| 324 | "format": "ansi", |
| 325 | "num": null, |
| 326 | "modules": [], |
| 327 | "kw_ok": [], |
| 328 | "kw_ko": [] |
| 329 | } |
| 330 | |
| 331 | """ |
| 332 | with open(config_path) as config_file: |
| 333 | data = json.load(config_file) |
| 334 | if verb > 2: |
| 335 | print(" %s Loaded config file" % arrow, config_path) |
| 336 | |
| 337 | def get_if_exist(key, default): |
| 338 | return data[key] if key in data else default |
| 339 | return Bunch(testfiles=get_if_exist("testfiles", []), |
| 340 | breakfailed=get_if_exist("breakfailed", True), |
| 341 | remove_testfiles=get_if_exist("remove_testfiles", []), |
| 342 | onlyfailed=get_if_exist("onlyfailed", False), |
| 343 | verb=get_if_exist("verb", 3), |
| 344 | dump=get_if_exist("dump", 0), crc=get_if_exist("crc", 1), |
| 345 | docs=get_if_exist("docs", 0), |
| 346 | preexec=get_if_exist("preexec", {}), |
| 347 | global_preexec=get_if_exist("global_preexec", ""), |
| 348 | outfile=get_if_exist("outputfile", sys.stdout), |
| 349 | local=get_if_exist("local", False), |
| 350 | num=get_if_exist("num", None), |
| 351 | modules=get_if_exist("modules", []), |
| 352 | kw_ok=get_if_exist("kw_ok", []), |
| 353 | kw_ko=get_if_exist("kw_ko", []), |
| 354 | format=get_if_exist("format", "ansi")) |
| 355 | |
| 356 | # PARSE CAMPAIGN # |
| 357 |
no test coverage detected
searching dependent graphs…