Skip to content

Commit 199fcf9

Browse files
committed
Merge branch 'master' into 'features'
2 parents bc32e45 + c8caa87 commit 199fcf9

24 files changed

+244
-48
lines changed

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Erik M. Bray
3737
Florian Bruhin
3838
Floris Bruynooghe
3939
Gabriel Reis
40+
Georgy Dyuldin
4041
Graham Horler
4142
Grig Gheorghiu
4243
Guido Wesdorp
@@ -77,3 +78,4 @@ Simon Gomizelj
7778
Russel Winder
7879
Ben Webb
7980
Alexei Kozlenok
81+
Cal Leeming

CHANGELOG.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@
5151
.. _@The-Compiler: https://github.com/The-Compiler
5252

5353

54-
2.8.6.dev1
55-
==========
54+
2.8.7.dev1
55+
----------
56+
57+
58+
2.8.6
59+
-----
5660

5761
- fix #1259: allow for double nodeids in junitxml,
5862
this was a regression failing plugins combinations
@@ -68,10 +72,20 @@
6872
- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
6973
Thanks David R. MacIver for the report and Bruno Oliveira for the PR.
7074

75+
- fix #1223: captured stdout and stderr are now properly displayed before
76+
entering pdb when ``--pdb`` is used instead of being thrown away.
77+
Thanks Cal Leeming for the PR.
78+
7179
- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now
7280
properly displayed.
7381
Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.
7482

83+
- fix #628: fixed internal UnicodeDecodeError when doctests contain unicode.
84+
Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR.
85+
86+
- fix #1334: Add captured stdout to jUnit XML report on setup error.
87+
Thanks Georgy Dyuldin for the PR.
88+
7589

7690
2.8.5
7791
=====

HOWTORELEASE.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ Note: this assumes you have already registered on pypi.
2727
devpi list pytest
2828

2929
or look at failures with "devpi list -f pytest".
30-
There will be some failed environments like e.g. the py33-trial
31-
or py27-pexpect tox environments on Win32 platforms
32-
which is ok (tox does not support skipping on
33-
per-platform basis yet).
3430

3531
7. Regenerate the docs examples using tox, and check for regressions::
3632

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. image:: doc/en/img/pytest1.png
1+
.. image:: http://pytest.org/latest/_static/pytest1.png
22
:target: http://pytest.org
33
:align: center
44
:alt: pytest
@@ -60,7 +60,7 @@ Features
6060
- Detailed info on failing `assert statements <http://pytest.org/latest/assert.html>`_ (no need to remember ``self.assert*`` names);
6161

6262
- `Auto-discovery
63-
<http://pytest.org/latest/goodpractises.html#python-test-discovery>`_
63+
<http://pytest.org/latest/goodpractices.html#python-test-discovery>`_
6464
of test modules and functions;
6565

6666
- `Modular fixtures <http://pytest.org/latest/fixture.html>`_ for

_pytest/assertion/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def callbinrepr(op, left, right):
120120
config=item.config, op=op, left=left, right=right)
121121
for new_expl in hook_result:
122122
if new_expl:
123-
if (sum(len(p) for p in new_expl[1:]) > 80*8
124-
and item.config.option.verbose < 2
125-
and not _running_on_ci()):
123+
if (sum(len(p) for p in new_expl[1:]) > 80*8 and
124+
item.config.option.verbose < 2 and
125+
not _running_on_ci()):
126126
show_max = 10
127127
truncated_lines = len(new_expl) - show_max
128128
new_expl[show_max:] = [py.builtin._totext(

_pytest/assertion/util.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ def ecu(s):
140140

141141
summary = u('%s %s %s') % (ecu(left_repr), op, ecu(right_repr))
142142

143-
issequence = lambda x: (isinstance(x, (list, tuple, Sequence))
144-
and not isinstance(x, basestring))
143+
issequence = lambda x: (isinstance(x, (list, tuple, Sequence)) and
144+
not isinstance(x, basestring))
145145
istext = lambda x: isinstance(x, basestring)
146146
isdict = lambda x: isinstance(x, dict)
147147
isset = lambda x: isinstance(x, (set, frozenset))
@@ -263,8 +263,7 @@ def _compare_eq_sequence(left, right, verbose=False):
263263
explanation += [
264264
u('Right contains more items, first extra item: %s') %
265265
py.io.saferepr(right[len(left)],)]
266-
return explanation # + _diff_text(pprint.pformat(left),
267-
# pprint.pformat(right))
266+
return explanation
268267

269268

270269
def _compare_eq_set(left, right, verbose=False):

_pytest/doctest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ def repr_failure(self, excinfo):
9090
reprlocation = ReprFileLocation(filename, lineno, message)
9191
checker = _get_checker()
9292
REPORT_UDIFF = doctest.REPORT_UDIFF
93-
filelines = py.path.local(filename).readlines(cr=0)
94-
lines = []
9593
if lineno is not None:
96-
i = max(test.lineno, max(0, lineno - 10)) # XXX?
97-
for line in filelines[i:lineno]:
98-
lines.append("%03d %s" % (i+1, line))
99-
i += 1
94+
lines = doctestfailure.test.docstring.splitlines(False)
95+
# add line numbers to the left of the error message
96+
lines = ["%03d %s" % (i + test.lineno + 1, x)
97+
for (i, x) in enumerate(lines)]
98+
# trim docstring error lines to 10
99+
lines = lines[example.lineno - 9:example.lineno + 1]
100100
else:
101-
lines.append('EXAMPLE LOCATION UNKNOWN, not showing all tests of that example')
101+
lines = ['EXAMPLE LOCATION UNKNOWN, not showing all tests of that example']
102102
indent = '>>>'
103103
for line in example.source.splitlines():
104104
lines.append('??? %s %s' % (indent, line))

_pytest/junitxml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def append_collect_skipped(self, report):
163163
def append_error(self, report):
164164
self._add_simple(
165165
Junit.error, "test setup failure", report.longrepr)
166+
self._write_captured_output(report)
166167

167168
def append_skipped(self, report):
168169
if hasattr(report, "wasxfail"):

_pytest/pdb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ class PdbInvoke:
5252
def pytest_exception_interact(self, node, call, report):
5353
capman = node.config.pluginmanager.getplugin("capturemanager")
5454
if capman:
55-
capman.suspendcapture(in_=True)
55+
out, err = capman.suspendcapture(in_=True)
56+
sys.stdout.write(out)
57+
sys.stdout.write(err)
5658
_enter_pdb(node, call.excinfo, report)
5759

5860
def pytest_internalerror(self, excrepr, excinfo):

_pytest/python.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ def classnamefilter(self, name):
416416

417417
def istestfunction(self, obj, name):
418418
return (
419-
(self.funcnamefilter(name) or self.isnosetest(obj))
420-
and safe_getattr(obj, "__call__", False) and getfixturemarker(obj) is None
419+
(self.funcnamefilter(name) or self.isnosetest(obj)) and
420+
safe_getattr(obj, "__call__", False) and getfixturemarker(obj) is None
421421
)
422422

423423
def istestclass(self, obj, name):
@@ -1765,8 +1765,10 @@ def formatrepr(self):
17651765
stack.extend(map(lambda x: x.func, self.fixturestack))
17661766
msg = self.msg
17671767
if msg is not None:
1768-
stack = stack[:-1] # the last fixture raise an error, let's present
1769-
# it at the requesting side
1768+
# the last fixture raise an error, let's present
1769+
# it at the requesting side
1770+
stack = stack[:-1]
1771+
17701772
for function in stack:
17711773
fspath, lineno = getfslineno(function)
17721774
try:

_pytest/unittest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ def pytest_pycollect_makeitem(collector, name, obj):
2424

2525

2626
class UnitTestCase(pytest.Class):
27-
nofuncargs = True # marker for fixturemanger.getfixtureinfo()
28-
# to declare that our children do not support funcargs
29-
#
27+
# marker for fixturemanger.getfixtureinfo()
28+
# to declare that our children do not support funcargs
29+
nofuncargs = True
30+
3031
def setup(self):
3132
cls = self.obj
3233
if getattr(cls, '__unittest_skip__', False):

doc/en/announce/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Release announcements
66
:maxdepth: 2
77

88

9+
release-2.8.6
910
release-2.8.5
1011
release-2.8.4
1112
release-2.8.3

doc/en/announce/release-2.8.6.rst

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
pytest-2.8.6
2+
============
3+
4+
pytest is a mature Python testing tool with more than a 1100 tests
5+
against itself, passing on many different interpreters and platforms.
6+
This release is supposed to be drop-in compatible to 2.8.5.
7+
8+
See below for the changes and see docs at:
9+
10+
http://pytest.org
11+
12+
As usual, you can upgrade from pypi via::
13+
14+
pip install -U pytest
15+
16+
Thanks to all who contributed to this release, among them:
17+
18+
AMiT Kumar
19+
Bruno Oliveira
20+
Erik M. Bray
21+
Florian Bruhin
22+
Georgy Dyuldin
23+
Jeff Widman
24+
Kartik Singhal
25+
Loïc Estève
26+
Manu Phatak
27+
Peter Demin
28+
Rick van Hattem
29+
Ronny Pfannschmidt
30+
Ulrich Petri
31+
foxx
32+
33+
34+
Happy testing,
35+
The py.test Development Team
36+
37+
38+
2.8.6 (compared to 2.8.5)
39+
-------------------------
40+
41+
- fix #1259: allow for double nodeids in junitxml,
42+
this was a regression failing plugins combinations
43+
like pytest-pep8 + pytest-flakes
44+
45+
- Workaround for exception that occurs in pyreadline when using
46+
``--pdb`` with standard I/O capture enabled.
47+
Thanks Erik M. Bray for the PR.
48+
49+
- fix #900: Better error message in case the target of a ``monkeypatch`` call
50+
raises an ``ImportError``.
51+
52+
- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
53+
Thanks David R. MacIver for the report and Bruno Oliveira for the PR.
54+
55+
- fix #1223: captured stdout and stderr are now properly displayed before
56+
entering pdb when ``--pdb`` is used instead of being thrown away.
57+
Thanks Cal Leeming for the PR.
58+
59+
- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now
60+
properly displayed.
61+
Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.
62+
63+
- fix #628: fixed internal UnicodeDecodeError when doctests contain unicode.
64+
Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR.
65+
66+
- fix #1334: Add captured stdout to jUnit XML report on setup error.
67+
Thanks Georgy Dyuldin for the PR.

doc/en/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Where to go next
193193
Here are a few suggestions where to go next:
194194

195195
* :ref:`cmdline` for command line invocation examples
196-
* :ref:`good practises <goodpractises>` for virtualenv, test layout, genscript support
196+
* :ref:`good practices <goodpractices>` for virtualenv, test layout, genscript support
197197
* :ref:`fixtures` for providing a functional baseline to your tests
198198
* :ref:`apiref` for documentation and examples on using ``pytest``
199199
* :ref:`plugins` managing and writing plugins

doc/en/goodpractises.rst renamed to doc/en/goodpractices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.. highlightlang:: python
2-
.. _`goodpractises`:
2+
.. _`goodpractices`:
33

44
Good Integration Practices
55
=================================================

doc/en/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pytest: helps you write better programs
4040
- multi-paradigm: pytest can run ``nose``, ``unittest`` and
4141
``doctest`` style test suites, including running testcases made for
4242
Django and trial
43-
- supports :ref:`good integration practises <goodpractises>`
43+
- supports :ref:`good integration practices <goodpractices>`
4444
- supports extended :ref:`xUnit style setup <xunitsetup>`
4545
- supports domain-specific :ref:`non-python tests`
4646
- supports generating `test coverage reports

doc/en/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Getting started basics
77

88
getting-started
99
usage
10-
goodpractises
10+
goodpractices
1111
projects
1212
faq
1313

doc/en/parametrize.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ to an expected output::
4141

4242
# content of test_expectation.py
4343
import pytest
44-
@pytest.mark.parametrize("input,expected", [
44+
@pytest.mark.parametrize("test_input,expected", [
4545
("3+5", 8),
4646
("2+4", 6),
4747
("6*9", 42),
4848
])
49-
def test_eval(input, expected):
50-
assert eval(input) == expected
49+
def test_eval(test_input, expected):
50+
assert eval(test_input) == expected
5151

52-
Here, the ``@parametrize`` decorator defines three different ``(input,expected)``
52+
Here, the ``@parametrize`` decorator defines three different ``(test_input,expected)``
5353
tuples so that the ``test_eval`` function will run three times using
5454
them in turn::
5555

@@ -64,15 +64,15 @@ them in turn::
6464
======= FAILURES ========
6565
_______ test_eval[6*9-42] ________
6666
67-
input = '6*9', expected = 42
67+
test_input = '6*9', expected = 42
6868
69-
@pytest.mark.parametrize("input,expected", [
69+
@pytest.mark.parametrize("test_input,expected", [
7070
("3+5", 8),
7171
("2+4", 6),
7272
("6*9", 42),
7373
])
74-
def test_eval(input, expected):
75-
> assert eval(input) == expected
74+
def test_eval(test_input, expected):
75+
> assert eval(test_input) == expected
7676
E assert 54 == 42
7777
E + where 54 = eval('6*9')
7878
@@ -91,13 +91,13 @@ for example with the builtin ``mark.xfail``::
9191

9292
# content of test_expectation.py
9393
import pytest
94-
@pytest.mark.parametrize("input,expected", [
94+
@pytest.mark.parametrize("test_input,expected", [
9595
("3+5", 8),
9696
("2+4", 6),
9797
pytest.mark.xfail(("6*9", 42)),
9898
])
99-
def test_eval(input, expected):
100-
assert eval(input) == expected
99+
def test_eval(test_input, expected):
100+
assert eval(test_input) == expected
101101

102102
Let's run this::
103103

doc/en/plugins.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Here is a little annotated list for some popular plugins:
5656
check source code with pyflakes.
5757

5858
* `oejskit <http://pypi.python.org/pypi/oejskit>`_:
59-
a plugin to run javascript unittests in life browsers.
59+
a plugin to run javascript unittests in live browsers.
6060

6161
To see a complete list of all plugins with their latest testing
6262
status against different py.test and Python versions, please visit

doc/en/writing_plugins.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Here is how you might run it::
9595
python package directory (i.e. one containing an ``__init__.py``) then
9696
"import conftest" can be ambiguous because there might be other
9797
``conftest.py`` files as well on your PYTHONPATH or ``sys.path``.
98-
It is thus good practise for projects to either put ``conftest.py``
98+
It is thus good practice for projects to either put ``conftest.py``
9999
under a package scope or to never import anything from a
100100
conftest.py file.
101101

@@ -485,12 +485,20 @@ Session related reporting hooks:
485485
.. autofunction:: pytest_itemcollected
486486
.. autofunction:: pytest_collectreport
487487
.. autofunction:: pytest_deselected
488+
.. autofunction:: pytest_report_header
489+
.. autofunction:: pytest_report_teststatus
490+
.. autofunction:: pytest_terminal_summary
488491

489492
And here is the central hook for reporting about
490493
test execution:
491494

492495
.. autofunction:: pytest_runtest_logreport
493496

497+
You can also use this hook to customize assertion representation for some
498+
types:
499+
500+
.. autofunction:: pytest_assertrepr_compare
501+
494502

495503
Debugging/Interaction hooks
496504
---------------------------

0 commit comments

Comments
 (0)