Merge pull request #818 from codeflash-ai/fix-existing-test-number-report
Correct number of existing tests passed/failed printed
This commit is contained in:
commit
0ddef46323
1 changed files with 14 additions and 9 deletions
|
|
@ -70,6 +70,9 @@ class FunctionTestInvocation:
|
|||
return_value: Optional[object] # The return value of the function invocation
|
||||
timed_out: Optional[bool]
|
||||
|
||||
def test_executed(self) -> bool:
|
||||
return self.test_type != TestType.EXISTING_UNIT_TEST or self.id.function_getting_tested
|
||||
|
||||
|
||||
class TestResults(BaseModel):
|
||||
test_results: list[FunctionTestInvocation] = []
|
||||
|
|
@ -93,11 +96,12 @@ class TestResults(BaseModel):
|
|||
passed = 0
|
||||
failed = 0
|
||||
for test_result in self.test_results:
|
||||
if test_result.did_pass:
|
||||
passed += 1
|
||||
else:
|
||||
logging.info(f"Failed test: {test_result.id}")
|
||||
failed += 1
|
||||
if test_result.test_executed():
|
||||
if test_result.did_pass:
|
||||
passed += 1
|
||||
else:
|
||||
logging.info(f"Failed test: {test_result.id}")
|
||||
failed += 1
|
||||
return f"Passed: {passed}, Failed: {failed}"
|
||||
|
||||
def get_test_pass_fail_report_by_type(self) -> dict[TestType, dict[str, int]]:
|
||||
|
|
@ -105,10 +109,11 @@ class TestResults(BaseModel):
|
|||
for test_type in TestType:
|
||||
report[test_type] = {"passed": 0, "failed": 0}
|
||||
for test_result in self.test_results:
|
||||
if test_result.did_pass:
|
||||
report[test_result.test_type]["passed"] += 1
|
||||
else:
|
||||
report[test_result.test_type]["failed"] += 1
|
||||
if test_result.test_executed():
|
||||
if test_result.did_pass:
|
||||
report[test_result.test_type]["passed"] += 1
|
||||
else:
|
||||
report[test_result.test_type]["failed"] += 1
|
||||
return report
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Reference in a new issue