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


Python MarkEvaluator.istrue方法代码示例

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


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

示例1: test_marked_one_arg_unicode

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_marked_one_arg_unicode(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.xyz(u"hasattr(os, 'sep')")
         def test_func():
             pass
     """)
     ev = MarkEvaluator(item, 'xyz')
     assert ev
     assert ev.istrue()
     expl = ev.getexplanation()
     assert expl == "condition: hasattr(os, 'sep')"
开发者ID:cryporchild,项目名称:pytest,代码行数:14,代码来源:test_skipping.py

示例2: test_marked_one_arg_twice2

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_marked_one_arg_twice2(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.skipif("hasattr(os, 'murks')")
         @pytest.mark.skipif("not hasattr(os, 'murks')")
         def test_func():
             pass
     """)
     ev = MarkEvaluator(item, 'skipif')
     assert ev
     assert ev.istrue()
     expl = ev.getexplanation()
     assert expl == "condition: not hasattr(os, 'murks')"
开发者ID:cryporchild,项目名称:pytest,代码行数:15,代码来源:test_skipping.py

示例3: test_marked_one_arg_with_reason

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_marked_one_arg_with_reason(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.xyz("hasattr(os, 'sep')", attr=2, reason="hello world")
         def test_func():
             pass
     """)
     ev = MarkEvaluator(item, 'xyz')
     assert ev
     assert ev.istrue()
     expl = ev.getexplanation()
     assert expl == "hello world"
     assert ev.get("attr") == 2
开发者ID:cryporchild,项目名称:pytest,代码行数:15,代码来源:test_skipping.py

示例4: test_marked_no_args

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_marked_no_args(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.xyz
         def test_func():
             pass
     """)
     ev = MarkEvaluator(item, 'xyz')
     assert ev
     assert ev.istrue()
     expl = ev.getexplanation()
     assert expl == ""
     assert not ev.get("run", False)
开发者ID:cryporchild,项目名称:pytest,代码行数:15,代码来源:test_skipping.py

示例5: test_skipif_class

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_skipif_class(self, testdir):
     item, = testdir.getitems("""
         import pytest
         class TestClass(object):
             pytestmark = pytest.mark.skipif("config._hackxyz")
             def test_func(self):
                 pass
     """)
     item.config._hackxyz = 3
     ev = MarkEvaluator(item, 'skipif')
     assert ev.istrue()
     expl = ev.getexplanation()
     assert expl == "condition: config._hackxyz"
开发者ID:cryporchild,项目名称:pytest,代码行数:15,代码来源:test_skipping.py

示例6: test_marked_one_arg_twice

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_marked_one_arg_twice(self, testdir):
     lines = [
         '''@pytest.mark.skipif("not hasattr(os, 'murks')")''',
         '''@pytest.mark.skipif("hasattr(os, 'murks')")'''
     ]
     for i in range(0, 2):
         item = testdir.getitem("""
             import pytest
             %s
             %s
             def test_func():
                 pass
         """ % (lines[i], lines[(i + 1) % 2]))
         ev = MarkEvaluator(item, 'skipif')
         assert ev
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == "condition: not hasattr(os, 'murks')"
开发者ID:cryporchild,项目名称:pytest,代码行数:20,代码来源:test_skipping.py

示例7: test_no_marker

# 需要导入模块: from _pytest.skipping import MarkEvaluator [as 别名]
# 或者: from _pytest.skipping.MarkEvaluator import istrue [as 别名]
 def test_no_marker(self, testdir):
     item = testdir.getitem("def test_func(): pass")
     evalskipif = MarkEvaluator(item, 'skipif')
     assert not evalskipif
     assert not evalskipif.istrue()
开发者ID:cryporchild,项目名称:pytest,代码行数:7,代码来源:test_skipping.py


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