1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/cc9892350f7e/ changeset: cc9892350f7e user: hpk42 date: 2012-10-22 19:22:01 summary: improve support for trial a bit more: don't run trial's empty TestCase.runTest() method affected #: 6 files diff -r 65a3b95407512a9492e5cd755768c7f6022ab77f -r cc9892350f7e43b6b9d84f7bb6ae6f907181b235 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,9 @@ - fix unittest behaviour: TestCase.runtest only called if there are test methods defined +- improve trial support: don't collect its empty + unittest.TestCase.runTest() method + - "python setup.py test" now works with pytest itself - fix/improve internal/packaging related bits: diff -r 65a3b95407512a9492e5cd755768c7f6022ab77f -r cc9892350f7e43b6b9d84f7bb6ae6f907181b235 _pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.3.2.dev8' +__version__ = '2.3.2.dev9' diff -r 65a3b95407512a9492e5cd755768c7f6022ab77f -r cc9892350f7e43b6b9d84f7bb6ae6f907181b235 _pytest/unittest.py --- a/_pytest/unittest.py +++ b/_pytest/unittest.py @@ -39,8 +39,11 @@ foundsomething = True if not foundsomething: - if getattr(self.obj, 'runTest', None) is not None: - yield TestCaseFunction('runTest', parent=self) + runtest = getattr(self.obj, 'runTest', None) + if runtest is not None: + ut = sys.modules.get("twisted.trial.unittest", None) + if ut is None or runtest != ut.TestCase.runTest: + yield TestCaseFunction('runTest', parent=self) def setup(self): meth = getattr(self.obj, 'setUpClass', None) diff -r 65a3b95407512a9492e5cd755768c7f6022ab77f -r cc9892350f7e43b6b9d84f7bb6ae6f907181b235 doc/en/faq.txt --- a/doc/en/faq.txt +++ b/doc/en/faq.txt @@ -25,10 +25,13 @@ Since some time py.test has builtin support for supporting tests written using trial. It does not itself start a reactor, however, -and does not handle Deferreds returned from a test. Someone using -these features might eventually write a dedicated ``pytest-twisted`` -plugin which will surely see strong support from the pytest development -team. +and does not handle Deferreds returned from a test in pytest style. +If you are using trial's unittest.TestCase chances are that you can +just run your tests even if you return Deferreds. In addition, +there also is a dedicated `pytest-twisted +<http://pypi.python.org/pypi/pytest-twisted`` plugin which allows to +return deferreds from pytest-style tests, allowing to use +:ref:`fixtures` and other features. how does py.test work with Django? ++++++++++++++++++++++++++++++++++++++++++++++ diff -r 65a3b95407512a9492e5cd755768c7f6022ab77f -r cc9892350f7e43b6b9d84f7bb6ae6f907181b235 setup.py --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.3.2.dev8', + version='2.3.2.dev9', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff -r 65a3b95407512a9492e5cd755768c7f6022ab77f -r cc9892350f7e43b6b9d84f7bb6ae6f907181b235 testing/test_unittest.py --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -277,7 +277,27 @@ class TestTrialUnittest: def setup_class(cls): - pytest.importorskip("twisted.trial.unittest") + cls.ut = pytest.importorskip("twisted.trial.unittest") + + def test_trial_testcase_runtest_not_collected(self, testdir): + testdir.makepyfile(""" + from twisted.trial.unittest import TestCase + + class TC(TestCase): + def test_hello(self): + pass + """) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=1) + testdir.makepyfile(""" + from twisted.trial.unittest import TestCase + + class TC(TestCase): + def runTest(self): + pass + """) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=1) def test_trial_exceptions_with_skips(self, testdir): testdir.makepyfile(""" @@ -322,7 +342,7 @@ "*i2wanto*", "*sys.version_info*", "*skip_in_method*", - "*5 skipped*3 xfail*1 xpass*", + "*4 skipped*3 xfail*1 xpass*", ]) def test_trial_error(self, testdir): 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. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn