@@ -607,8 +713,55 @@ class UTestCase(unittest.TestCase):
else:
print("Warning! data file not found",cfile)
def_get_coverage_files(self):
key=(self.cache_id(),'coverage')
# CC = None
# if self._cache_contains(key):
returnself._cache_get(key,None)
# return CC
def_get_hints(self):
"""
This code is run when the test is set up to generate the hints and store them in an artifact file. It may be beneficial to simple compute them beforehand
and store them in the local unitgrade pickle file. This code is therefore expected to superceede the alterative code later.
"""
hints=[]
# print("Getting hint")
key=(self.cache_id(),'coverage')
ifself._cache_contains(key):
CC=self._cache_get(key)
# cl, m = self.cache_id()
# print("Getting hint using", CC)
# Insert newline to get better formatting.
# gprint(
# f"\n> An error occured during the test: {cl}.{m}. The following files/methods has code in them you are supposed to edit and may therefore be the cause of the problem:")
forfileinCC:
rec=CC[file]
# gprint(f"> * {file}")
forlinrec:
_,comments=CC[file][l]
hint=get_hints(comments)
ifhint!=None:
hints.append((hint,file,l))
doc=self._testMethodDoc
# print("doc", doc)
ifdocisnotNone:
hint=get_hints(self._testMethodDoc)
ifhintisnotNone:
hints=[(hint,None,self.cache_id()[1])]+hints
returnhints
def_feedErrorsToResult(self,result,errors):
""" Use this to show hints on test failure. """
""" Use this to show hints on test failure.
It feeds error to the result -- so if there are errors, they will crop up here
"""
self._error_fed_during_run=errors.copy()# import to copy the error list.