• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python TestUtilities.execute_coala函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.TestUtilities.execute_coala函数的典型用法代码示例。如果您正苦于以下问题:Python execute_coala函数的具体用法?Python execute_coala怎么用?Python execute_coala使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了execute_coala函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_caching_multi_results

    def test_caching_multi_results(self):
        """
        Integration test to assert that results are not dropped when coala is
        ran multiple times with caching enabled and one section yields a result
        and second one doesn't.
        """
        filename = 'tests/misc/test_caching_multi_results/'
        with bear_test_module():
            with simulate_console_inputs('0'):
                retval, stdout, stderr = execute_coala(
                   coala.main,
                   'coala',
                   '-c', filename + '.coafile',
                   '-f', filename + 'test.py')
                self.assertIn('This file has', stdout)
                self.assertIn(
                    'Implicit \'Default\' section inheritance is deprecated',
                    stderr)

            retval, stdout, stderr = execute_coala(
               coala.main,
               'coala',
               '-c', filename + '.coafile',
               '-f', filename + 'test.py')
            self.assertIn('This file has', stdout)
            self.assertIn('During execution of coala', stderr)
            self.assertIn(
                'Implicit \'Default\' section inheritance is deprecated',
                stderr)
开发者ID:arush0311,项目名称:coala,代码行数:29,代码来源:CachingTest.py


示例2: test_section_ordering

    def test_section_ordering(self, debug=False):
        with bear_test_module():
            with prepare_file(['#include <a>'], None) as (lines, filename):
                retval, stdout, stderr = execute_coala(
                        coala.main, 'coala', 'b', 'a',
                        '--non-interactive', '-S',
                        'a.bears=SpaceConsistencyTestBear',
                        'a.files={}'.format(filename),
                        'a.use_spaces=True',
                        'b.bears=SpaceConsistencyTestBear',
                        'b.files={}'.format(filename),
                        'b.use_spaces=True',
                        '-c', os.devnull,
                        debug=debug)
                stdout_list = stdout.splitlines(True)
                self.assertEqual('Executing section b...\n', stdout_list[0])
                self.assertEqual('Executing section a...\n', stdout_list[1])

                retval, stdout, stderr = execute_coala(
                        coala.main, 'coala', 'a', 'b',
                        '--non-interactive', '-S',
                        'a.bears=SpaceConsistencyTestBear',
                        'a.files={}'.format(filename),
                        'a.use_spaces=True',
                        'b.bears=SpaceConsistencyTestBear',
                        'b.files={}'.format(filename),
                        'b.use_spaces=True',
                        '-c', os.devnull,
                        debug=debug)
                stdout_list = stdout.splitlines(True)
                self.assertEqual('Executing section a...\n', stdout_list[0])
                self.assertEqual('Executing section b...\n', stdout_list[1])
开发者ID:Anmolbansal1,项目名称:coala,代码行数:32,代码来源:coalaCITest.py


示例3: test_caching_multi_results

    def test_caching_multi_results(self):
        """
        Integration test to assert that results are not dropped when coala is
        ran multiple times with caching enabled and one section yields a result
        and second one doesn't.
        """
        filename = 'tests/misc/test_caching_multi_results/'
        with bear_test_module():
            with simulate_console_inputs('n'):
                retval, stdout, stderr = execute_coala(
                   coala.main,
                   'coala',
                   '-c', filename + '.coafile',
                   '-f', filename + 'test.py')
                self.assertIn('This file has', stdout)
                self.assertIn(
                    'Implicit \'Default\' section inheritance is deprecated',
                    stderr)

            retval, stdout, stderr = execute_coala(
               coala.main,
               'coala',
               '--non-interactive', '--no-color',
               '-c', filename + '.coafile',
               '-f', filename + 'test.py')
            self.assertIn('This file has', stdout)
            self.assertEqual(2, len(stderr.splitlines()))
            self.assertIn(
                'LineCountTestBear: This result has no patch attached.',
                stderr)
            self.assertIn(
                'Implicit \'Default\' section inheritance is deprecated',
                stderr)
开发者ID:Anmolbansal1,项目名称:coala,代码行数:33,代码来源:CachingTest.py


示例4: test_did_nothing

    def test_did_nothing(self):
        retval, output = execute_coala(coala.main, 'coala', '-I',
                                       '-S', 'default.enabled=false')
        self.assertEqual(retval, 2)
        self.assertIn('Did you forget to give the `--files`', output)

        retval, output = execute_coala(coala.main, 'coala', '-I',
                                       '-b', 'JavaTestBear', '-f', '*.java',
                                       '-S', 'default.enabled=false')
        self.assertEqual(retval, 2)
        self.assertIn('Nothing to do.', output)
开发者ID:justuswilhelm,项目名称:coala,代码行数:11,代码来源:coalaTest.py


示例5: test_coala_main_bear_run_raises

 def test_coala_main_bear_run_raises(self):
     with bear_test_module(), \
             prepare_file(['#fixme  '], None) as (lines, filename), \
             self.assertRaisesRegex(
                 RuntimeError, r"^That's all the RaiseTestBear can do\.$"):
         execute_coala(
             coala.main, 'coala',
             '-c', os.devnull,
             '-f', filename,
             '-b', 'RaiseTestBear',
             debug=True)
开发者ID:Eoghan-Murphy,项目名称:coala,代码行数:11,代码来源:coalaDebugTest.py


示例6: test_coala_delete_orig

 def test_coala_delete_orig(self):
     with TemporaryDirectory() as tempdir,\
          NamedTemporaryFile(suffix='.orig',
                             dir=tempdir,
                             delete=False) as orig_file,\
          make_temp(suffix='.coafile', prefix='', dir=tempdir) as coafile,\
          make_temp(dir=tempdir) as unrelated_file:
         orig_file.close()
         execute_coala(coala_ci.main, "coala-ci",
                       "-c", re.escape(coafile))
         self.assertFalse(os.path.isfile(orig_file.name))
         self.assertTrue(os.path.isfile(unrelated_file))
开发者ID:AbdealiJK,项目名称:coala,代码行数:12,代码来源:coalaCITest.py


示例7: test_coala_main_bear__init__raises

 def test_coala_main_bear__init__raises(self):
     with bear_test_module(), \
             prepare_file(['#fixme  '], None) as (lines, filename), \
             self.assertRaisesRegex(
                 RuntimeError,
                 r'^The bear ErrorTestBear does not fulfill all '
                 r"requirements\. 'I_do_not_exist' is not installed\.$"):
         execute_coala(
             coala.main, 'coala',
             '-c', os.devnull,
             '-f', filename,
             '-b', 'ErrorTestBear',
             debug=True)
开发者ID:Eoghan-Murphy,项目名称:coala,代码行数:13,代码来源:coalaDebugTest.py


示例8: test_coala_main_mode_json_raises

    def test_coala_main_mode_json_raises(self, mocked_mode_json):
        mocked_mode_json.side_effect = RuntimeError('Mocked mode_json fails.')

        with bear_test_module(), \
                prepare_file(['#fixme  '], None) as (lines, filename), \
                self.assertRaisesRegex(RuntimeError,
                                       r'^Mocked mode_json fails\.$'):
            # additionally use RaiseTestBear to verify independency from
            # failing bears
            execute_coala(
                coala.main, 'coala', '--json',
                '-c', os.devnull,
                '-f', filename,
                '-b', 'RaiseTestBear',
                debug=True)
开发者ID:Eoghan-Murphy,项目名称:coala,代码行数:15,代码来源:coalaDebugTest.py


示例9: test_caching_results

    def test_caching_results(self):
        """
        A simple integration test to assert that results are not dropped
        when coala is ran multiple times with caching enabled.
        """
        with bear_test_module():
            with prepare_file(['a=(5,6)'], None) as (lines, filename):
                with simulate_console_inputs('n'):
                    retval, stdout, stderr = execute_coala(
                        coala.main,
                        'coala',
                        '-c', os.devnull,
                        '--disable-caching',
                        '--flush-cache',
                        '-f', filename,
                        '-b', 'LineCountTestBear',
                        '-L', 'DEBUG')
                    self.assertIn('This file has', stdout)
                    self.assertIn('Running bear LineCountTestBear', stderr)

                # Due to the change in configuration from the removal of
                # ``--flush-cache`` this run will not be sufficient to
                # assert this behavior.
                retval, stdout, stderr = execute_coala(
                    coala.main,
                    'coala',
                    '--non-interactive', '--no-color',
                    '-c', os.devnull,
                    '-f', filename,
                    '-b', 'LineCountTestBear')
                self.assertIn('This file has', stdout)
                self.assertEqual(1, len(stderr.splitlines()))
                self.assertIn(
                    'LineCountTestBear: This result has no patch attached.',
                    stderr)

                retval, stdout, stderr = execute_coala(
                    coala.main,
                    'coala',
                    '--non-interactive', '--no-color',
                    '-c', os.devnull,
                    '-f', filename,
                    '-b', 'LineCountTestBear')
                self.assertIn('This file has', stdout)
                self.assertEqual(1, len(stderr.splitlines()))
                self.assertIn(
                    'LineCountTestBear: This result has no patch attached.',
                    stderr)
开发者ID:Anmolbansal1,项目名称:coala,代码行数:48,代码来源:CachingTest.py


示例10: test_nonexistent

 def test_nonexistent(self):
     retval, stdout, stderr = execute_coala(
         coala.main, 'coala', '--non-interactive', '-c', 'nonex', 'test')
     self.assertFalse(stdout)
     self.assertRegex(
         stderr,
         ".*\\[ERROR\\].*The requested coafile '.*' does not exist. .+\n")
开发者ID:arush0311,项目名称:coala,代码行数:7,代码来源:coalaCITest.py


示例11: test_version_conflict_in_collecting_bears

 def test_version_conflict_in_collecting_bears(self, import_fn, _):
     with bear_test_module():
         import_fn.side_effect = VersionConflict("msg1", "msg2")
         retval, output = execute_coala(coala.main, "coala", "-B")
         self.assertEqual(retval, 13)
         self.assertIn(("There is a conflict in the version of a " "dependency you have installed"), output)
         self.assertIn("pip install msg2", output)  # Check recommendation
开发者ID:CarIosRibeiro,项目名称:coala,代码行数:7,代码来源:coalaTest.py


示例12: test_filter_by_language_c

 def test_filter_by_language_c(self):
     with bear_test_module():
         retval, stdout, stderr = execute_coala(
             coala.main, 'coala', '-B', '--filter-by', 'language', 'c')
         self.assertEqual(retval, 0)
         self.assertEqual(len(stdout.strip().splitlines()),
                          C_BEARS_COUNT_OUTPUT)
开发者ID:Anmolbansal1,项目名称:coala,代码行数:7,代码来源:FilterTest.py


示例13: test_show_language_bears

 def test_show_language_bears(self):
     with bear_test_module():
         retval, output = execute_coala(
             coala_json.main, 'coala-json', '-B', '-l', 'java')
         self.assertEqual(retval, 0)
         output = json.loads(output)
         self.assertEqual(len(output["bears"]), 2)
开发者ID:AndreaCrotti,项目名称:coala,代码行数:7,代码来源:coalaJSONTest.py


示例14: test_nonexistent

 def test_nonexistent(self):
     retval, output = execute_coala(
         coala_json.main, "coala-json", "-c", 'nonex', "test")
     output = json.loads(output)
     self.assertRegex(
         output["logs"][0]["message"],
         "The requested coafile '.*' does not exist. .+")
开发者ID:AndreaCrotti,项目名称:coala,代码行数:7,代码来源:coalaJSONTest.py


示例15: test_fail_acquire_settings

 def test_fail_acquire_settings(self):
     with bear_test_module():
         retval, output = execute_coala(coala.main, 'coala',
                                        '--non-interactive',
                                        '-b', 'SpaceConsistencyTestBear',
                                        '-c', os.devnull)
         self.assertIn('During execution, we found that some', output)
开发者ID:RohanVB,项目名称:coala,代码行数:7,代码来源:coalaCITest.py


示例16: test_log

 def test_log(self, debug=False):
     retval, stdout, stderr = execute_coala(
         coala_ci.main, 'coala-ci', '--help', debug=debug)
     self.assertIn('usage: coala', stdout)
     self.assertIn('Use of `coala-ci` executable is deprecated', stderr)
     self.assertEqual(retval, 0,
                      'coala must return zero when successful')
开发者ID:Anmolbansal1,项目名称:coala,代码行数:7,代码来源:coalaCITest.py


示例17: test_filter_by_language_c

 def test_filter_by_language_c(self):
     with bear_test_module():
         retval, stdout, stderr = execute_coala(
             coala.main, 'coala', '-B', '--filter-by', 'language', 'c')
         self.assertEqual(retval, 0)
         # 1 bear plus 1 line holding the closing colour escape sequence.
         self.assertEqual(len(stdout.strip().splitlines()), 2)
开发者ID:CruiseDevice,项目名称:coala,代码行数:7,代码来源:FilterTest.py


示例18: test_show_bears_specified_in_args

 def test_show_bears_specified_in_args(self):
     with bear_test_module():
         retval, stdout, stderr = execute_coala(
             coala.main, 'coala', '-B', '--bears',
             'JavaTestBear', '--no-color')
         self.assertEqual(retval, 0)
         self.assertEqual(stdout.strip(), 'JavaTestBear')
开发者ID:Anmolbansal1,项目名称:coala,代码行数:7,代码来源:ConsoleInteractionTest.py


示例19: test_show_language_bears

 def test_show_language_bears(self):
     with bear_test_module():
         retval, output = execute_coala(
             coala.main, 'coala', '-B', '-l', 'java')
         self.assertEqual(retval, 0)
         # 2 bears plus 1 line holding the closing colour escape sequence
         self.assertEqual(len(output.splitlines()), 3)
开发者ID:justuswilhelm,项目名称:coala,代码行数:7,代码来源:coalaTest.py


示例20: test_bear_run_raises

    def test_bear_run_raises(self, mocked_mode_json):
        mocked_mode_json.side_effect = None
        mocked_ipdb = self.ipdbMock()
        with bear_test_module(), \
                prepare_file(['#fixme  '], None) as (lines, filename), \
                self.pipReqIsInstalledMock(), \
                patch.dict('sys.modules', ipdb=mocked_ipdb), \
                self.assertRaisesRegex(
                    RuntimeError, r"^That's all the RaiseTestBear can do\.$"):
            execute_coala(
                coala.main, 'coala', '--debug',
                '-c', os.devnull,
                '-f', re.escape(filename),
                '-b', 'RaiseTestBear')

        mocked_ipdb.launch_ipdb_on_exception.assert_called_once_with()
开发者ID:CruiseDevice,项目名称:coala,代码行数:16,代码来源:coalaDebugFlagTest.py



注:本文中的tests.TestUtilities.execute_coala函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _util.eq_函数代码示例发布时间:2022-05-27
下一篇:
Python TestUtilities.bear_test_module函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap