Example #1
0
 def run_test(self, target_src, test_src):
     with FileMockModulesLoader('target', target_src) as target_loader, \
             FileMockModulesLoader('test', test_src) as test_loader:
         target_loader.load()
         runner = self.TEST_RUNNER_CLS(test_loader, 5,
                                       utils.StdoutManager(True), False)
         test_module, target_test = test_loader.load()[0]
         result, time = runner.run_test(test_module, target_test)
     return result
Example #2
0
 def __init__(self, runner_cls, target_loader, test_loader, views, mutant_generator, qstrategy,
              timeout_factor=5, disable_stdout=False, mutate_covered=False, mutation_number=None):
     super().__init__(views)
     self.target_loader = target_loader
     self.test_loader = test_loader
     self.mutant_generator = mutant_generator
     self.timeout_factor = timeout_factor
     self.stdout_manager = utils.StdoutManager(disable_stdout)
     self.mutation_number = mutation_number
     self.runner = runner_cls(self.test_loader, self.timeout_factor, self.stdout_manager, mutate_covered)
     self.qstrategy = qstrategy
Example #3
0
 def __init__(self, target_loader, test_loader, views, mutant_generator,
              timeout_factor=5, disable_stdout=False, mutate_covered=False, mutation_number=None):
     super().__init__(views)
     self.target_loader = target_loader
     self.test_loader = test_loader
     self.mutant_generator = mutant_generator
     self.timeout_factor = timeout_factor
     self.stdout_manager = utils.StdoutManager(disable_stdout)
     self.mutate_covered = mutate_covered
     self.mutation_number = mutation_number
     self.store_init_modules()
Example #4
0
 def inject(self, node, module_name='coverage'):
     self.covered_nodes.clear()
     self.marker_transformer = MarkerNodeTransformer()
     marker_node = self.marker_transformer.visit(node)
     coverage_node = CoverageNodeTransformer().visit(copy.deepcopy(marker_node))
     self.covered_nodes.add(coverage_node.marker)
     with utils.StdoutManager():
         return utils.create_module(
             ast_node=coverage_node,
             module_name=module_name,
             module_dict={COVERAGE_SET_NAME: self.covered_nodes},
         )