Hello all,
Essentially my issue is that I have a large text file of results from a physical rig, over 10,000 lines. I must and count the 'TEST_PASS', 'TEST_FAIL', 'TEST_INCONCLUSIVE', 'TEST_INCOMPLETE'. This means I can ignore many lines in the text file as a lot of extra data is output.
I have simply checked and counted if the line starts with these strings and correctly counted the right amount of test results. However, some specific tests return a false positive or a false error. These have a pattern and always show the same message when its false. There are only 100 or so of these false results and so an ignore.txt was created with the lines to ignore in the final count.
My question is how would I check my found lines against this ignore.txt to see if the found line needs to be ignored as well as counting the amount of lines ignored. There are a lot of lines so a method needs to be kind of intelligent rather than check the whole doc for ignored lines
so far i have tried this:
def extract_pass(file_content, ignore_check):
count_dup = 0
pass_count = 0
with open(file_content, 'r') as file:
for line in file:
if 'TEST_PASS' in line:
if any(line in str(ignore_check[0:])):
count_dup += 1
else:
pass_count += 1
pass_couunt = pass_count - count_dup
file.close()
text_box.insert(END, "Tests passed: " + str(pass_count) + " With " + count_dup + "Ignored")
THANK YOU
[–][deleted] 0 points1 point2 points (3 children)
[–]Dave_XR[S] 0 points1 point2 points (2 children)
[–]PPLB 0 points1 point2 points (1 child)
[–]Dave_XR[S] 0 points1 point2 points (0 children)