From 701d5fc7276af308b9bbaae2f230848d9246b626 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 3 Aug 2016 16:31:44 -0400 Subject: [PATCH 1/4] Regendoc after more fixes on features branch --- doc/en/assert.rst | 3 ++- doc/en/cache.rst | 1 + doc/en/example/markers.rst | 16 ++++++++-------- doc/en/example/parametrize.rst | 4 ++-- doc/en/example/simple.rst | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/en/assert.rst b/doc/en/assert.rst index 4af997a79..4ddc96056 100644 --- a/doc/en/assert.rst +++ b/doc/en/assert.rst @@ -246,7 +246,8 @@ the conftest file:: f1 = Foo(1) f2 = Foo(2) > assert f1 == f2 - E AssertionError + E assert Comparing Foo instances: + E vals: 1 != 2 test_foocompare.py:11: AssertionError 1 failed in 0.12 seconds diff --git a/doc/en/cache.rst b/doc/en/cache.rst index ebb949951..e7784c953 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -110,6 +110,7 @@ If you then run it with ``--lf``:: E Failed: bad luck test_50.py:6: Failed + ======= 48 tests deselected ======== ======= 2 failed, 48 deselected in 0.12 seconds ======== You have run only the two failing test from the last run, while 48 tests have diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index f8f2e47ce..b4bb74377 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -38,7 +38,7 @@ You can then restrict a test run to only run tests marked with ``webtest``:: test_server.py::test_send_http PASSED - ======= 3 tests deselected by "-m 'webtest'" ======== + ======= 3 tests deselected ======== ======= 1 passed, 3 deselected in 0.12 seconds ======== Or the inverse, running all tests except the webtest ones:: @@ -54,7 +54,7 @@ Or the inverse, running all tests except the webtest ones:: test_server.py::test_another PASSED test_server.py::TestClass::test_method PASSED - ======= 1 tests deselected by "-m 'not webtest'" ======== + ======= 1 tests deselected ======== ======= 3 passed, 1 deselected in 0.12 seconds ======== Selecting tests based on their node ID @@ -137,7 +137,7 @@ select tests based on their names:: test_server.py::test_send_http PASSED - ======= 3 tests deselected by '-khttp' ======== + ======= 3 tests deselected ======== ======= 1 passed, 3 deselected in 0.12 seconds ======== And you can also run all tests except the ones that match the keyword:: @@ -153,7 +153,7 @@ And you can also run all tests except the ones that match the keyword:: test_server.py::test_another PASSED test_server.py::TestClass::test_method PASSED - ======= 1 tests deselected by '-knot send_http' ======== + ======= 1 tests deselected ======== ======= 3 passed, 1 deselected in 0.12 seconds ======== Or to select "http" and "quick" tests:: @@ -168,7 +168,7 @@ Or to select "http" and "quick" tests:: test_server.py::test_send_http PASSED test_server.py::test_something_quick PASSED - ======= 2 tests deselected by '-khttp or quick' ======== + ======= 2 tests deselected ======== ======= 2 passed, 2 deselected in 0.12 seconds ======== .. note:: @@ -505,7 +505,7 @@ Note that if you specify a platform via the marker-command line option like this test_plat.py s - ======= 3 tests deselected by "-m 'linux2'" ======== + ======= 3 tests deselected ======== ======= 1 skipped, 3 deselected in 0.12 seconds ======== then the unmarked-tests will not be run. It is thus a way to restrict the run to the specific tests. @@ -566,7 +566,7 @@ We can now use the ``-m option`` to select one set:: test_module.py:6: in test_interface_complex assert 0 E assert 0 - ======= 2 tests deselected by "-m 'interface'" ======== + ======= 2 tests deselected ======== ======= 2 failed, 2 deselected in 0.12 seconds ======== or to select both "event" and "interface" tests:: @@ -592,5 +592,5 @@ or to select both "event" and "interface" tests:: test_module.py:9: in test_event_simple assert 0 E assert 0 - ======= 1 tests deselected by "-m 'interface or event'" ======== + ======= 1 tests deselected ======== ======= 3 failed, 1 deselected in 0.12 seconds ======== diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 7a193d98f..197a54263 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -369,7 +369,7 @@ argument sets to use for each test function. Let's run it:: $ pytest -q F.. ======= FAILURES ======== - _______ TestClass.test_equals[2-1] ________ + _______ TestClass.test_equals[1-2] ________ self = , a = 1, b = 2 @@ -399,8 +399,8 @@ Running it results in some skips if we don't have all the python interpreters in . $ pytest -rs -q multipython.py ssssssssssss...ssssssssssss ======= short test summary info ======== - SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python3.3' not found SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found + SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python3.3' not found 3 passed, 24 skipped in 0.12 seconds Indirect parametrization of optional implementations/imports diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index a4f11f466..a4eca9e66 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -501,7 +501,7 @@ We can run this:: file $REGENDOC_TMPDIR/b/test_error.py, line 1 def test_root(db): # no db here, will error out E fixture 'db' not found - available fixtures: monkeypatch, capfd, recwarn, pytestconfig, tmpdir_factory, tmpdir, cache, capsys, record_xml_property, doctest_namespace + available fixtures: cache, capfd, capsys, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory use 'pytest --fixtures [testpath]' for help on them. $REGENDOC_TMPDIR/b/test_error.py:1 From 72df32f1fd106e642114b2aee8ba1820ab5f82ec Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 3 Aug 2016 17:34:55 -0300 Subject: [PATCH 2/4] Fix missing print() --- doc/en/capture.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/capture.rst b/doc/en/capture.rst index b9be8bd28..05ed216e9 100644 --- a/doc/en/capture.rst +++ b/doc/en/capture.rst @@ -97,7 +97,7 @@ that performs some output related checks: out, err = capsys.readouterr() assert out == "hello\n" assert err == "world\n" - print "next" + print ("next") out, err = capsys.readouterr() assert out == "next\n" From d28801d79498b9e1b27693597e74395476ca1629 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 3 Aug 2016 16:48:11 -0400 Subject: [PATCH 3/4] Make parametrize example deterministic --- doc/en/example/parametrize.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 197a54263..06d6ae767 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -346,7 +346,7 @@ parametrizer`_ but in a lot less code:: def pytest_generate_tests(metafunc): # called once per each test function funcarglist = metafunc.cls.params[metafunc.function.__name__] - argnames = list(funcarglist[0]) + argnames = sorted(funcarglist[0]) metafunc.parametrize(argnames, [[funcargs[name] for name in argnames] for funcargs in funcarglist]) @@ -397,11 +397,10 @@ is to be run with different sets of arguments for its three arguments: Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize):: . $ pytest -rs -q multipython.py - ssssssssssss...ssssssssssss + sssssssssssssss.........sss.........sss......... ======= short test summary info ======== - SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found - SKIP [12] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python3.3' not found - 3 passed, 24 skipped in 0.12 seconds + SKIP [21] $REGENDOC_TMPDIR/CWD/multipython.py:23: 'python2.6' not found + 27 passed, 21 skipped in 0.12 seconds Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- From 8b8c698f1a02789e54d6f765872facf099ab851c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 3 Aug 2016 16:48:49 -0400 Subject: [PATCH 4/4] Add more interpreter versions to multipython example --- doc/en/example/multipython.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/example/multipython.py b/doc/en/example/multipython.py index 66a368a12..1f5e976ef 100644 --- a/doc/en/example/multipython.py +++ b/doc/en/example/multipython.py @@ -6,7 +6,7 @@ import py import pytest import _pytest._code -pythonlist = ['python2.6', 'python2.7', 'python3.3'] +pythonlist = ['python2.6', 'python2.7', 'python3.4', 'python3.5'] @pytest.fixture(params=pythonlist) def python1(request, tmpdir): picklefile = tmpdir.join("data.pickle")