use new marking idioms, simplify generalized skipping implementation
--HG-- branch : trunk
This commit is contained in:
@@ -208,7 +208,7 @@ class TestLocalPath(common.CommonFSTests):
|
||||
assert l[2] == p3
|
||||
|
||||
class TestExecutionOnWindows:
|
||||
skipif = "sys.platform != 'win32'"
|
||||
pytestmark = py.test.mark.skipif("sys.platform != 'win32'")
|
||||
|
||||
def test_sysfind(self):
|
||||
x = py.path.local.sysfind('cmd')
|
||||
@@ -216,7 +216,7 @@ class TestExecutionOnWindows:
|
||||
assert py.path.local.sysfind('jaksdkasldqwe') is None
|
||||
|
||||
class TestExecution:
|
||||
skipif = "sys.platform == 'win32'"
|
||||
pytestmark = py.test.mark.skipif("sys.platform == 'win32'")
|
||||
|
||||
def test_sysfind(self):
|
||||
x = py.path.local.sysfind('test')
|
||||
@@ -346,7 +346,7 @@ def test_homedir():
|
||||
assert homedir.check(dir=1)
|
||||
|
||||
class TestWINLocalPath:
|
||||
skipif = "sys.platform != 'win32'"
|
||||
pytestmark = py.test.mark.skipif("sys.platform != 'win32'")
|
||||
|
||||
def test_owner_group_not_implemented(self):
|
||||
py.test.raises(NotImplementedError, "path1.stat().owner")
|
||||
@@ -395,7 +395,7 @@ class TestWINLocalPath:
|
||||
old.chdir()
|
||||
|
||||
class TestPOSIXLocalPath:
|
||||
skipif = "sys.platform == 'win32'"
|
||||
pytestmark = py.test.mark.skipif("sys.platform == 'win32'")
|
||||
|
||||
def test_samefile(self, tmpdir):
|
||||
assert tmpdir.samefile(tmpdir)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import py, sys, os
|
||||
|
||||
skipif = "not hasattr(os, 'fork')"
|
||||
pytestmark = py.test.mark.skipif("not hasattr(os, 'fork')")
|
||||
|
||||
def test_waitfinish_removes_tempdir():
|
||||
ff = py.process.ForkedFunc(boxf1)
|
||||
|
||||
@@ -218,7 +218,8 @@ class TestExecutionNonForked(BaseFunctionalTests):
|
||||
py.test.fail("did not raise")
|
||||
|
||||
class TestExecutionForked(BaseFunctionalTests):
|
||||
skipif = "not hasattr(os, 'fork')"
|
||||
pytestmark = py.test.mark.skipif("not hasattr(os, 'fork')")
|
||||
|
||||
def getrunner(self):
|
||||
return runner.forked_run_report
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ def test_xfail_decorator(testdir):
|
||||
|
||||
def test_xfail_at_module(testdir):
|
||||
p = testdir.makepyfile("""
|
||||
xfail = 'True'
|
||||
|
||||
import py
|
||||
pytestmark = py.test.mark.xfail('True')
|
||||
def test_intentional_xfail():
|
||||
assert 0
|
||||
""")
|
||||
@@ -76,8 +76,9 @@ def test_skipif_decorator(testdir):
|
||||
def test_skipif_class(testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import py
|
||||
|
||||
class TestClass:
|
||||
skipif = "True"
|
||||
pytestmark = py.test.mark.skipif("True")
|
||||
def test_that(self):
|
||||
assert 0
|
||||
def test_though(self):
|
||||
@@ -88,36 +89,12 @@ def test_skipif_class(testdir):
|
||||
"*2 skipped*"
|
||||
])
|
||||
|
||||
def test_getexpression(testdir):
|
||||
from _py.test.plugin.pytest_skipping import getexpression
|
||||
l = testdir.getitems("""
|
||||
import py
|
||||
mod = 5
|
||||
class TestClass:
|
||||
cls = 4
|
||||
@py.test.mark.func(3)
|
||||
def test_func(self):
|
||||
pass
|
||||
@py.test.mark.just
|
||||
def test_other(self):
|
||||
pass
|
||||
""")
|
||||
item, item2 = l
|
||||
assert getexpression(item, 'xyz') is None
|
||||
assert getexpression(item, 'func') == 3
|
||||
assert getexpression(item, 'cls') == 4
|
||||
assert getexpression(item, 'mod') == 5
|
||||
|
||||
assert getexpression(item2, 'just')
|
||||
|
||||
item2.parent = None
|
||||
assert not getexpression(item2, 'nada')
|
||||
|
||||
def test_evalexpression_cls_config_example(testdir):
|
||||
from _py.test.plugin.pytest_skipping import evalexpression
|
||||
item, = testdir.getitems("""
|
||||
import py
|
||||
class TestClass:
|
||||
skipif = "config._hackxyz"
|
||||
pytestmark = py.test.mark.skipif("config._hackxyz")
|
||||
def test_func(self):
|
||||
pass
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user