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

Python trial._getLoader函数代码示例

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

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



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

示例1: test_unforcedGc

 def test_unforcedGc(self):
     """
     The test loader should only enable forced garbage collection if the
     option is passed to the trial script.
     """
     loader = trial._getLoader(self.config)
     self.assertEqual(False, loader.forceGarbageCollection)
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:7,代码来源:test_script.py


示例2: test_untilFailureSuite

 def test_untilFailureSuite(self):
     """
     The C{until-failure} configuration uses the L{runner.TestSuite} to keep
     instances alive across runs.
     """
     self.config['until-failure'] = True
     loader = trial._getLoader(self.config)
     self.assertEquals(loader.suiteFactory, runner.TestSuite)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:8,代码来源:test_script.py


示例3: test_forcedGc

 def test_forcedGc(self):
     """
     Passing the '--force-gc' option to the trial script should set the
     appropriate flag in the test loader.
     """
     self.config['force-gc'] = True
     loader = trial._getLoader(self.config)
     self.assertEqual(True, loader.forceGarbageCollection)
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:8,代码来源:test_script.py


示例4: test_alphabeticalPackage

    def test_alphabeticalPackage(self):
        """
        --order=alphabetical causes trial to run test modules within a given
        package alphabetically, with tests within each module alphabetized.
        """
        self.config.parseOptions([
            "--order", "alphabetical", "twisted.trial.test"])
        loader = trial._getLoader(self.config)
        suite = loader.loadByNames(self.config['tests'])

        names = testNames(suite)
        self.assertTrue(names, msg="Failed to load any tests!")
        self.assertEqual(names, sorted(names))
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:13,代码来源:test_script.py


示例5: test_toptobottomPackage

    def test_toptobottomPackage(self):
        """
        --order=toptobottom causes trial to run test modules within a given
        package alphabetically, with tests within each module run top to
        bottom.
        """
        self.config.parseOptions([
            "--order", "toptobottom", "twisted.trial.test"])
        loader = trial._getLoader(self.config)
        suite = loader.loadByNames(self.config['tests'])

        names = testNames(suite)
        # twisted.trial.test.test_module, so split and key on the first 4 to
        # get stable alphabetical sort on those
        self.assertEqual(
            names, sorted(names, key=lambda name : name.split(".")[:4]),
        )
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:17,代码来源:test_script.py


示例6: test_toptobottomModule

    def test_toptobottomModule(self):
        """
        --order=toptobottom causes trial to run test classes within a given
        module from top to bottom as they are defined in the module's source.
        """
        self.config.parseOptions([
            "--order", "toptobottom", "twisted.trial.test.ordertests"])
        loader = trial._getLoader(self.config)
        suite = loader.loadByNames(self.config['tests'])

        self.assertEqual(
            testNames(suite), [
            'twisted.trial.test.ordertests.FooTest.test_first',
            'twisted.trial.test.ordertests.FooTest.test_second',
            'twisted.trial.test.ordertests.FooTest.test_third',
            'twisted.trial.test.ordertests.FooTest.test_fourth',
            'twisted.trial.test.ordertests.BazTest.test_baz',
            'twisted.trial.test.ordertests.BarTest.test_bar'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:18,代码来源:test_script.py


示例7: test_alphabeticalModule

    def test_alphabeticalModule(self):
        """
        --order=alphabetical causes trial to run test classes within a given
        module alphabetically.
        """
        self.config.parseOptions([
            "--order", "alphabetical", "twisted.trial.test.ordertests"])
        loader = trial._getLoader(self.config)
        suite = loader.loadByNames(self.config['tests'])

        self.assertEqual(
            testNames(suite), [
            'twisted.trial.test.ordertests.BarTest.test_bar',
            'twisted.trial.test.ordertests.BazTest.test_baz',
            'twisted.trial.test.ordertests.FooTest.test_first',
            'twisted.trial.test.ordertests.FooTest.test_fourth',
            'twisted.trial.test.ordertests.FooTest.test_second',
            'twisted.trial.test.ordertests.FooTest.test_third'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:18,代码来源:test_script.py


示例8: test_alphabetical

    def test_alphabetical(self):
        """
        --order=alphabetical causes trial to run tests alphabetically within
        each test case.
        """
        self.config.parseOptions([
            "--order", "alphabetical",
            "twisted.trial.test.ordertests.FooTest"])

        loader = trial._getLoader(self.config)
        suite = loader.loadByNames(self.config['tests'])

        self.assertEqual(
            testNames(suite), [
            'twisted.trial.test.ordertests.FooTest.test_first',
            'twisted.trial.test.ordertests.FooTest.test_fourth',
            'twisted.trial.test.ordertests.FooTest.test_second',
            'twisted.trial.test.ordertests.FooTest.test_third'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:18,代码来源:test_script.py


示例9: test_toptobottom

    def test_toptobottom(self):
        """
        --order=toptobottom causes trial to run test methods within a given
        test case from top to bottom as they are defined in the body of the
        class.
        """
        self.config.parseOptions([
            "--order", "toptobottom",
            "twisted.trial.test.ordertests.FooTest"])

        loader = trial._getLoader(self.config)
        suite = loader.loadByNames(self.config['tests'])

        self.assertEqual(
            testNames(suite), [
            'twisted.trial.test.ordertests.FooTest.test_first',
            'twisted.trial.test.ordertests.FooTest.test_second',
            'twisted.trial.test.ordertests.FooTest.test_third',
            'twisted.trial.test.ordertests.FooTest.test_fourth'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:19,代码来源:test_script.py


示例10: test_toptobottomMissingSource

    def test_toptobottomMissingSource(self):
        """
        --order=toptobottom detects the source line of methods from modules
        whose source file is missing.
        """
        tempdir = self.mktemp()
        package = FilePath(tempdir).child('twisted_toptobottom_temp')
        package.makedirs()
        package.child('__init__.py').setContent(b'')
        package.child('test_missing.py').setContent(textwrap.dedent('''
        from twisted.trial.unittest import TestCase
        class TestMissing(TestCase):
            def test_second(self): pass
            def test_third(self): pass
            def test_fourth(self): pass
            def test_first(self): pass
        ''').encode('utf8'))
        pathEntry = package.parent().path
        sys.path.insert(0, pathEntry)
        self.addCleanup(sys.path.remove, pathEntry)
        from twisted_toptobottom_temp import test_missing
        self.addCleanup(sys.modules.pop, 'twisted_toptobottom_temp')
        self.addCleanup(sys.modules.pop, test_missing.__name__)
        package.child('test_missing.py').remove()

        self.config.parseOptions([
            "--order", "toptobottom", "twisted.trial.test.ordertests"])
        loader = trial._getLoader(self.config)
        suite = loader.loadModule(test_missing)

        self.assertEqual(
            testNames(suite), [
            'twisted_toptobottom_temp.test_missing.TestMissing.test_second',
            'twisted_toptobottom_temp.test_missing.TestMissing.test_third',
            'twisted_toptobottom_temp.test_missing.TestMissing.test_fourth',
            'twisted_toptobottom_temp.test_missing.TestMissing.test_first'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:36,代码来源:test_script.py


示例11: test_defaultSuite

 def test_defaultSuite(self):
     """
     By default, the loader should use L{runner.DestructiveTestSuite}
     """
     loader = trial._getLoader(self.config)
     self.assertEquals(loader.suiteFactory, runner.DestructiveTestSuite)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:6,代码来源:test_script.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python trial._getSuite函数代码示例发布时间:2022-05-27
下一篇:
Python _twistd_unix.UnixApplicationRunner类代码示例发布时间: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