def find_last_failed(self, argv): from numba.tests.support import captured_output # Find all tests listargv = ['-l'] + [a for a in argv if not a.startswith('-')] with captured_output("stdout") as stream: main(*listargv) pat = re.compile(r"^(\w+\.)+\w+$") lines = stream.getvalue().splitlines() all_tests = [x for x in lines if pat.match(x) is not None] try: fobj = open(self.cache_filename) except IOError: failed_tests = [] else: with fobj as fin: failed_tests = json.load(fin) return all_tests, failed_tests