Пример #1
0
 def test_skipif_using_platform(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.skipif("platform.platform() == platform.platform()")
         def test_func():
             pass
     """)
     pytest.raises(pytest.skip.Exception,
                   lambda: pytest_runtest_setup(item))
Пример #2
0
 def test_skipif_conditional(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.skipif("hasattr(os, 'sep')")
         def test_func():
             pass
     """)  # noqa
     x = pytest.raises(pytest.skip.Exception,
                       lambda: pytest_runtest_setup(item))
     assert x.value.msg == "condition: hasattr(os, 'sep')"
Пример #3
0
 def test_skipif_conditional(self, testdir):
     item = testdir.getitem("""
         import pytest
         @pytest.mark.skipif("hasattr(os, 'sep')")
         def test_func():
             pass
     """)  # noqa
     x = pytest.raises(pytest.skip.Exception, lambda:
                       pytest_runtest_setup(item))
     assert x.value.msg == "condition: hasattr(os, 'sep')"
Пример #4
0
 def test_skipif_using_platform(self, testdir):
     item = testdir.getitem(
         """
         import pytest
         @pytest.mark.skipif("platform.platform() == platform.platform()")
         def test_func():
             pass
     """
     )
     pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item))