[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:
hpk
2009-03-18 18:54:45 +01:00
parent 6ba07a82ba
commit f013f0a54b
6 changed files with 37 additions and 25 deletions

View File

@@ -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):