[Pytest-commit] commit/pytest: RonnyPfannschmidt: fix issue384 by removing the trial support code
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Nov 19 11:12:40 CET 2013
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/commits/ba546e167318/
Changeset: ba546e167318
User: RonnyPfannschmidt
Date: 2013-11-19 10:58:24
Summary: fix issue384 by removing the trial support code
Affected #: 3 files
diff -r 304f9f212ae373dbb55129b41b88e413baceba51 -r ba546e167318e92a2f2f052a958e093e536aff2e CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
Unreleased
-----------------------------------
+- fix issue384 by removing the trial support code
+ since the unittest compat enhancements allow
+ trial to handle it on its own
+
- fix pexpect-3.0 compatibility for pytest's own tests.
(fixes issue386)
diff -r 304f9f212ae373dbb55129b41b88e413baceba51 -r ba546e167318e92a2f2f052a958e093e536aff2e _pytest/unittest.py
--- a/_pytest/unittest.py
+++ b/_pytest/unittest.py
@@ -50,8 +50,6 @@
x = getattr(self.obj, name)
funcobj = getattr(x, 'im_func', x)
transfer_markers(funcobj, cls, module)
- if hasattr(funcobj, 'todo'):
- pytest.mark.xfail(reason=str(funcobj.todo))(funcobj)
yield TestCaseFunction(name, parent=self)
foundsomething = True
@@ -70,10 +68,6 @@
def setup(self):
self._testcase = self.parent.obj(self.name)
self._obj = getattr(self._testcase, self.name)
- if hasattr(self._testcase, 'skip'):
- pytest.skip(self._testcase.skip)
- if hasattr(self._obj, 'skip'):
- pytest.skip(self._obj.skip)
if hasattr(self._testcase, 'setup_method'):
self._testcase.setup_method(self._obj)
if hasattr(self, "_request"):
diff -r 304f9f212ae373dbb55129b41b88e413baceba51 -r ba546e167318e92a2f2f052a958e093e536aff2e testing/test_unittest.py
--- a/testing/test_unittest.py
+++ b/testing/test_unittest.py
@@ -310,9 +310,10 @@
reprec.assertoutcome(skipped=1)
-def test_testcase_skip_property(testdir):
+def test_trial_testcase_skip_property(testdir):
+
testpath = testdir.makepyfile("""
- import unittest
+ from twisted.trial import unittest
class MyTestCase(unittest.TestCase):
skip = 'dont run'
def test_func(self):
@@ -321,9 +322,11 @@
reprec = testdir.inline_run(testpath, "-s")
reprec.assertoutcome(skipped=1)
-def test_testfunction_skip_property(testdir):
+
+def test_trial_testfunction_skip_property(testdir):
+ pytest.importorskip('twisted.trial.unittest')
testpath = testdir.makepyfile("""
- import unittest
+ from twisted.trial import unittest
class MyTestCase(unittest.TestCase):
def test_func(self):
pass
@@ -333,6 +336,32 @@
reprec.assertoutcome(skipped=1)
+def test_trial_testcase_todo_property(testdir):
+
+ testpath = testdir.makepyfile("""
+ from twisted.trial import unittest
+ class MyTestCase(unittest.TestCase):
+ todo = 'dont run'
+ def test_func(self):
+ assert 0
+ """)
+ reprec = testdir.inline_run(testpath, "-s")
+ reprec.assertoutcome(skipped=1)
+
+
+def test_trial_testfunction_todo_property(testdir):
+ pytest.importorskip('twisted.trial.unittest')
+ testpath = testdir.makepyfile("""
+ from twisted.trial import unittest
+ class MyTestCase(unittest.TestCase):
+ def test_func(self):
+ assert 0
+ test_func.todo = 'dont run'
+ """)
+ reprec = testdir.inline_run(testpath, "-s")
+ reprec.assertoutcome(skipped=1)
+
+
class TestTrialUnittest:
def setup_class(cls):
cls.ut = pytest.importorskip("twisted.trial.unittest")
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list