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))
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')"
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))