[svn r63050] * disabled classes or modules will now lead to a skip during setup of the colitem
* more graceful handling when "ssh" is not present --HG-- branch : trunk
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import py
|
||||
|
||||
from py.__.test.outcome import Skipped
|
||||
|
||||
class TestModule:
|
||||
def test_module_file_not_found(self, testdir):
|
||||
tmpdir = testdir.tmpdir
|
||||
@@ -38,15 +40,6 @@ class TestModule:
|
||||
x = l.pop()
|
||||
assert x is None
|
||||
|
||||
def test_disabled_module(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
disabled = True
|
||||
def setup_module(mod):
|
||||
raise ValueError
|
||||
""")
|
||||
assert not modcol.collect()
|
||||
assert not modcol.run()
|
||||
|
||||
def test_module_participates_as_plugin(self, testdir):
|
||||
modcol = testdir.getmodulecol("")
|
||||
modcol.setup()
|
||||
@@ -58,6 +51,18 @@ class TestModule:
|
||||
modcol = testdir.getmodulecol("pytest_plugins='xasdlkj',")
|
||||
py.test.raises(ImportError, "modcol.obj")
|
||||
|
||||
def test_disabled_module(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
disabled = True
|
||||
def setup_module(mod):
|
||||
raise ValueError
|
||||
def test_method():
|
||||
pass
|
||||
""")
|
||||
l = modcol.collect()
|
||||
assert len(l) == 1
|
||||
py.test.raises(Skipped, "modcol.setup()")
|
||||
|
||||
class TestClass:
|
||||
def test_disabled_class(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
@@ -70,7 +75,9 @@ class TestClass:
|
||||
assert len(l) == 1
|
||||
modcol = l[0]
|
||||
assert isinstance(modcol, py.test.collect.Class)
|
||||
assert not modcol.collect()
|
||||
l = modcol.collect()
|
||||
assert len(l) == 1
|
||||
py.test.raises(Skipped, "modcol.setup()")
|
||||
|
||||
class TestGenerator:
|
||||
def test_generative_functions(self, testdir):
|
||||
|
||||
Reference in New Issue
Block a user