Skip to content

Commit 9e49ac0

Browse files
committed
Merge branch 'master' into feature_master_merge
Conflicts: CHANGELOG.rst _pytest/doctest.py _pytest/python.py doc/en/announce/sprint2016.rst testing/cx_freeze/runtests_setup.py testing/python/fixture.py
2 parents 68bed00 + c519b95 commit 9e49ac0

File tree

19 files changed

+145
-184
lines changed

19 files changed

+145
-184
lines changed

CHANGELOG.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,30 @@
146146
* Add proposal to docs for a new feature that enables users to combine multiple
147147
fixtures into one. Thanks to `@hpk42`_ and `@hackebrot`_.
148148

149+
* Rename ``getfuncargvalue`` to ``getfixturevalue``. ``getfuncargvalue`` is
150+
deprecated but still present. Thanks to `@RedBeardCode`_ and `@tomviner`_
151+
for PR (`#1626`_).
152+
153+
* Always include full assertion explanation. The previous behaviour was hiding
154+
sub-expressions that happened to be False, assuming this was redundant information.
155+
Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and
156+
`@tomviner`_ for PR.
157+
158+
* Renamed the pytest ``pdb`` module (plugin) into ``debugging``.
159+
149160
*
150161

162+
* ImportErrors in plugins now are a fatal error instead of issuing a
163+
pytest warning (`#1479`_). Thanks to `@The-Compiler`_ for the PR.
164+
151165
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
152166
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
153167
.. _#1597: https://github.com/pytest-dev/pytest/pull/1597
154168
.. _#460: https://github.com/pytest-dev/pytest/pull/460
155169
.. _#1553: https://github.com/pytest-dev/pytest/issues/1553
170+
.. _#1626: https://github.com/pytest-dev/pytest/pull/1626
171+
.. _#1503: https://github.com/pytest-dev/pytest/issues/1503
172+
.. _#1479: https://github.com/pytest-dev/pytest/issues/1479
156173

157174
.. _@graingert: https://github.com/graingert
158175
.. _@taschini: https://github.com/taschini
@@ -166,6 +183,9 @@
166183
``--continue-on-collection-errors`` option to restore previous behaviour.
167184
Thanks `@olegpidsadnyi`_ and `@omarkohl`_ for the complete PR (`#1628`_).
168185

186+
.. _@bagerard: https://github.com/bagerard
187+
.. _@davehunt: https://github.com/davehunt
188+
169189

170190
*
171191

_pytest/assertion/util.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,11 @@ def format_explanation(explanation):
3838
displaying diffs.
3939
"""
4040
explanation = ecu(explanation)
41-
explanation = _collapse_false(explanation)
4241
lines = _split_explanation(explanation)
4342
result = _format_lines(lines)
4443
return u('\n').join(result)
4544

4645

47-
def _collapse_false(explanation):
48-
"""Collapse expansions of False
49-
50-
So this strips out any "assert False\n{where False = ...\n}"
51-
blocks.
52-
"""
53-
where = 0
54-
while True:
55-
start = where = explanation.find("False\n{False = ", where)
56-
if where == -1:
57-
break
58-
level = 0
59-
prev_c = explanation[start]
60-
for i, c in enumerate(explanation[start:]):
61-
if prev_c + c == "\n{":
62-
level += 1
63-
elif prev_c + c == "\n}":
64-
level -= 1
65-
if not level:
66-
break
67-
prev_c = c
68-
else:
69-
raise AssertionError("unbalanced braces: %r" % (explanation,))
70-
end = start + i
71-
where = end
72-
if explanation[end - 1] == '\n':
73-
explanation = (explanation[:start] + explanation[start+15:end-1] +
74-
explanation[end+1:])
75-
where -= 17
76-
return explanation
77-
78-
7946
def _split_explanation(explanation):
8047
"""Return a list of individual lines in the explanation
8148

_pytest/config.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class UsageError(Exception):
6363
_preinit = []
6464

6565
default_plugins = (
66-
"mark main terminal runner python pdb unittest capture skipping "
66+
"mark main terminal runner python debugging unittest capture skipping "
6767
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion genscript "
6868
"junitxml resultlog doctest cacheprovider setuponly setupplan").split()
6969

@@ -655,20 +655,17 @@ def _set_opt_strings(self, opts):
655655
self._long_opts.append(opt)
656656

657657
def __repr__(self):
658-
retval = 'Argument('
658+
args = []
659659
if self._short_opts:
660-
retval += '_short_opts: ' + repr(self._short_opts) + ', '
660+
args += ['_short_opts: ' + repr(self._short_opts)]
661661
if self._long_opts:
662-
retval += '_long_opts: ' + repr(self._long_opts) + ', '
663-
retval += 'dest: ' + repr(self.dest) + ', '
662+
args += ['_long_opts: ' + repr(self._long_opts)]
663+
args += ['dest: ' + repr(self.dest)]
664664
if hasattr(self, 'type'):
665-
retval += 'type: ' + repr(self.type) + ', '
665+
args += ['type: ' + repr(self.type)]
666666
if hasattr(self, 'default'):
667-
retval += 'default: ' + repr(self.default) + ', '
668-
if retval[-2:] == ', ': # always long enough to test ("Argument(" )
669-
retval = retval[:-2]
670-
retval += ')'
671-
return retval
667+
args += ['default: ' + repr(self.default)]
668+
return 'Argument({0})'.format(', '.join(args))
672669

673670

674671
class OptionGroup:
@@ -927,10 +924,7 @@ def _preparse(self, args, addopts=True):
927924
args[:] = self.getini("addopts") + args
928925
self._checkversion()
929926
self.pluginmanager.consider_preparse(args)
930-
try:
931-
self.pluginmanager.load_setuptools_entrypoints("pytest11")
932-
except ImportError as e:
933-
self.warn("I2", "could not load setuptools entry import: %s" % (e,))
927+
self.pluginmanager.load_setuptools_entrypoints("pytest11")
934928
self.pluginmanager.consider_env()
935929
self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy())
936930
if self.known_args_namespace.confcutdir is None and self.inifile:
File renamed without changes.

_pytest/doctest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def __init__(self, name, parent, runner=None, dtest=None):
7070
def setup(self):
7171
if self.dtest is not None:
7272
self.fixture_request = _setup_fixtures(self)
73-
globs = dict(getfixture=self.fixture_request.getfuncargvalue)
74-
for name, value in self.fixture_request.getfuncargvalue('doctest_namespace').items():
73+
globs = dict(getfixture=self.fixture_request.getfixturevalue)
74+
for name, value in self.fixture_request.getfixturevalue('doctest_namespace').items():
7575
globs[name] = value
7676
self.dtest.globs.update(globs)
7777

_pytest/python.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99
import math
1010
import collections
11+
import warnings
1112

1213
import py
1314
import pytest
@@ -1855,7 +1856,7 @@ def _getnextfixturedef(self, argname):
18551856
fixturedefs = self._arg2fixturedefs.get(argname, None)
18561857
if fixturedefs is None:
18571858
# we arrive here because of a a dynamic call to
1858-
# getfuncargvalue(argname) usage which was naturally
1859+
# getfixturevalue(argname) usage which was naturally
18591860
# not known at parsing/collection time
18601861
fixturedefs = self._fixturemanager.getfixturedefs(
18611862
argname, self._pyfuncitem.parent.nodeid)
@@ -1950,7 +1951,7 @@ def _fillfixtures(self):
19501951
fixturenames = getattr(item, "fixturenames", self.fixturenames)
19511952
for argname in fixturenames:
19521953
if argname not in item.funcargs:
1953-
item.funcargs[argname] = self.getfuncargvalue(argname)
1954+
item.funcargs[argname] = self.getfixturevalue(argname)
19541955

19551956
def cached_setup(self, setup, teardown=None, scope="module", extrakey=None):
19561957
""" (deprecated) Return a testing resource managed by ``setup`` &
@@ -1984,17 +1985,23 @@ def finalizer():
19841985
self._addfinalizer(finalizer, scope=scope)
19851986
return val
19861987

1987-
def getfuncargvalue(self, argname):
1988-
""" Dynamically retrieve a named fixture function argument.
1988+
def getfixturevalue(self, argname):
1989+
""" Dynamically run a named fixture function.
19891990
1990-
As of pytest-2.3, it is easier and usually better to access other
1991-
fixture values by stating it as an input argument in the fixture
1992-
function. If you only can decide about using another fixture at test
1991+
Declaring fixtures via function argument is recommended where possible.
1992+
But if you can only decide whether to use another fixture at test
19931993
setup time, you may use this function to retrieve it inside a fixture
1994-
function body.
1994+
or test function body.
19951995
"""
19961996
return self._get_active_fixturedef(argname).cached_result[0]
19971997

1998+
def getfuncargvalue(self, argname):
1999+
""" Deprecated, use getfixturevalue. """
2000+
warnings.warn(
2001+
"use of getfuncargvalue is deprecated, use getfixturevalue",
2002+
DeprecationWarning)
2003+
return self.getfixturevalue(argname)
2004+
19982005
def _get_active_fixturedef(self, argname):
19992006
try:
20002007
return self._fixturedefs[argname]
@@ -2010,7 +2017,7 @@ class PseudoFixtureDef:
20102017
raise
20112018
# remove indent to prevent the python3 exception
20122019
# from leaking into the call
2013-
result = self._getfuncargvalue(fixturedef)
2020+
result = self._getfixturevalue(fixturedef)
20142021
self._funcargs[argname] = result
20152022
self._fixturedefs[argname] = fixturedef
20162023
return fixturedef
@@ -2026,7 +2033,7 @@ def _get_fixturestack(self):
20262033
l.append(fixturedef)
20272034
current = current._parent_request
20282035

2029-
def _getfuncargvalue(self, fixturedef):
2036+
def _getfixturevalue(self, fixturedef):
20302037
# prepare a subrequest object before calling fixture function
20312038
# (latter managed by fixturedef)
20322039
argname = fixturedef.argname

doc/en/_templates/layout.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
{% extends "!layout.html" %}
22
{% block header %}
3-
<div align="center" xmlns="http://www.w3.org/1999/html" style="background-color: lightgreen; padding: .5em">
4-
<h4>
5-
Want to help improve pytest? Please
6-
<a href="https://www.indiegogo.com/projects/python-testing-sprint-mid-2016#/">
7-
contribute to
8-
</a>
9-
or
10-
<a href="announce/sprint2016.html">
11-
join
12-
</a>
13-
our upcoming sprint in June 2016!
14-
15-
</h4>
16-
</div>
173
{{super()}}
184
{% endblock %}
195
{% block footer %}

doc/en/_templates/links.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<h3>Useful Links</h3>
22
<ul>
3-
<li>
4-
<a href="https://www.indiegogo.com/projects/python-testing-sprint-mid-2016#/">
5-
<b>Sprint funding campaign</b>
6-
</a>
7-
</li>
83
<li><a href="{{ pathto('index') }}">The pytest Website</a></li>
94
<li><a href="{{ pathto('contributing') }}">Contribution Guide</a></li>
105
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>

doc/en/announce/sprint2016.rst

Lines changed: 17 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ python testing sprint June 20th-26th 2016
44
.. image:: ../img/freiburg2.jpg
55
:width: 400
66

7-
The pytest core group is heading towards the biggest sprint
8-
in its history, to take place in the black forest town Freiburg
9-
in Germany. As of February 2016 we have started a `funding
7+
The pytest core group held the biggest sprint
8+
in its history in June 2016, taking place in the black forest town Freiburg
9+
in Germany. In February 2016 we started a `funding
1010
campaign on Indiegogo to cover expenses
1111
<http://igg.me/at/pytest-sprint/x/4034848>`_ The page also mentions
1212
some preliminary topics:
@@ -35,73 +35,30 @@ some preliminary topics:
3535
Participants
3636
--------------
3737

38-
Here are preliminary participants who said they are likely to come,
39-
given some expenses funding::
40-
41-
Anatoly Bubenkoff, Netherlands
42-
Ana Ribeiro, Brazil
43-
Andreas Pelme, Personalkollen, Sweden
44-
Anthony Wang, Splunk, US
45-
Brianna Laugher, Australia
46-
Bruno Oliveira, Brazil
47-
Danielle Jenkins, Splunk, US
48-
Dave Hunt, UK
49-
Florian Bruhin, Switzerland
50-
Floris Bruynooghe, Cobe.io, UK
51-
Holger Krekel, merlinux, Germany
52-
Oliver Bestwalter, Avira, Germany
53-
Omar Kohl, Germany
54-
Raphael Pierzina, FanDuel, UK
55-
Ronny Pfannschmidt, Germany
56-
Tom Viner, UK
57-
58-
<your name here?>
59-
60-
Other contributors and experienced newcomers are invited to join as well
61-
but please send a mail to the pytest-dev mailing list if you intend to
62-
do so somewhat soon, also how much funding you need if so. And if you
63-
are working for a company and using pytest heavily you are welcome to
64-
join and we encourage your company to provide some funding for the
65-
sprint. They may see it, and rightfully so, as a very cheap and deep
66-
training which brings you together with the experts in the field :)
38+
Over 20 participants took part from 4 continents, including employees
39+
from Splunk, Personalkollen, Cobe.io, FanDuel and Dolby. Some newcomers
40+
mixed with developers who have worked on pytest since its beginning, and
41+
of course everyone in between.
6742

6843

6944
Sprint organisation, schedule
7045
-------------------------------
7146

72-
tentative schedule:
47+
People arrived in Freiburg on the 19th, with sprint development taking
48+
place on 20th, 21st, 22nd, 24th and 25th. On the 23rd we took a break
49+
day for some hot hiking in the Black Forest.
7350

74-
- 19/20th arrival in Freiburg
75-
- 20th social get together, initial hacking
76-
- 21/22th full sprint days
77-
- 23rd break day, hiking
78-
- 24/25th full sprint days
79-
- 26th departure
51+
Sprint activity was organised heavily around pairing, with plenty of group
52+
discusssions to take advantage of the high bandwidth, and lightning talks
53+
as well.
8054

81-
We might adjust according to weather to make sure that if
82-
we do some hiking or excursion we'll have good weather.
83-
Freiburg is one of the sunniest places in Germany so
84-
it shouldn't be too much of a constraint.
85-
86-
87-
Accomodation
88-
----------------
89-
90-
We'll see to arrange for renting a flat with multiple
91-
beds/rooms. Hotels are usually below 100 per night.
92-
The earlier we book the better.
9355

9456
Money / funding
9557
---------------
9658

97-
The Indiegogo campaign asks for 11000 USD which should cover
98-
the costs for flights and accomodation, renting a sprint place
99-
and maybe a bit of food as well.
10059

101-
If your organisation wants to support the sprint but prefers
102-
to give money according to an invoice, get in contact with
103-
holger at http://merlinux.eu who can invoice your organisation
104-
properly.
60+
The Indiegogo campaign aimed for 11000 USD and in the end raised over
61+
12000, to reimburse travel costs, pay for a sprint venue and catering.
10562

106-
If we have excess money we'll use for further sprint/travel
107-
funding for pytest/tox contributors.
63+
Excess money is reserved for further sprint/travel funding for pytest/tox
64+
contributors.

doc/en/genapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def docmethod(self, method):
3232

3333
def pytest_funcarg__a(request):
3434
with Writer("request") as writer:
35-
writer.docmethod(request.getfuncargvalue)
35+
writer.docmethod(request.getfixturevalue)
3636
writer.docmethod(request.cached_setup)
3737
writer.docmethod(request.addfinalizer)
3838
writer.docmethod(request.applymarker)

testing/code/test_excinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class TestFormattedExcinfo:
384384
def pytest_funcarg__importasmod(self, request):
385385
def importasmod(source):
386386
source = _pytest._code.Source(source)
387-
tmpdir = request.getfuncargvalue("tmpdir")
387+
tmpdir = request.getfixturevalue("tmpdir")
388388
modpath = tmpdir.join("mod.py")
389389
tmpdir.ensure("__init__.py")
390390
modpath.write(source)
@@ -1077,4 +1077,4 @@ def test(tmpdir):
10771077
""")
10781078
result = testdir.runpytest()
10791079
result.stdout.fnmatch_lines(['* 1 failed in *'])
1080-
assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str()
1080+
assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str()

testing/cx_freeze/runtests_setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import pytest
77

88
setup(
9-
name="runtests",
10-
version="0.1",
11-
description="exemple of how embedding pytest into an executable using cx_freeze",
9+
name="runtests",
10+
version="0.1",
11+
description="example of how embedding pytest into an executable using cx_freeze",
1212
executables=[Executable("runtests_script.py")],
1313
options={"build_exe": {'includes': pytest.freeze_includes()}},
1414
)

0 commit comments

Comments
 (0)