The number of test is parsed into variable and is checked against expected number of 4 test functions:
if not matches:
raise check50.Failure("Could not parse output of pytest")
try:
functions = int(matches.groups(1)[0]) # save number of tests
except ValueError:
raise check50.Failure("Could not parse output of pytest")
if functions < 4: # do the validation
raise check50.Failure("test_jar.py does not contain at least four functions")
So, pset test file with 23 tests will fail the validation since capturing group only catches the "3 passed" part of string "= 23 passed in 0.03s =":
Workaround
In case you have more that 9 tests, make sure you have test counts are in range [14 .. 19], [24 .. 29], etc.:
Steps to reproduce:
Actual result:
check50 fails for the last test ":( test_jar.py contains at least four functions".
Expected result:
check50 validation must succeed since the problem set requirement is satisfied.
Possible solution:
Add
+
token to the regex expressionmatches = re.search(r'(\d+) passed', out)
:NOTES:
The regex for parsing pytest output -
matches = re.search(r'(\d) passed', out)
- only captures 1 digit in the capturing group:The number of test is parsed into variable and is checked against expected number of 4 test functions:
So, pset test file with 23 tests will fail the validation since capturing group only catches the "3 passed" part of string "= 23 passed in 0.03s =":
Workaround
In case you have more that 9 tests, make sure you have test counts are in range [14 .. 19], [24 .. 29], etc.: