Merge branch 'master' into features

This commit is contained in:
Bruno Oliveira 2017-07-04 12:44:58 -03:00
commit b62aef3372
22 changed files with 134 additions and 75 deletions

View File

@ -8,6 +8,52 @@
.. towncrier release notes start .. towncrier release notes start
Pytest 3.1.3 (2017-07-03)
=========================
Bug Fixes
---------
- Fix decode error in Python 2 for doctests in docstrings. (`#2434
<https://github.com/pytest-dev/pytest/issues/2434>`_)
- Exceptions raised during teardown by finalizers are now suppressed until all
finalizers are called, with the initial exception reraised. (`#2440
<https://github.com/pytest-dev/pytest/issues/2440>`_)
- Fix incorrect "collected items" report when specifying tests on the command-
line. (`#2464 <https://github.com/pytest-dev/pytest/issues/2464>`_)
- ``deprecated_call`` in context-manager form now captures deprecation warnings
even if the same warning has already been raised. Also, ``deprecated_call``
will always produce the same error message (previously it would produce
different messages in context-manager vs. function-call mode). (`#2469
<https://github.com/pytest-dev/pytest/issues/2469>`_)
- Fix issue where paths collected by pytest could have triple leading ``/``
characters. (`#2475 <https://github.com/pytest-dev/pytest/issues/2475>`_)
- Fix internal error when trying to detect the start of a recursive traceback.
(`#2486 <https://github.com/pytest-dev/pytest/issues/2486>`_)
Improved Documentation
----------------------
- Explicitly state for which hooks the calls stop after the first non-None
result. (`#2493 <https://github.com/pytest-dev/pytest/issues/2493>`_)
Trivial/Internal Changes
------------------------
- Create invoke tasks for updating the vendored packages. (`#2474
<https://github.com/pytest-dev/pytest/issues/2474>`_)
- Update copyright dates in LICENSE, README.rst and in the documentation.
(`#2499 <https://github.com/pytest-dev/pytest/issues/2499>`_)
Pytest 3.1.2 (2017-06-08) Pytest 3.1.2 (2017-06-08)
========================= =========================

View File

@ -168,14 +168,13 @@ def pytest_runtestloop(session):
def pytest_ignore_collect(path, config): def pytest_ignore_collect(path, config):
p = path.dirpath() ignore_paths = config._getconftest_pathlist("collect_ignore", path=path.dirpath())
ignore_paths = config._getconftest_pathlist("collect_ignore", path=p)
ignore_paths = ignore_paths or [] ignore_paths = ignore_paths or []
excludeopt = config.getoption("ignore") excludeopt = config.getoption("ignore")
if excludeopt: if excludeopt:
ignore_paths.extend([py.path.local(x) for x in excludeopt]) ignore_paths.extend([py.path.local(x) for x in excludeopt])
if path in ignore_paths: if py.path.local(path) in ignore_paths:
return True return True
# Skip duplicate paths. # Skip duplicate paths.

View File

@ -1 +0,0 @@
Fix decode error in Python 2 for doctests in docstrings.

View File

@ -1 +0,0 @@
Exceptions raised during teardown by finalizers are now suppressed until all finalizers are called, with the initial exception reraised.

View File

@ -1 +0,0 @@
Fix incorrect "collected items" report when specifying tests on the command-line.

View File

@ -1,4 +0,0 @@
``deprecated_call`` in context-manager form now captures deprecation warnings even if
the same warning has already been raised. Also, ``deprecated_call`` will always produce
the same error message (previously it would produce different messages in context-manager vs.
function-call mode).

View File

@ -1 +0,0 @@
Create invoke tasks for updating the vendored packages.

View File

@ -1 +0,0 @@
Fix internal error when trying to detect the start of a recursive traceback.

View File

@ -1 +0,0 @@
Explicitly state for which hooks the calls stop after the first non-None result.

View File

@ -1 +0,0 @@
Update copyright dates in LICENSE, README.rst and in the documentation.

View File

@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2 :maxdepth: 2
release-3.1.3
release-3.1.2 release-3.1.2
release-3.1.1 release-3.1.1
release-3.1.0 release-3.1.0

View File

@ -0,0 +1,23 @@
pytest-3.1.3
=======================================
pytest 3.1.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Antoine Legrand
* Bruno Oliveira
* Max Moroz
* Raphael Pierzina
* Ronny Pfannschmidt
* Ryan Fitzpatrick
Happy testing,
The pytest Development Team

View File

@ -28,7 +28,7 @@ you will see the return value of the function call::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_assert1.py F test_assert1.py F
@ -172,7 +172,7 @@ if you run this module::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_assert2.py F test_assert2.py F

View File

@ -64,7 +64,7 @@ then you can just invoke ``pytest`` without command line options::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 1 items collected 1 item
mymodule.py . mymodule.py .

View File

@ -69,7 +69,7 @@ tests based on their module, class, method, or function name::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 5 items collecting ... collected 1 item
test_server.py::TestClass::test_method PASSED test_server.py::TestClass::test_method PASSED
@ -82,7 +82,7 @@ You can also select on the class::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items collecting ... collected 1 item
test_server.py::TestClass::test_method PASSED test_server.py::TestClass::test_method PASSED
@ -95,7 +95,7 @@ Or select multiple nodes::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 8 items collecting ... collected 2 items
test_server.py::TestClass::test_method PASSED test_server.py::TestClass::test_method PASSED
test_server.py::test_send_http PASSED test_server.py::test_send_http PASSED
@ -354,7 +354,7 @@ the test needs::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_someenv.py s test_someenv.py s
@ -366,7 +366,7 @@ and here is one that specifies exactly the environment needed::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_someenv.py . test_someenv.py .

View File

@ -336,7 +336,7 @@ The result of this test will be successful::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
<Module 'test_indirect_list.py'> <Module 'test_indirect_list.py'>
<Function 'test_indirect[a-b]'> <Function 'test_indirect[a-b]'>

View File

@ -57,7 +57,7 @@ using it::
@pytest.fixture @pytest.fixture
def smtp(): def smtp():
import smtplib import smtplib
return smtplib.SMTP("smtp.gmail.com") return smtplib.SMTP("smtp.gmail.com", 587, timeout=5)
def test_ehlo(smtp): def test_ehlo(smtp):
response, msg = smtp.ehlo() response, msg = smtp.ehlo()
@ -72,7 +72,7 @@ marked ``smtp`` fixture function. Running the test looks like this::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_smtpsimple.py F test_smtpsimple.py F
@ -157,7 +157,7 @@ access the fixture function::
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def smtp(): def smtp():
return smtplib.SMTP("smtp.gmail.com") return smtplib.SMTP("smtp.gmail.com", 587, timeout=5)
The name of the fixture again is ``smtp`` and you can access its result by The name of the fixture again is ``smtp`` and you can access its result by
listing the name ``smtp`` as an input parameter in any test or fixture listing the name ``smtp`` as an input parameter in any test or fixture
@ -247,7 +247,7 @@ the code after the *yield* statement serves as the teardown code:
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def smtp(): def smtp():
smtp = smtplib.SMTP("smtp.gmail.com") smtp = smtplib.SMTP("smtp.gmail.com", 587, timeout=5)
yield smtp # provide the fixture value yield smtp # provide the fixture value
print("teardown smtp") print("teardown smtp")
smtp.close() smtp.close()
@ -281,7 +281,7 @@ Note that we can also seamlessly use the ``yield`` syntax with ``with`` statemen
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def smtp(): def smtp():
with smtplib.SMTP("smtp.gmail.com") as smtp: with smtplib.SMTP("smtp.gmail.com", 587, timeout=5) as smtp:
yield smtp # provide the fixture value yield smtp # provide the fixture value
@ -314,7 +314,7 @@ Here's the ``smtp`` fixture changed to use ``addfinalizer`` for cleanup:
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def smtp(request): def smtp(request):
smtp = smtplib.SMTP("smtp.gmail.com") smtp = smtplib.SMTP("smtp.gmail.com", 587, timeout=5)
def fin(): def fin():
print ("teardown smtp") print ("teardown smtp")
smtp.close() smtp.close()
@ -362,7 +362,7 @@ read an optional server URL from the test module which uses our fixture::
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def smtp(request): def smtp(request):
server = getattr(request.module, "smtpserver", "smtp.gmail.com") server = getattr(request.module, "smtpserver", "smtp.gmail.com")
smtp = smtplib.SMTP(server) smtp = smtplib.SMTP(server, 587, timeout=5)
yield smtp yield smtp
print ("finalizing %s (%s)" % (smtp, server)) print ("finalizing %s (%s)" % (smtp, server))
smtp.close() smtp.close()
@ -426,7 +426,7 @@ through the special :py:class:`request <FixtureRequest>` object::
@pytest.fixture(scope="module", @pytest.fixture(scope="module",
params=["smtp.gmail.com", "mail.python.org"]) params=["smtp.gmail.com", "mail.python.org"])
def smtp(request): def smtp(request):
smtp = smtplib.SMTP(request.param) smtp = smtplib.SMTP(request.param, 587, timeout=5)
yield smtp yield smtp
print ("finalizing %s" % smtp) print ("finalizing %s" % smtp)
smtp.close() smtp.close()
@ -471,7 +471,7 @@ So let's just do another run::
response, msg = smtp.ehlo() response, msg = smtp.ehlo()
assert response == 250 assert response == 250
> assert b"smtp.gmail.com" in msg > assert b"smtp.gmail.com" in msg
E AssertionError: assert b'smtp.gmail.com' in b'mail.python.org\nSIZE 51200000\nETRN\nSTARTTLS\nENHANCEDSTATUSCODES\n8BITMIME\nDSN\nSMTPUTF8' E AssertionError: assert b'smtp.gmail.com' in b'mail.python.org\nPIPELINING\nSIZE 51200000\nETRN\nSTARTTLS\nAUTH DIGEST-MD5 NTLM CRAM-MD5\nENHANCEDSTATUSCODES\n8BITMIME\nDSN\nSMTPUTF8'
test_module.py:5: AssertionError test_module.py:5: AssertionError
-------------------------- Captured stdout setup --------------------------- -------------------------- Captured stdout setup ---------------------------

View File

@ -48,7 +48,7 @@ That's it. You can execute the test function now::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_sample.py F test_sample.py F

View File

@ -27,7 +27,7 @@ To execute it::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_sample.py F test_sample.py F

View File

@ -31,7 +31,7 @@ Running this would result in a passed test except for the last
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_tmpdir.py F test_tmpdir.py F

View File

@ -24,7 +24,7 @@ Running pytest now produces this output::
======= test session starts ======== ======= test session starts ========
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items collected 1 item
test_show_warnings.py . test_show_warnings.py .

View File

@ -2,3 +2,4 @@ invoke
tox tox
gitpython gitpython
towncrier towncrier
wheel