From 89710b490174983d6365d48060d7d8a2526c9643 Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Wed, 11 Feb 2015 07:52:48 +0000 Subject: [PATCH 1/4] Fix: FAQ grammar and spelling --HG-- branch : jeffwidman/fix-faq-grammar-and-spelling-1423641159173 --- doc/en/faq.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/en/faq.txt b/doc/en/faq.txt index b4312ac12..48d99675b 100644 --- a/doc/en/faq.txt +++ b/doc/en/faq.txt @@ -30,15 +30,15 @@ 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 -`_ plugin which allows to -return deferreds from pytest-style tests, allowing to use +`_ plugin which allows you to +return deferreds from pytest-style tests, allowing the use of :ref:`fixtures` and other features. how does pytest work with Django? ++++++++++++++++++++++++++++++++++++++++++++++ In 2012, some work is going into the `pytest-django plugin `_. It substitutes the usage of Django's -``manage.py test`` and allows to use all pytest features_ most of which +``manage.py test`` and allows the use of all pytest features_ most of which are not available from Django directly. .. _features: features.html @@ -49,7 +49,7 @@ What's this "magic" with pytest? (historic notes) Around 2007 (version ``0.8``) some people thought that ``pytest`` was using too much "magic". It had been part of the `pylib`_ which -contains a lot of unreleated python library code. Around 2010 there +contains a lot of unrelated python library code. Around 2010 there was a major cleanup refactoring, which removed unused or deprecated code and resulted in the new ``pytest`` PyPI package which strictly contains only test-related code. This release also brought a complete pluginification @@ -63,7 +63,7 @@ A second "magic" issue was the assert statement debugging feature. Nowadays, ``pytest`` explicitely rewrites assert statements in test modules in order to provide more useful :ref:`assert feedback `. This completely avoids previous issues of confusing assertion-reporting. -It also means, that you can use Python's ``-O`` optimization without loosing +It also means, that you can use Python's ``-O`` optimization without losing assertions in test modules. ``pytest`` contains a second, mostly obsolete, assert debugging technique, @@ -105,7 +105,7 @@ Is using pytest fixtures versus xUnit setup a style question? For simple applications and for people experienced with nose_ or unittest-style test setup using `xUnit style setup`_ probably -feels natural. For larger test suites, parametrized testing +feels natural. For larger test suites, parameterized testing or setup of complex test resources using funcargs_ may feel more natural. Moreover, funcargs are ideal for writing advanced test support code (like e.g. the monkeypatch_, the tmpdir_ or capture_ funcargs) @@ -152,13 +152,13 @@ pytest interaction with other packages Issues with pytest, multiprocess and setuptools? +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -On windows the multiprocess package will instantiate sub processes +On Windows the multiprocess package will instantiate sub processes by pickling and thus implicitly re-import a lot of local modules. Unfortunately, setuptools-0.6.11 does not ``if __name__=='__main__'`` protect its generated command line script. This leads to infinite recursion when running a test that instantiates Processes. -As of middle 2013, there shouldn't be a problem anymore when you +As of mid-2013, there shouldn't be a problem anymore when you use the standard setuptools (note that distribute has been merged back into setuptools which is now shipped directly with virtualenv). From 6a237bd49fa0e4e6785d3aa092192b861680c54b Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Wed, 11 Feb 2015 19:27:51 +0000 Subject: [PATCH 2/4] Changed back to "parametrized" to match the API --HG-- branch : jeffwidman/fix-faq-grammar-and-spelling-1423641159173 --- doc/en/faq.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/faq.txt b/doc/en/faq.txt index 48d99675b..2f7bd17d2 100644 --- a/doc/en/faq.txt +++ b/doc/en/faq.txt @@ -105,7 +105,7 @@ Is using pytest fixtures versus xUnit setup a style question? For simple applications and for people experienced with nose_ or unittest-style test setup using `xUnit style setup`_ probably -feels natural. For larger test suites, parameterized testing +feels natural. For larger test suites, parametrized testing or setup of complex test resources using funcargs_ may feel more natural. Moreover, funcargs are ideal for writing advanced test support code (like e.g. the monkeypatch_, the tmpdir_ or capture_ funcargs) From e19f3c260f9eb9756cca83e1cc96a0fa760bad46 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 19 Feb 2015 03:03:56 -0800 Subject: [PATCH 3/4] Remove pdbpp xfails; don't seem necessary anymore It seems that they're no longer necessary as the tests pass now [marca@marca-mac2 pytest]$ pip freeze backports.inspect==0.0.2 fancycompleter==0.4 funcsigs==0.2 ordereddict==1.1 -e hg+ssh://hg@bitbucket.org/antocuni/pdb@4bda65ac8f8cc9b1850e0301669aac39200f2f9a#egg=pdbpp-fix_pytest_doctest_NoneType_object_has_no_attribute_lower py==1.4.26 Pygments==1.6 pyrepl==0.8.4 -e hg+ssh://hg@bitbucket.org/hpk42/pytest@5fc366c50b56a94638c959be8456d2cb3c7e7c1c#egg=pytest-dev wmctrl==0.1 [marca@marca-mac2 pytest]$ py.test testing/test_doctest.py --tb=short ============================================================================= test session starts ============================================================================== platform darwin -- Python 2.7.9 -- py-1.4.26 -- pytest-2.7.0.dev1 collected 22 items testing/test_doctest.py ...................... ========================================================================== 22 passed in 1.61 seconds =========================================================================== See https://bitbucket.org/antocuni/pdb/issue/24/doctests-fail-when-pdbpp-is-installed --HG-- branch : remove_pdbpp_xfail --- testing/test_doctest.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index aa1795874..80a861bfc 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -3,8 +3,6 @@ import py, pytest import pdb -xfail_if_pdbpp_installed = pytest.mark.xfail(hasattr(pdb, "__author__"), - reason="doctest/pdbpp problem: https://bitbucket.org/antocuni/pdb/issue/24/doctests-fail-when-pdbpp-is-installed", run=False) class TestDoctests: @@ -161,7 +159,6 @@ class TestDoctests: reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(failed=1) - @xfail_if_pdbpp_installed def test_doctestmodule_external_and_issue116(self, testdir): p = testdir.mkpydir("hello") p.join("__init__.py").write(py.code.Source(""" @@ -201,7 +198,6 @@ class TestDoctests: "*test_txtfile_failing.txt:2: DocTestFailure" ]) - @xfail_if_pdbpp_installed def test_txtfile_with_fixtures(self, testdir): p = testdir.maketxtfile(""" >>> dir = getfixture('tmpdir') @@ -211,7 +207,6 @@ class TestDoctests: reprec = testdir.inline_run(p, ) reprec.assertoutcome(passed=1) - @xfail_if_pdbpp_installed def test_txtfile_with_usefixtures_in_ini(self, testdir): testdir.makeini(""" [pytest] @@ -232,7 +227,6 @@ class TestDoctests: reprec = testdir.inline_run(p, ) reprec.assertoutcome(passed=1) - @xfail_if_pdbpp_installed def test_doctestmodule_with_fixtures(self, testdir): p = testdir.makepyfile(""" ''' @@ -244,7 +238,6 @@ class TestDoctests: reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(passed=1) - @xfail_if_pdbpp_installed def test_doctestmodule_three_tests(self, testdir): p = testdir.makepyfile(""" ''' @@ -270,7 +263,6 @@ class TestDoctests: reprec = testdir.inline_run(p, "--doctest-modules") reprec.assertoutcome(passed=3) - @xfail_if_pdbpp_installed def test_doctestmodule_two_tests_one_fail(self, testdir): p = testdir.makepyfile(""" class MyClass: From 777bde7c604ad5ae70dfb25632fe621255b40b84 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 19 Feb 2015 03:22:05 -0800 Subject: [PATCH 4/4] Remove xfail_if_pdbpp_installed from test_pdb.py --HG-- branch : remove_pdbpp_xfail --- testing/test_pdb.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index cc1f1e10e..f0cf2b333 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -2,7 +2,6 @@ import py import sys -from test_doctest import xfail_if_pdbpp_installed class TestPDB: def pytest_funcarg__pdblist(self, request): @@ -187,7 +186,6 @@ class TestPDB: if child.isalive(): child.wait() - @xfail_if_pdbpp_installed def test_pdb_interaction_doctest(self, testdir): p1 = testdir.makepyfile(""" import pytest