def run_case(self, testcase: DataDrivenTestCase) -> None: assert has_stable_flags(testcase), "Testcase has varying flags" assert is_incremental(testcase), "Testcase is not incremental" # All tests run once with a cold cache, then at least once # with a warm cache and maybe changed files. Expected output # is specified separately for each run. self.clear_cache() num_steps = max([2] + list(testcase.output2.keys())) # Check that there are no file changes beyond the last run (they would be ignored). for dn, dirs, files in os.walk(os.curdir): for file in files: m = re.search(r'\.([2-9])$', file) if m and int(m.group(1)) > num_steps: raise ValueError( 'Output file {} exists though test case only has {} runs' .format(file, num_steps)) self.server = None # type: Optional[dmypy_server.Server] for step in range(1, num_steps + 1): self.run_case_once(testcase, step)
def run_case(self, testcase: DataDrivenTestCase) -> None: assert has_stable_flags(testcase), "Testcase has varying flags" assert is_incremental(testcase), "Testcase is not incremental" # All tests run once with a cold cache, then at least once # with a warm cache and maybe changed files. Expected output # is specified separately for each run. self.clear_cache() num_steps = max([2] + list(testcase.output2.keys())) # Check that there are no file changes beyond the last run (they would be ignored). for dn, dirs, files in os.walk(os.curdir): for file in files: m = re.search(r'\.([2-9])$', file) if m and int(m.group(1)) > num_steps: raise ValueError( 'Output file {} exists though test case only has {} runs'.format( file, num_steps)) self.server = None # type: Optional[dmypy_server.Server] for step in range(1, num_steps + 1): self.run_case_once(testcase, step)
def filter(cls, testcase: DataDrivenTestCase) -> bool: return has_stable_flags(testcase) and is_incremental(testcase)