当前位置: 首页>>代码示例>>Python>>正文


Python unittest2.skip方法代码示例

本文整理汇总了Python中unittest2.skip方法的典型用法代码示例。如果您正苦于以下问题:Python unittest2.skip方法的具体用法?Python unittest2.skip怎么用?Python unittest2.skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unittest2的用法示例。


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

示例1: setUp

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def setUp(self):
        info_cinfo = patch('lib.client.node.Node._info_cinfo')
        getfqdn = patch('lib.client.node.getfqdn')
        getaddrinfo = patch('socket.getaddrinfo')

        self.addCleanup(patch.stopall)

        lib.client.node.Node._info_cinfo = info_cinfo.start()
        lib.client.node.getfqdn = getfqdn.start()
        socket.getaddrinfo = getaddrinfo.start()

        Node._info_cinfo.return_value = ""
        lib.client.node.getfqdn.return_value = "host.domain.local"
        socket.getaddrinfo.return_value = [(2, 1, 6, '', ('192.1.1.1', 3000))]

    #@unittest.skip("Known Failure") 
开发者ID:aerospike,项目名称:aerospike-admin,代码行数:18,代码来源:test_node.py

示例2: test_skip_test

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def test_skip_test(self):
        class Skips(unittest.TestCase):
            def test_me(self):
                self.skipTest("yo")
        self.result.startTestRun()
        test = Skips("test_me")
        self.run_test_or_simulate(test, 'skipTest', self.result.addSkip, 'yo')
        self.result.stopTestRun()
        output = self.get_output()
        expected = """<testsuite errors="0" failures="0" name="" tests="1" time="0.000">
<testcase classname="junitxml.tests.test_junitxml.Skips" name="test_me" time="0.000">
<skip>yo</skip>
</testcase>
</testsuite>
"""
        self.assertEqual(expected, output) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:18,代码来源:test_junitxml.py

示例3: test_skip_reason

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def test_skip_reason(self):
        """Check the skip element content is escaped"""
        class SkipWithLt(unittest.TestCase):
            def runTest(self):
                self.fail("version < 2.7")
            try:
                runTest = unittest.skip("2.7 <= version")(runTest)
            except AttributeError:
                self.has_skip = False
            else:
                self.has_skip = True
        doc = self._run_and_parse_test(SkipWithLt())
        if self.has_skip:
            self.assertEqual('2.7 <= version',
                doc.getElementsByTagName("skip")[0].firstChild.nodeValue)
        else:
            self.assertTrue(
                doc.getElementsByTagName("failure")[0].firstChild.nodeValue
                    .endswith("AssertionError: version < 2.7\n")) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:21,代码来源:test_junitxml.py

示例4: test_class_not_setup_or_torndown_when_skipped

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def test_class_not_setup_or_torndown_when_skipped(self):
        class Test(unittest2.TestCase):
            classSetUp = False
            tornDown = False
            def setUpClass(cls):
                Test.classSetUp = True
            setUpClass = classmethod(setUpClass)
            def tearDownClass(cls):
                Test.tornDown = True
            tearDownClass = classmethod(tearDownClass)
            def test_one(self):
                pass

        Test = unittest2.skip("hop")(Test)
        self.runTests(Test)
        self.assertFalse(Test.classSetUp)
        self.assertFalse(Test.tornDown) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:19,代码来源:test_setups.py

示例5: test_skipping

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def test_skipping(self):
        class Foo(unittest2.TestCase):
            def test_skip_me(self):
                self.skipTest("skip")
        events = []
        result = LoggingResult(events)
        test = Foo("test_skip_me")
        test.run(result)
        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
        self.assertEqual(result.skipped, [(test, "skip")])

        # Try letting setUp skip the test now.
        class Foo(unittest2.TestCase):
            def setUp(self):
                self.skipTest("testing")
            def test_nothing(self): pass
        events = []
        result = LoggingResult(events)
        test = Foo("test_nothing")
        test.run(result)
        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
        self.assertEqual(result.skipped, [(test, "testing")])
        self.assertEqual(result.testsRun, 1) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:25,代码来源:test_skipping.py

示例6: test_skip_doesnt_run_setup

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def test_skip_doesnt_run_setup(self):
        class Foo(unittest2.TestCase):
            wasSetUp = False
            wasTornDown = False
            def setUp(self):
                Foo.wasSetUp = True
            def tornDown(self):
                Foo.wasTornDown = True
            def test_1(self):
                pass
            test_1 = unittest2.skip('testing')(test_1)
        
        result = unittest2.TestResult()
        test = Foo("test_1")
        suite = unittest2.TestSuite([test])
        suite.run(result)
        self.assertEqual(result.skipped, [(test, "testing")])
        self.assertFalse(Foo.wasSetUp)
        self.assertFalse(Foo.wasTornDown) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:21,代码来源:test_skipping.py

示例7: test_decorated_skip

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def test_decorated_skip(self):
        def decorator(func):
            def inner(*a):
                return func(*a)
            return inner
        
        class Foo(unittest2.TestCase):
            def test_1(self):
                pass
            test_1 = decorator(unittest2.skip('testing')(test_1))
        
        result = unittest2.TestResult()
        test = Foo("test_1")
        suite = unittest2.TestSuite([test])
        suite.run(result)
        self.assertEqual(result.skipped, [(test, "testing")]) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:18,代码来源:test_skipping.py

示例8: requires_resource

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def requires_resource(resource):
    if resource == 'gui' and not _is_gui_available():
        return unittest.skip("resource 'gui' is not available")
    if is_resource_enabled(resource):
        return _id
    else:
        return unittest.skip("resource {0!r} is not enabled".format(resource)) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:9,代码来源:support.py

示例9: impl_detail

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def impl_detail(msg=None, **guards):
    if check_impl_detail(**guards):
        return _id
    if msg is None:
        guardnames, default = _parse_guards(guards)
        if default:
            msg = "implementation detail not available on {0}"
        else:
            msg = "implementation detail specific to {0}"
        guardnames = sorted(guardnames.keys())
        msg = msg.format(' or '.join(guardnames))
    return unittest.skip(msg) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:14,代码来源:support.py

示例10: skip_unless_symlink

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def skip_unless_symlink(test):
    """Skip decorator for tests that require functional symlink"""
    ok = can_symlink()
    msg = "Requires functional symlink implementation"
    return test if ok else unittest.skip(msg)(test) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:7,代码来源:support.py

示例11: skip_unless_xattr

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def skip_unless_xattr(test):
    """Skip decorator for tests that require functional extended attributes"""
    ok = can_xattr()
    msg = "no non-broken extended attribute support"
    return test if ok else unittest.skip(msg)(test) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:7,代码来源:support.py

示例12: skip_unless_solr

# 需要导入模块: import unittest2 [as 别名]
# 或者: from unittest2 import skip [as 别名]
def skip_unless_solr(func):
    """
    Use this decorator to skip tests which need a functional Solr connection.
    The connection is given by the environment SOLR_URL
    """

    if is_solr_available():
        return func
    msg = "Test needs a running Solr connection (SOLR_URL)"
    warnings.warn(msg + str(func))
    return unittest.skip(msg)(func) 
开发者ID:lugensa,项目名称:scorched,代码行数:13,代码来源:testing.py


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