From 27b62740e38c5b781195f29dad67fb8d1f7c6ac5 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 12:47:17 +0100 Subject: [PATCH 01/28] Fix minor mistake in usage doc (pkg instead of pypkg) --- doc/en/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/usage.rst b/doc/en/usage.rst index 4b92fd1e1..08c158aac 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -56,7 +56,7 @@ Several test run options:: Import 'pkg' and use its filesystem location to find and run tests:: - py.test --pyargs pkg # run all tests found below directory of pypkg + py.test --pyargs pkg # run all tests found below directory of pkg Modifying Python traceback printing ---------------------------------------------- From bdb3581a52f018a489abca0a4fc676f3f09da111 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 13:18:17 +0100 Subject: [PATCH 02/28] Fix minor mistake in test discovery doc The example output shown was for Python3 not Python2. Add Python2 output and rephrase for clarity. --- doc/en/example/pythoncollection.rst | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 5faf4c6c8..6edab15a8 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -177,16 +177,27 @@ and a setup.py dummy file like this:: # content of setup.py 0/0 # will raise exception if imported -then a pytest run on python2 will find the one test when run with a python2 -interpreters and will leave out the setup.py file:: +then a pytest run on Python2 will find the one test and will leave out the +setup.py file:: $ py.test --collect-only - ======= test session starts ======== - platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 + ====== test session starts ====== + platform linux2 -- Python 2.7.10, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 + rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + collected 1 items + + + + ====== no tests ran in 0.04 seconds ====== + +If you run with a Python3 interpreter both the one test and the setup.py file +will be left out:: + + $ py.test --collect-only + ====== test session starts ====== + platform linux -- Python 3.4.3+, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini collected 0 items - - ======= no tests ran in 0.12 seconds ======== -If you run with a Python3 interpreter the moduled added through the conftest.py file will not be considered for test collection. + ====== no tests ran in 0.03 seconds ====== From 266b53dfc29b142da9eeabc8be57e0c563b76708 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 13:36:19 +0100 Subject: [PATCH 03/28] Add Jenkins xUnit Plugin link to doc --- doc/en/goodpractices.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/en/goodpractices.rst b/doc/en/goodpractices.rst index 2d8050bd9..89396b57e 100644 --- a/doc/en/goodpractices.rst +++ b/doc/en/goodpractices.rst @@ -153,7 +153,9 @@ against your source code checkout, helping to detect packaging glitches. Continuous integration services such as Jenkins_ can make use of the -``--junitxml=PATH`` option to create a JUnitXML file and generate reports. +``--junitxml=PATH`` option to create a JUnitXML file and generate reports (e.g. +by publishing the results in a nice format with the `Jenkins xUnit Plugin +`_). Integrating with setuptools / ``python setup.py test`` / ``pytest-runner`` From 3135463573e694dff4464b4fba813bc80bdd2e20 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 13:47:50 +0100 Subject: [PATCH 04/28] No longer refer to the 'yield fixture mechanism' as experimental (doc) The feature has been there for a long time and in the 2.7.1 release notes it says: > fixed docs to remove the notion that yield-fixtures are experimental. Therefore this one place was probably just missed. --- doc/en/fixture.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index f48607ae2..1c7fc3482 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -36,9 +36,9 @@ style ` or :ref:`nose based ` projects. .. note:: - pytest-2.4 introduced an additional experimental - :ref:`yield fixture mechanism ` for easier context manager - integration and more linear writing of teardown code. + pytest-2.4 introduced an additional :ref:`yield fixture mechanism + ` for easier context manager integration and more linear + writing of teardown code. .. _`funcargs`: .. _`funcarg mechanism`: From dff914cadda7745b2d4af055d64af14fb514fc40 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 14:10:20 +0100 Subject: [PATCH 05/28] Add short explanation and link to yield fixtures in fixture doc --- doc/en/fixture.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index 1c7fc3482..4e302b758 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -283,6 +283,14 @@ module itself does not need to change or know about these details of fixture setup. +Finalization/teardown with yield fixtures +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Another alternative to the *request.addfinalizer()* method is to use *yield +fixtures*. All the code after the *yield* statement serves as the teardown +code. See the :ref:`yield fixture documentation `. + + .. _`request-context`: Fixtures can introspect the requesting test context From f70ed8347986301c579670a5675e03681bc597b8 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 15:53:32 +0100 Subject: [PATCH 06/28] Fix 'test grouping by fixture instances' doc example The fin() function was never added as a finalizer and did therefore not print anything in the captured output. In general improve the output by making it more verbose/explicit and extend the final explanation. --- doc/en/fixture.rst | 96 ++++++++++++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index 4e302b758..0235448ee 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -585,55 +585,85 @@ to show the setup/teardown flow:: @pytest.fixture(scope="module", params=["mod1", "mod2"]) def modarg(request): param = request.param - print ("create", param) + print (" SETUP modarg %s" % param) def fin(): - print ("fin %s" % param) + print (" TEARDOWN modarg %s" % param) + request.addfinalizer(fin) return param @pytest.fixture(scope="function", params=[1,2]) def otherarg(request): - return request.param + param = request.param + print (" SETUP otherarg %s" % param) + def fin(): + print (" TEARDOWN otherarg %s" % param) + request.addfinalizer(fin) + return param def test_0(otherarg): - print (" test0", otherarg) + print (" RUN test0 with otherarg %s" % otherarg) def test_1(modarg): - print (" test1", modarg) + print (" RUN test1 with modarg %s" % modarg) def test_2(otherarg, modarg): - print (" test2", otherarg, modarg) + print (" RUN test2 with otherarg %s and modarg %s" % (otherarg, modarg)) + Let's run the tests in verbose mode and with looking at the print-output:: $ py.test -v -s test_module.py - ======= test session starts ======== - platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.4 + ====== test session starts ====== + platform linux -- Python 3.4.3+, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3 cachedir: .cache rootdir: $REGENDOC_TMPDIR, inifile: - collecting ... collected 8 items - - test_module.py::test_0[1] test0 1 - PASSED - test_module.py::test_0[2] test0 2 - PASSED - test_module.py::test_1[mod1] create mod1 - test1 mod1 - PASSED - test_module.py::test_2[1-mod1] test2 1 mod1 - PASSED - test_module.py::test_2[2-mod1] test2 2 mod1 - PASSED - test_module.py::test_1[mod2] create mod2 - test1 mod2 - PASSED - test_module.py::test_2[1-mod2] test2 1 mod2 - PASSED - test_module.py::test_2[2-mod2] test2 2 mod2 - PASSED - - ======= 8 passed in 0.12 seconds ======== + collected 8 items -You can see that the parametrized module-scoped ``modarg`` resource caused -an ordering of test execution that lead to the fewest possible "active" resources. The finalizer for the ``mod1`` parametrized resource was executed -before the ``mod2`` resource was setup. + test_module.py::test_0[1] SETUP otherarg 1 + RUN test0 with otherarg 1 + PASSED TEARDOWN otherarg 1 + + test_module.py::test_0[2] SETUP otherarg 2 + RUN test0 with otherarg 2 + PASSED TEARDOWN otherarg 2 + + test_module.py::test_1[mod1] SETUP modarg mod1 + RUN test1 with modarg mod1 + PASSED + test_module.py::test_2[1-mod1] SETUP otherarg 1 + RUN test2 with otherarg 1 and modarg mod1 + PASSED TEARDOWN otherarg 1 + + test_module.py::test_2[2-mod1] SETUP otherarg 2 + RUN test2 with otherarg 2 and modarg mod1 + PASSED TEARDOWN otherarg 2 + + test_module.py::test_1[mod2] TEARDOWN modarg mod1 + SETUP modarg mod2 + RUN test1 with modarg mod2 + PASSED + test_module.py::test_2[1-mod2] SETUP otherarg 1 + RUN test2 with otherarg 1 and modarg mod2 + PASSED TEARDOWN otherarg 1 + + test_module.py::test_2[2-mod2] SETUP otherarg 2 + RUN test2 with otherarg 2 and modarg mod2 + PASSED TEARDOWN otherarg 2 + TEARDOWN modarg mod2 + + + ====== 8 passed in 0.01 seconds ====== + + +You can see that the parametrized module-scoped ``modarg`` resource caused an +ordering of test execution that lead to the fewest possible "active" resources. +The finalizer for the ``mod1`` parametrized resource was executed before the +``mod2`` resource was setup. + +In particular notice that test_0 is completely independent and finishes first. +Then test_1 is executed with ``mod1``, then test_2 with ``mod1``, then test_1 +with ``mod2`` and finally test_2 with ``mod2``. + +The ``otherarg`` parametrized resource (having function scope) was set up before +and teared down after every test that used it. .. _`usefixtures`: From ec62a3c9e47c3b5b07aa1656815145ffa2882a09 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 17:01:04 +0100 Subject: [PATCH 07/28] Fix minor typo in 'writing plugins' doc --- doc/en/writing_plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index cc346aaa8..228c85132 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -23,7 +23,7 @@ reporting by calling `well specified hooks`_ of the following plugins: In principle, each hook call is a ``1:N`` Python function call where ``N`` is the number of registered implementation functions for a given specification. -All specifications and implementations following the ``pytest_`` prefix +All specifications and implementations follow the ``pytest_`` prefix naming convention, making them easy to distinguish and find. .. _`pluginorder`: From 16e49d96d174ac35950aa91b95fe14bef3a428a8 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 17:12:50 +0100 Subject: [PATCH 08/28] Replace --traceconfig with --trace-config in doc Since 'py.test --help' shows --trace-config as an option (and not --traceconfig) even though both forms are accepted I assume --trace-config is the preferred form and should therefore be used in the documentation. --- doc/en/plugins.rst | 2 +- doc/en/test/attic.rst | 2 +- doc/en/test/plugin/helpconfig.rst | 2 +- doc/en/writing_plugins.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/en/plugins.rst b/doc/en/plugins.rst index e9b3f460c..3db7f0f59 100644 --- a/doc/en/plugins.rst +++ b/doc/en/plugins.rst @@ -90,7 +90,7 @@ Finding out which plugins are active If you want to find out which plugins are active in your environment you can type:: - py.test --traceconfig + py.test --trace-config and will get an extended test header which shows activated plugins and their names. It will also print local plugins aka diff --git a/doc/en/test/attic.rst b/doc/en/test/attic.rst index 6408c7225..2ab9c237a 100644 --- a/doc/en/test/attic.rst +++ b/doc/en/test/attic.rst @@ -21,7 +21,7 @@ but note that project specific settings will be considered first. There is a flag that helps you debugging your conftest.py configurations:: - py.test --traceconfig + py.test --trace-config customizing the collecting and running process diff --git a/doc/en/test/plugin/helpconfig.rst b/doc/en/test/plugin/helpconfig.rst index 9b5b8cddd..00399b690 100644 --- a/doc/en/test/plugin/helpconfig.rst +++ b/doc/en/test/plugin/helpconfig.rst @@ -16,7 +16,7 @@ command line options display py lib version and import information. ``-p name`` early-load given plugin (multi-allowed). -``--traceconfig`` +``--trace-config`` trace considerations of conftest.py files. ``--nomagic`` don't reinterpret asserts, no traceback cutting. diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 228c85132..41fd0335e 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -194,7 +194,7 @@ the plugin manager like this: plugin = config.pluginmanager.getplugin("name_of_plugin") If you want to look at the names of existing plugins, use -the ``--traceconfig`` option. +the ``--trace-config`` option. Testing plugins --------------- From a341dddc74fc69f8677f382e37e68d46939d949e Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 17:12:50 +0100 Subject: [PATCH 09/28] Replace --fulltrace with --full-trace in doc Since 'py.test --help' shows --full-trace as an option (and not --fulltrace) even though both forms are accepted I assume --full-trace is the preferred form and should therefore be used in the documentation. --- doc/en/example/simple.rst | 2 +- doc/en/test/plugin/terminal.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index be12d2afe..e1362d878 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -201,7 +201,7 @@ Example:: The ``__tracebackhide__`` setting influences ``pytest`` showing of tracebacks: the ``checkconfig`` function will not be shown -unless the ``--fulltrace`` command line option is specified. +unless the ``--full-trace`` command line option is specified. Let's run our little function:: $ py.test -q test_checkconfig.py diff --git a/doc/en/test/plugin/terminal.rst b/doc/en/test/plugin/terminal.rst index 214c24dfc..0c0796415 100644 --- a/doc/en/test/plugin/terminal.rst +++ b/doc/en/test/plugin/terminal.rst @@ -22,7 +22,7 @@ command line options (deprecated, use -r) ``--tb=style`` traceback print mode (long/short/line/no). -``--fulltrace`` +``--full-trace`` don't cut any tracebacks (default is to cut). ``--fixtures`` show available function arguments, sorted by plugin From 98c707561c51112525db59a3c2bc6f53e6978b77 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 19:53:02 +0100 Subject: [PATCH 10/28] Document --full-trace option and KeyboardInterrupt fix #513 --- doc/en/usage.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/en/usage.rst b/doc/en/usage.rst index 08c158aac..a3d56deff 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -74,6 +74,14 @@ Examples for modifying traceback printing:: py.test --tb=native # Python standard library formatting py.test --tb=no # no traceback at all +The ``--full-trace`` causes very long traces to be printed on error (longer +than ``--tb=long``). It also ensures that a stack trace is printed on +**KeyboardInterrrupt** (Ctrl+C). +This is very useful if the tests are taking too long and you interrupt them +with Ctrl+C to find out where the tests are *hanging*. By default no output +will be shown (because KeyboardInterrupt is catched by pytest). By using this +option you make sure a trace is shown. + Dropping to PDB_ (Python Debugger) on failures ----------------------------------------------- From 725290a8ab8d90604f611d8946cd3750237621cc Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Sun, 20 Mar 2016 20:36:43 +0100 Subject: [PATCH 11/28] Add 'Minor doc fixes' to CHANGELOG --- CHANGELOG.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0fabed146..93197bba9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,7 +9,8 @@ * -* +* Minor improvements and fixes to the documentation. + Thanks `@omarkohl`_ for the PR. 2.9.1 @@ -163,6 +164,7 @@ .. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt .. _@rabbbit: https://github.com/rabbbit .. _@hackebrot: https://github.com/hackebrot +.. _@omarkohl: https://github.com/omarkohl 2.8.7 ===== From 1fbd19b8cb20d100d608f7c593732fa945401329 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 22 Mar 2016 14:29:13 +0400 Subject: [PATCH 12/28] Fix pytest.mark.skip mark when used in strict mode --- AUTHORS | 1 + CHANGELOG.rst | 5 ++++- _pytest/skipping.py | 5 +++++ testing/test_skipping.py | 13 +++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index dfc0a542e..92750acc3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -69,6 +69,7 @@ Nicolas Delaby Pieter Mulder Piotr Banaszkiewicz Punyashloka Biswal +Quentin Pradet Ralf Schmitt Raphael Pierzina Ronny Pfannschmidt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 93197bba9..a64d64a12 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,7 +7,9 @@ * -* +* Fix ``pytest.mark.skip`` mark when used in strict mode. + Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for + showing how to fix the bug. * Minor improvements and fixes to the documentation. Thanks `@omarkohl`_ for the PR. @@ -165,6 +167,7 @@ .. _@rabbbit: https://github.com/rabbbit .. _@hackebrot: https://github.com/hackebrot .. _@omarkohl: https://github.com/omarkohl +.. _@pquentin: https://github.com/pquentin 2.8.7 ===== diff --git a/_pytest/skipping.py b/_pytest/skipping.py index 69157f485..07359b5c2 100644 --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -30,6 +30,11 @@ def pytest_configure(config): nop.Exception = XFailed setattr(pytest, "xfail", nop) + config.addinivalue_line("markers", + "skip(reason=None): skip the given test function with an optional reason. " + "Example: skip(reason=\"no way of currently testing this\") skips the " + "test." + ) config.addinivalue_line("markers", "skipif(condition): skip the given test function if eval(condition) " "results in a True value. Evaluation happens within the " diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 3464974e0..b872c8b6e 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -539,6 +539,19 @@ class TestSkip: "*1 passed*2 skipped*", ]) + def test_strict_and_skip(self, testdir): + testdir.makepyfile(""" + import pytest + @pytest.mark.skip + def test_hello(): + pass + """) + result = testdir.runpytest("-rs --strict") + result.stdout.fnmatch_lines([ + "*unconditional skip*", + "*1 skipped*", + ]) + class TestSkipif: def test_skipif_conditional(self, testdir): item = testdir.getitem(""" From 653a53226ac58e4e5482baf4a037054c7fb5998a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 22 Mar 2016 15:26:56 +0400 Subject: [PATCH 13/28] Add strict parameter to xfail marker doc --- _pytest/skipping.py | 14 +++++++------- testing/test_skipping.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/_pytest/skipping.py b/_pytest/skipping.py index 07359b5c2..55a24ddb9 100644 --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -43,13 +43,13 @@ def pytest_configure(config): "http://pytest.org/latest/skipping.html" ) config.addinivalue_line("markers", - "xfail(condition, reason=None, run=True, raises=None): mark the the test function " - "as an expected failure if eval(condition) has a True value. " - "Optionally specify a reason for better reporting and run=False if " - "you don't even want to execute the test function. If only specific " - "exception(s) are expected, you can list them in raises, and if the test fails " - "in other ways, it will be reported as a true failure. " - "See http://pytest.org/latest/skipping.html" + "xfail(condition, reason=None, run=True, raises=None, strict=False): " + "mark the the test function as an expected failure if eval(condition) " + "has a True value. Optionally specify a reason for better reporting " + "and run=False if you don't even want to execute the test function. " + "If only specific exception(s) are expected, you can list them in " + "raises, and if the test fails in other ways, it will be reported as " + "a true failure. See http://pytest.org/latest/skipping.html" ) diff --git a/testing/test_skipping.py b/testing/test_skipping.py index b872c8b6e..194c8692b 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -825,7 +825,7 @@ def test_default_markers(testdir): result = testdir.runpytest("--markers") result.stdout.fnmatch_lines([ "*skipif(*condition)*skip*", - "*xfail(*condition, reason=None, run=True, raises=None)*expected failure*", + "*xfail(*condition, reason=None, run=True, raises=None, strict=False)*expected failure*", ]) def test_xfail_test_setup_exception(testdir): From 53d319144d59745d9370dd90a39f23b6f03ab3cb Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 22 Mar 2016 20:42:52 -0300 Subject: [PATCH 14/28] Mention Pytest::Framework PyPI classifier on docs --- doc/en/writing_plugins.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 41fd0335e..9240a9aac 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -158,13 +158,22 @@ it in your setuptools-invocation: 'name_of_plugin = myproject.pluginmodule', ] }, + + # custom PyPI classifier for pytest plugins + classifiers=[ + "Framework :: Pytest", + ], ) If a package is installed this way, ``pytest`` will load ``myproject.pluginmodule`` as a plugin which can define `well specified hooks`_. +.. note:: + Make sure to include ``Framework :: Pytest`` in your list of + `PyPI classifiers `_ + to make it easy for users to find your plugin. Requiring/Loading plugins in a test module or conftest file From e048315d9b9a0cb6bdf55ad3d9b7d55f99a980b5 Mon Sep 17 00:00:00 2001 From: Omar Kohl Date: Mon, 28 Mar 2016 19:51:26 +0200 Subject: [PATCH 15/28] Adapt get_issues.py script for GitHub (instead of Bitbucket) --- extra/get_issues.py | 70 ++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/extra/get_issues.py b/extra/get_issues.py index 6437ba4c3..2a8f8c316 100644 --- a/extra/get_issues.py +++ b/extra/get_issues.py @@ -2,30 +2,34 @@ import json import py import textwrap -issues_url = "http://bitbucket.org/api/1.0/repositories/pytest-dev/pytest/issues" +issues_url = "https://api.github.com/repos/pytest-dev/pytest/issues" import requests + def get_issues(): - chunksize = 50 - start = 0 issues = [] + url = issues_url while 1: - post_data = {"accountname": "pytest-dev", - "repo_slug": "pytest", - "start": start, - "limit": chunksize} - print ("getting from", start) - r = requests.get(issues_url, params=post_data) + get_data = {"state": "all"} + r = requests.get(url, params=get_data) data = r.json() - issues.extend(data["issues"]) - if start + chunksize >= data["count"]: + if r.status_code == 403: + # API request limit exceeded + print(data['message']) + exit(1) + issues.extend(data) + + # Look for next page + links = requests.utils.parse_header_links(r.headers['Link']) + another_page = False + for link in links: + if link['rel'] == 'next': + url = link['url'] + another_page = True + if not another_page: return issues - start += chunksize -kind2num = "bug enhancement task proposal".split() - -status2num = "new open resolved duplicate invalid wontfix".split() def main(args): cachefile = py.path.local(args.cache) @@ -35,33 +39,38 @@ def main(args): else: issues = json.loads(cachefile.read()) - open_issues = [x for x in issues - if x["status"] in ("new", "open")] + open_issues = [x for x in issues if x["state"] == "open"] - def kind_and_id(x): - kind = x["metadata"]["kind"] - return kind2num.index(kind), len(issues)-int(x["local_id"]) - open_issues.sort(key=kind_and_id) + open_issues.sort(key=lambda x: x["number"]) report(open_issues) + +def _get_kind(issue): + labels = [l['name'] for l in issue['labels']] + for key in ('bug', 'enhancement', 'proposal'): + if key in labels: + return key + return 'issue' + + def report(issues): for issue in issues: - metadata = issue["metadata"] - priority = issue["priority"] title = issue["title"] - content = issue["content"] - kind = metadata["kind"] - status = issue["status"] - id = issue["local_id"] - link = "https://bitbucket.org/pytest-dev/pytest/issue/%s/" % id + body = issue["body"] + kind = _get_kind(issue) + status = issue["state"] + number = issue["number"] + link = "https://github.com/pytest-dev/pytest/issues/%s/" % number print("----") print(status, kind, link) print(title) #print() - #lines = content.split("\n") + #lines = body.split("\n") #print ("\n".join(lines[:3])) - #if len(lines) > 3 or len(content) > 240: + #if len(lines) > 3 or len(body) > 240: # print ("...") + print("\n\nFound %s open issues" % len(issues)) + if __name__ == "__main__": import argparse @@ -72,3 +81,4 @@ if __name__ == "__main__": help="cache file") args = parser.parse_args() main(args) + From 053c052190ef757a660c715c110e88a8e053ef04 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 1 Apr 2016 01:20:22 -0400 Subject: [PATCH 16/28] Always lstrip() keyword expression --- _pytest/mark.py | 2 +- testing/acceptance_test.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_pytest/mark.py b/_pytest/mark.py index 1a7635402..d8b60def3 100644 --- a/_pytest/mark.py +++ b/_pytest/mark.py @@ -58,7 +58,7 @@ pytest_cmdline_main.tryfirst = True def pytest_collection_modifyitems(items, config): - keywordexpr = config.option.keyword + keywordexpr = config.option.keyword.lstrip() matchexpr = config.option.markexpr if not keywordexpr and not matchexpr: return diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 9bc3a191a..4e9645037 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -670,6 +670,11 @@ class TestDurations: "*call*test_1*", ]) + def test_with_not(self, testdir): + testdir.makepyfile(self.source) + result = testdir.runpytest("-k not 1") + assert result.ret == 0 + class TestDurationWithFixture: source = """ From fb45f8284041faacb05d0cb2d2046a49d9db493a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCttler?= Date: Tue, 5 Apr 2016 14:08:30 +0200 Subject: [PATCH 17/28] Hudson -> Jenkins --- doc/en/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/usage.rst b/doc/en/usage.rst index a3d56deff..fba699849 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -158,7 +158,7 @@ To get a list of the slowest 10 test durations:: Creating JUnitXML format files ---------------------------------------------------- -To create result files which can be read by Hudson_ or other Continuous +To create result files which can be read by Jenkins_ or other Continuous integration servers, use this invocation:: py.test --junitxml=path From 7ce5873da23ea0dc6f796c4d608731e25191d756 Mon Sep 17 00:00:00 2001 From: Martin Prusse Date: Fri, 8 Apr 2016 11:24:12 -0300 Subject: [PATCH 18/28] Perform a "unicode aware" check for maximum recursion depth error Avoid errors `UnicodeErrosr`s due non maximum recursion depth errors when checking for those errors. --- AUTHORS | 1 + CHANGELOG.rst | 9 +++++++++ _pytest/_code/code.py | 16 +++++++++++++--- testing/code/test_excinfo.py | 18 +++++++++++++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 92750acc3..14bb4e3c1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -61,6 +61,7 @@ Marc Schlaich Mark Abramowitz Markus Unterwaditzer Martijn Faassen +Martin Prusse Matt Bachmann Michael Aquilina Michael Birtwell diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a64d64a12..2b6780ad8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,10 @@ * +* Fix maximum recursion depth detection when raised error class is not aware + of unicode/encoded bytes. + Thanks `@prusse-martin`_ for the PR (`#1506`_). + * Fix ``pytest.mark.skip`` mark when used in strict mode. Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for showing how to fix the bug. @@ -15,6 +19,11 @@ Thanks `@omarkohl`_ for the PR. +.. _#1506: https://github.com/pytest-dev/pytest/pull/1506 + +.. _@prusse-martin: https://github.com/prusse-martin + + 2.9.1 ===== diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py index bc68aac55..31a3eda2d 100644 --- a/_pytest/_code/code.py +++ b/_pytest/_code/code.py @@ -579,9 +579,8 @@ class FormattedExcinfo(object): if self.tbfilter: traceback = traceback.filter() recursionindex = None - if excinfo.errisinstance(RuntimeError): - if "maximum recursion depth exceeded" in str(excinfo.value): - recursionindex = traceback.recursionindex() + if is_recursion_error(excinfo): + recursionindex = traceback.recursionindex() last = traceback[-1] entries = [] extraline = None @@ -793,3 +792,14 @@ def getrawcode(obj, trycall=True): return x return obj +if sys.version_info[:2] >= (3, 5): # RecursionError introduced in 3.5 + def is_recursion_error(excinfo): + return excinfo.errisinstance(RecursionError) # noqa +else: + def is_recursion_error(excinfo): + if not excinfo.errisinstance(RuntimeError): + return False + try: + return "maximum recursion depth exceeded" in str(excinfo.value) + except UnicodeError: + return False diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index 2defa3103..47ad50b06 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -3,7 +3,7 @@ import _pytest import py import pytest -from _pytest._code.code import FormattedExcinfo, ReprExceptionInfo +from _pytest._code.code import ExceptionInfo, FormattedExcinfo, ReprExceptionInfo queue = py.builtin._tryimport('queue', 'Queue') @@ -909,3 +909,19 @@ raise ValueError() assert tw.lines[14] == "E ValueError" assert tw.lines[15] == "" assert tw.lines[16].endswith("mod.py:9: ValueError") + + +@pytest.mark.parametrize("style", ["short", "long"]) +@pytest.mark.parametrize("encoding", [None, "utf8", "utf16"]) +def test_repr_traceback_with_unicode(style, encoding): + msg = u'☹' + if encoding is not None: + msg = msg.encode(encoding) + try: + raise RuntimeError(msg) + except RuntimeError: + e_info = ExceptionInfo() + formatter = FormattedExcinfo(style=style) + repr_traceback = formatter.repr_traceback(e_info) + assert repr_traceback is not None + From 98430a17f27170e0761781210345311146d13eb7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 13 Apr 2016 23:16:41 +0200 Subject: [PATCH 19/28] doc: Use ascii chars for file tree LaTeX doesn't like those particular unicode chars, so let's avoid them so the PDF builds easily. --- doc/en/example/pythoncollection.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 6edab15a8..f37c12c51 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -9,19 +9,19 @@ by passing the ``--ignore=path`` option on the cli. ``pytest`` allows multiple ``--ignore`` options. Example:: tests/ - ├── example - │   ├── test_example_01.py - │   ├── test_example_02.py - │   └── test_example_03.py - ├── foobar - │   ├── test_foobar_01.py - │   ├── test_foobar_02.py - │   └── test_foobar_03.py - └── hello - └── world - ├── test_world_01.py - ├── test_world_02.py - └── test_world_03.py + |-- example + | |-- test_example_01.py + | |-- test_example_02.py + | '-- test_example_03.py + |-- foobar + | |-- test_foobar_01.py + | |-- test_foobar_02.py + | '-- test_foobar_03.py + '-- hello + '-- world + |-- test_world_01.py + |-- test_world_02.py + '-- test_world_03.py Now if you invoke ``pytest`` with ``--ignore=tests/foobar/test_foobar_03.py --ignore=tests/hello/``, you will see that ``pytest`` only collects test-modules, which do not match the patterns specified:: From dd2425675bac0ddde21e0e3ec43cffa72cb405b8 Mon Sep 17 00:00:00 2001 From: Meng Jue Date: Tue, 19 Apr 2016 12:09:54 +0800 Subject: [PATCH 20/28] Fix a small issue about shlex.split not working well with win32 path --- AUTHORS | 1 + _pytest/config.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 14bb4e3c1..7ae2b50d9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -87,3 +87,4 @@ Russel Winder Ben Webb Alexei Kozlenok Cal Leeming +Feng Ma diff --git a/_pytest/config.py b/_pytest/config.py index fb7b1774f..db5938b2a 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -104,7 +104,10 @@ def _prepareconfig(args=None, plugins=None): elif not isinstance(args, (tuple, list)): if not isinstance(args, str): raise ValueError("not a string or argument list: %r" % (args,)) - args = shlex.split(args) + if sys.platform == "win32": + args = shlex.split(args, posix=False) + else: + args = shlex.split(args) config = get_config() pluginmanager = config.pluginmanager try: From 1a37035d710769ab13330014eec6e686f54b6f11 Mon Sep 17 00:00:00 2001 From: MengJueM Date: Wed, 20 Apr 2016 01:27:37 +0800 Subject: [PATCH 21/28] Add test test_absolute_win32_path --- _pytest/config.py | 5 +---- testing/test_config.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/_pytest/config.py b/_pytest/config.py index db5938b2a..a458e9573 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -104,10 +104,7 @@ def _prepareconfig(args=None, plugins=None): elif not isinstance(args, (tuple, list)): if not isinstance(args, str): raise ValueError("not a string or argument list: %r" % (args,)) - if sys.platform == "win32": - args = shlex.split(args, posix=False) - else: - args = shlex.split(args) + args = shlex.split(args, posix=sys.platform == "win32") config = get_config() pluginmanager = config.pluginmanager try: diff --git a/testing/test_config.py b/testing/test_config.py index 92c9bdb8b..fe0654017 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -79,7 +79,7 @@ class TestParseIni: """) result = testdir.inline_run("--confcutdir=.") assert result.ret == 0 - + class TestConfigCmdlineParsing: def test_parsing_again_fails(self, testdir): config = testdir.parseconfig() @@ -101,6 +101,16 @@ class TestConfigCmdlineParsing: config = testdir.parseconfig("-c", "custom.cfg") assert config.getini("custom") == "1" + def test_absolute_win32_path(self, testdir): + temp_cfg_file = testdir.makefile(".cfg", custom=""" + [pytest] + addopts = --version + """) + from os.path import normpath + temp_cfg_file = normpath(str(temp_cfg_file)) + ret = pytest.main("-c " + temp_cfg_file) + assert ret == _pytest.main.EXIT_OK + class TestConfigAPI: def test_config_trace(self, testdir): config = testdir.parseconfig() From c24e8e01b4014abec7364f6e913e9f0d033dc701 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 20 Apr 2016 08:35:17 +0200 Subject: [PATCH 22/28] Fix TracebackItem documentation in pytest.code The TracebackItem class does not exist, but it seems the docstrings refer to TracebackEntry. --- _pytest/_code/code.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py index 31a3eda2d..8995cc1f7 100644 --- a/_pytest/_code/code.py +++ b/_pytest/_code/code.py @@ -294,11 +294,11 @@ class Traceback(list): def filter(self, fn=lambda x: not x.ishidden()): """ return a Traceback instance with certain items removed - fn is a function that gets a single argument, a TracebackItem + fn is a function that gets a single argument, a TracebackEntry instance, and should return True when the item should be added to the Traceback, False when not - by default this removes all the TracebackItems which are hidden + by default this removes all the TracebackEntries which are hidden (see ishidden() above) """ return Traceback(filter(fn, self)) @@ -314,7 +314,7 @@ class Traceback(list): return self[-1] def recursionindex(self): - """ return the index of the frame/TracebackItem where recursion + """ return the index of the frame/TracebackEntry where recursion originates if appropriate, None if no recursion occurred """ cache = {} From f51c34ef319e87436173afdb5d421828dcede4b4 Mon Sep 17 00:00:00 2001 From: MengJueM Date: Wed, 20 Apr 2016 22:32:35 +0800 Subject: [PATCH 23/28] Add changelog --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b6780ad8..f6025bfe8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,8 @@ * -* +* Fix win32 path issue when puttinging custom config file with absolute path + in ``pytest.main("-c your_absolute_path")``. * Fix maximum recursion depth detection when raised error class is not aware of unicode/encoded bytes. From 75abfbe8d45353bf13ba6928eb7c58bb06a0e1ba Mon Sep 17 00:00:00 2001 From: Benjamin Dopplinger Date: Thu, 28 Apr 2016 14:40:17 +1000 Subject: [PATCH 24/28] Fix typo in doc --- _pytest/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/python.py b/_pytest/python.py index 3580eae07..eee6892c1 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1451,7 +1451,7 @@ class FixtureRequest(FuncargnamesCompatAttr): self._pyfuncitem = pyfuncitem #: fixture for which this request is being performed self.fixturename = None - #: Scope string, one of "function", "cls", "module", "session" + #: Scope string, one of "function", "class", "module", "session" self.scope = "function" self._funcargs = {} self._fixturedefs = {} From 0d07b645713d4a68acc651ba99ea9efc5d3f0307 Mon Sep 17 00:00:00 2001 From: John Towler Date: Wed, 4 May 2016 13:36:27 -0700 Subject: [PATCH 25/28] Fixes Issue 1549 --- AUTHORS | 1 + _pytest/junitxml.py | 2 +- testing/test_junitxml.py | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 7ae2b50d9..f4a21b22d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -49,6 +49,7 @@ Jaap Broekhuizen Jan Balster Janne Vanhala Jason R. Coombs +John Towler Joshua Bronson Jurko Gospodnetić Katarzyna Jachim diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 660d718a6..f4de1343e 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -369,7 +369,7 @@ class LogXML(object): suite_stop_time = time.time() suite_time_delta = suite_stop_time - self.suite_start_time - numtests = self.stats['passed'] + self.stats['failure'] + numtests = self.stats['passed'] + self.stats['failure'] + self.stats['skipped'] logfile.write('') logfile.write(Junit.testsuite( diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 5960f8825..a4f10dec5 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -100,7 +100,7 @@ class TestPython: result, dom = runandparse(testdir) assert result.ret node = dom.find_first_by_tag("testsuite") - node.assert_attr(name="pytest", errors=0, failures=1, skips=3, tests=2) + node.assert_attr(name="pytest", errors=0, failures=1, skips=3, tests=5) def test_timing_function(self, testdir): testdir.makepyfile(""" @@ -304,7 +304,7 @@ class TestPython: result, dom = runandparse(testdir) assert not result.ret node = dom.find_first_by_tag("testsuite") - node.assert_attr(skips=1, tests=0) + node.assert_attr(skips=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_xfailure_function.py", @@ -325,7 +325,7 @@ class TestPython: result, dom = runandparse(testdir) # assert result.ret node = dom.find_first_by_tag("testsuite") - node.assert_attr(skips=1, tests=0) + node.assert_attr(skips=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_xfailure_xpass.py", @@ -356,7 +356,7 @@ class TestPython: result, dom = runandparse(testdir) assert result.ret == EXIT_NOTESTSCOLLECTED node = dom.find_first_by_tag("testsuite") - node.assert_attr(skips=1, tests=0) + node.assert_attr(skips=1, tests=1) tnode = node.find_first_by_tag("testcase") tnode.assert_attr( file="test_collect_skipped.py", From 8a39869347ce8b215e336a83efad520e9f4cdd39 Mon Sep 17 00:00:00 2001 From: Adam Chainz Date: Wed, 18 May 2016 17:12:39 +0100 Subject: [PATCH 26/28] Convert readthedocs link for their .org -> .io migration for hosted projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per their email ‘Changes to project subdomains’: > Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard. Test Plan: Manually visited all the links I’ve modified. One was not modified - `http://media.readthedocs.org/epub/pytest/latest/pytest.epub` - since it doesn't work on `readthedocs.io`. --- CHANGELOG.rst | 4 ++-- doc/en/announce/release-2.9.0.rst | 4 ++-- doc/en/bash-completion.rst | 2 +- doc/en/example/simple.rst | 2 +- doc/en/links.inc | 4 ++-- doc/en/nose.rst | 2 +- doc/en/projects.rst | 2 +- doc/en/writing_plugins.rst | 2 +- setup.py | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f6025bfe8..ab5da9d01 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -95,7 +95,7 @@ **Changes** -* **Important**: `py.code `_ has been +* **Important**: `py.code `_ has been merged into the ``pytest`` repository as ``pytest._code``. This decision was made because ``py.code`` had very few uses outside ``pytest`` and the fact that it was in a different repository made it difficult to fix bugs on @@ -108,7 +108,7 @@ **experimental**, so you definitely should not import it explicitly! Please note that the original ``py.code`` is still available in - `pylib `_. + `pylib `_. * ``pytest_enter_pdb`` now optionally receives the pytest config object. Thanks `@nicoddemus`_ for the PR. diff --git a/doc/en/announce/release-2.9.0.rst b/doc/en/announce/release-2.9.0.rst index 99c1c631f..011b1ffb9 100644 --- a/doc/en/announce/release-2.9.0.rst +++ b/doc/en/announce/release-2.9.0.rst @@ -75,7 +75,7 @@ The py.test Development Team **Changes** -* **Important**: `py.code `_ has been +* **Important**: `py.code `_ has been merged into the ``pytest`` repository as ``pytest._code``. This decision was made because ``py.code`` had very few uses outside ``pytest`` and the fact that it was in a different repository made it difficult to fix bugs on @@ -88,7 +88,7 @@ The py.test Development Team **experimental**, so you definitely should not import it explicitly! Please note that the original ``py.code`` is still available in - `pylib `_. + `pylib `_. * ``pytest_enter_pdb`` now optionally receives the pytest config object. Thanks `@nicoddemus`_ for the PR. diff --git a/doc/en/bash-completion.rst b/doc/en/bash-completion.rst index b2a52fa63..b820944bf 100644 --- a/doc/en/bash-completion.rst +++ b/doc/en/bash-completion.rst @@ -5,7 +5,7 @@ Setting up bash completion ========================== When using bash as your shell, ``pytest`` can use argcomplete -(https://argcomplete.readthedocs.org/) for auto-completion. +(https://argcomplete.readthedocs.io/) for auto-completion. For this ``argcomplete`` needs to be installed **and** enabled. Install argcomplete using:: diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index e1362d878..ab3d05e38 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -703,7 +703,7 @@ Integrating pytest runner and cx_freeze ----------------------------------------------------------- If you freeze your application using a tool like -`cx_freeze `_ in order to distribute it +`cx_freeze `_ in order to distribute it to your end-users, it is a good idea to also package your test runner and run your tests using the frozen application. diff --git a/doc/en/links.inc b/doc/en/links.inc index 3d7863751..b69390baa 100644 --- a/doc/en/links.inc +++ b/doc/en/links.inc @@ -6,7 +6,7 @@ .. _`pytest_nose`: plugin/nose.html .. _`reStructured Text`: http://docutils.sourceforge.net .. _`Python debugger`: http://docs.python.org/lib/module-pdb.html -.. _nose: https://nose.readthedocs.org/en/latest/ +.. _nose: https://nose.readthedocs.io/en/latest/ .. _pytest: http://pypi.python.org/pypi/pytest .. _mercurial: http://mercurial.selenic.com/wiki/ .. _`setuptools`: http://pypi.python.org/pypi/setuptools @@ -18,4 +18,4 @@ .. _hudson: http://hudson-ci.org/ .. _jenkins: http://jenkins-ci.org/ .. _tox: http://testrun.org/tox -.. _pylib: http://py.readthedocs.org/en/latest/ +.. _pylib: https://py.readthedocs.io/en/latest/ diff --git a/doc/en/nose.rst b/doc/en/nose.rst index 3b92e04cf..04386ea0f 100644 --- a/doc/en/nose.rst +++ b/doc/en/nose.rst @@ -46,7 +46,7 @@ Unsupported idioms / known issues (e.g. ``tests/test_mode.py`` and ``other/tests/test_mode.py``) by extending sys.path/import semantics. pytest does not do that but there is discussion in `issue268 `_ for adding some support. Note that - `nose2 choose to avoid this sys.path/import hackery `_. + `nose2 choose to avoid this sys.path/import hackery `_. - nose-style doctests are not collected and executed correctly, also doctest fixtures don't work. diff --git a/doc/en/projects.rst b/doc/en/projects.rst index 76d004916..fa7a2f29a 100644 --- a/doc/en/projects.rst +++ b/doc/en/projects.rst @@ -57,7 +57,7 @@ Here are some examples of projects using ``pytest`` (please send notes via :ref: * `bu `_ a microscopic build system * `katcp `_ Telescope communication protocol over Twisted * `kss plugin timer `_ -* `pyudev `_ a pure Python binding to the Linux library libudev +* `pyudev `_ a pure Python binding to the Linux library libudev * `pytest-localserver `_ a plugin for pytest that provides a httpserver and smtpserver * `pytest-monkeyplus `_ a plugin that extends monkeypatch diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 9240a9aac..90f2195e2 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -172,7 +172,7 @@ If a package is installed this way, ``pytest`` will load .. note:: Make sure to include ``Framework :: Pytest`` in your list of - `PyPI classifiers `_ + `PyPI classifiers `_ to make it easy for users to find your plugin. diff --git a/setup.py b/setup.py index 6660f2160..7cdcdfb99 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def has_environment_marker_support(): References: - * https://wheel.readthedocs.org/en/latest/index.html#defining-conditional-dependencies + * https://wheel.readthedocs.io/en/latest/index.html#defining-conditional-dependencies * https://www.python.org/dev/peps/pep-0426/#environment-markers """ try: From 561a5fb55889c4f3ef1e4cbf2383b3b526370dd0 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 18 May 2016 16:15:29 -0300 Subject: [PATCH 27/28] Move comment in tox.ini due to recent bug in pip As discussed in #1554 * https://bitbucket.org/hpk42/tox/issues/332/ * https://github.com/pypa/pip/issues/3667 --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 5f65446e4..ad8835c46 100644 --- a/tox.ini +++ b/tox.ini @@ -16,9 +16,10 @@ deps= [testenv:py26] commands= py.test --lsof -rfsxX {posargs:testing} +# pinning mock to last supported version for python 2.6 deps= nose - mock<1.1 # last supported version for py26 + mock<1.1 [testenv:py27-subprocess] changedir=. From 9fb5ddf77890095a08553309e49467a1baf50c9b Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 23 May 2016 20:41:47 -0300 Subject: [PATCH 28/28] Fix shell argument split in win32 This fixes the bug inserted by accident in #1523 --- _pytest/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/config.py b/_pytest/config.py index a458e9573..9a308df2b 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -104,7 +104,7 @@ def _prepareconfig(args=None, plugins=None): elif not isinstance(args, (tuple, list)): if not isinstance(args, str): raise ValueError("not a string or argument list: %r" % (args,)) - args = shlex.split(args, posix=sys.platform == "win32") + args = shlex.split(args, posix=sys.platform != "win32") config = get_config() pluginmanager = config.pluginmanager try: