Esempio n. 1
0
def test_run():
    config = build_review_config(simple_ini)
    problems = Problems()
    files = ['./tests/fixtures/pep8/has_errors.py']
    tool_list = tools.factory(config, problems, root_dir)
    tools.run(tool_list, files, [])
    eq_(7, len(problems))
Esempio n. 2
0
 def test_run(self):
     config = build_review_config(simple_ini)
     problems = Problems()
     files = ['./tests/fixtures/pep8/has_errors.py']
     tool_list = tools.factory(config, problems, root_dir)
     tools.run(tool_list, files, [])
     self.assertEqual(7, len(problems))
Esempio n. 3
0
 def run_tools(self, repo_config):
     if not self._changes:
         raise RuntimeError('No loaded changes, cannot run tools. '
                            'Try calling load_changes first.')
     files_to_check = self._changes.get_files(append_base=self._target_path)
     tools.run(repo_config, self._problems, files_to_check,
               self._target_path)
Esempio n. 4
0
 def run_tools(self, review_config):
     if self._changes is None:
         raise RuntimeError("No loaded changes, cannot run tools. " "Try calling load_changes first.")
     files_to_check = self._changes.get_files(
         append_base=self._target_path, ignore_patterns=review_config.ignore_patterns()
     )
     commits_to_check = self._pull_request.commits()
     tools.run(review_config, self._problems, files_to_check, commits_to_check, self._target_path)
Esempio n. 5
0
def test_run__filter_files():
    config = build_review_config(simple_ini)
    problems = Problems()
    files = [
        './tests/fixtures/pep8/has_errors.py',
        './tests/fixtures/phpcs/has_errors.php'
    ]
    tools.run(config, problems, files, [], '')
    eq_(6, len(problems))
Esempio n. 6
0
def test_run__filter_files():
    config = build_review_config(simple_ini)
    problems = Problems()
    files = [
        './tests/fixtures/pep8/has_errors.py',
        './tests/fixtures/phpcs/has_errors.php'
    ]
    tools.run(config, problems, files, [], '')
    eq_(6, len(problems))
Esempio n. 7
0
 def test_run__filter_files(self):
     config = build_review_config(simple_ini)
     problems = Problems()
     files = [
         './tests/fixtures/pep8/has_errors.py',
         './tests/fixtures/phpcs/has_errors.php'
     ]
     tool_list = tools.factory(config, problems, root_dir)
     tools.run(tool_list, files, [])
     self.assertEqual(7, len(problems))
Esempio n. 8
0
 def run_tools(self, review_config):
     if self._changes is None:
         raise RuntimeError('No loaded changes, cannot run tools. '
                            'Try calling load_changes first.')
     files_to_check = self._changes.get_files(
         append_base=self._target_path,
         ignore_patterns=review_config.ignore_patterns())
     commits_to_check = self._pull_request.commits()
     tools.run(review_config, self._problems, files_to_check,
               commits_to_check, self._target_path)
Esempio n. 9
0
 def run_tools(self, repo_config):
     if not self._changes:
         raise RuntimeError('No loaded changes, cannot run tools. '
                            'Try calling load_changes first.')
     files_to_check = self._changes.get_files(append_base=self._target_path)
     tools.run(
         repo_config,
         self._problems,
         files_to_check,
         self._target_path)
Esempio n. 10
0
    def test_run_timeout_error(self, mock_docker):
        mock_docker.side_effect = TimeoutError("Read timed out. (read timeout=300)")
        config = build_review_config(simple_ini)
        problems = Problems()
        files = ['./tests/fixtures/pep8/has_errors.py']
        tool_list = tools.factory(config, problems, root_dir)
        tools.run(tool_list, files, [])

        errors = problems.all()
        assert 1 == len(errors)
        assert 'timed out during' in errors[0].body
        assert 'run pep8 linter' in errors[0].body
Esempio n. 11
0
    def test_run_timeout_error(self, mock_docker):
        mock_docker.side_effect = TimeoutError(
            "Read timed out. (read timeout=300)")
        config = build_review_config(simple_ini)
        problems = Problems()
        files = ['./tests/fixtures/pep8/has_errors.py']
        tool_list = tools.factory(config, problems, root_dir)
        tools.run(tool_list, files, [])

        errors = problems.all()
        assert 1 == len(errors)
        assert 'timed out during' in errors[0].body
        assert 'run pep8 linter' in errors[0].body
Esempio n. 12
0
    def run_tools(self, review_config):
        if self._changes is None:
            raise RuntimeError('No loaded changes, cannot run tools. '
                               'Try calling load_changes first.')
        files_to_check = self._changes.get_files(
            ignore_patterns=review_config.ignore_patterns())
        commits_to_check = self._pull_request.commits()

        tool_list = tools.factory(review_config, self.problems,
                                  self._target_path)

        if review_config.fixers_enabled():
            self.apply_fixers(review_config, tool_list, files_to_check)

        tools.run(tool_list, files_to_check, commits_to_check)
Esempio n. 13
0
    def run_tools(self):
        if self._changes is None:
            raise RuntimeError('No loaded changes, cannot run tools. '
                               'Try calling load_changes first.')
        config = self._config

        files_to_check = self._changes.get_files(
            ignore_patterns=config.ignore_patterns()
        )
        commits_to_check = self._pull_request.commits()

        tool_list = tools.factory(
            config,
            self.problems,
            self._target_path)

        if config.fixers_enabled():
            self.apply_fixers(tool_list, files_to_check)

        tools.run(tool_list, files_to_check, commits_to_check)
Esempio n. 14
0
 def run_tools(self, review_config):
     if self._changes is None:
         raise RuntimeError('No loaded changes, cannot run tools. '
                            'Try calling load_changes first.')
     files_to_check = self._changes.get_files(
         append_base=self._target_path,
         ignore_patterns=review_config.ignore_patterns())
     commits_to_check = self._pull_request.commits()
     log.debug("_problems before tools: %s" % len(self._problems))
     self._problems = tools.run(
         review_config,
         self._problems,
         files_to_check,
         commits_to_check,
         self._target_path)
     log.debug("_problems after tools: %s" % len(self._problems))
Esempio n. 15
0
def test_run():
    config = ReviewConfig(simple_ini)
    problems = Problems()
    files = ['./tests/fixtures/pep8/has_errors.py']
    tools.run(config, problems, files, [], '')
    eq_(6, len(problems))
Esempio n. 16
0
def test_run__filter_files():
    config = ReviewConfig(simple_ini)
    problems = Problems()
    files = ["./tests/fixtures/pep8/has_errors.py", "./tests/fixtures/phpcs/has_errors.php"]
    tools.run(config, problems, files, [], "")
    eq_(6, len(problems))