So I have the following file summary1:
---
Project: pgm1
Last-Status: success
summary: 102 passed, 88 warnings in 26.11s
---
Project: pgm2
Last-Status: failed
summary: 1 failed, 316 passed, 204 warnings in 42.94s
---
Project: pgm3
Last-Status: success
summary: 400 passed, 40 skipped, 1 xfailed in 3.17s
---
And I need to parse it's contents, and then in a loop, create a dictionary with pre-defined values:
entry = dict()
entry = {
"{#STATUS}": 0,
"{#PASSED}": 0,
"{#FAILED}": 0,
"{#WARNING}": 0,
"{#SKIPPED}": 0,
"{#XFAILED}": 0
}
And then populate the corresponding dictionary keys, with the parsed values from the file, resulting in something like this:
entry = {
"{#STATUS}": 1
"{#DESCRIPTION}": "kytos/mef_eline",
"{#PASSED}": 316,
"{#FAILED}": 1,
"{#WARNING}": 0,
"{#SKIPPED}": 0,
"{#XFAILED}": 0,
}... And so on for all 3 Project-Desc data sections in the file
However I have not been able to figure out how to the parsing of the file and assigning of the variables, and through my searches, I've found that regex would be a good tool for this but I've never used it before.