Skip to content

Commit b5bd4d9

Browse files
merge master to features
2 parents 8c1be62 + f423f08 commit b5bd4d9

28 files changed

+262
-119
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ include/
1616
*.class
1717
*.orig
1818
*~
19+
.hypothesis/
1920

2021
.eggs/
2122

CHANGELOG.rst

+20-3
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,24 @@
7979
.. _#372: https://github.com/pytest-dev/pytest/issues/372
8080
.. _#1544: https://github.com/pytest-dev/pytest/issues/1544
8181

82-
2.9.2.dev1
83-
==========
8482

8583
**Bug Fixes**
8684

8785
* When receiving identical test ids in parametrize we generate unique test ids.
8886

89-
* Fix win32 path issue when puttinging custom config file with absolute path
87+
2.9.2
88+
=====
89+
90+
**Bug Fixes**
91+
92+
* fix `#510`_: skip tests where one parameterize dimension was empty
93+
thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR
94+
95+
* Fix Xfail does not work with condition keyword argument.
96+
Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_
97+
for PR the (`#1524`_).
98+
99+
* Fix win32 path issue when puttinging custom config file with absolute path
90100
in ``pytest.main("-c your_absolute_path")``.
91101

92102
* Fix maximum recursion depth detection when raised error class is not aware
@@ -100,10 +110,17 @@
100110
* Minor improvements and fixes to the documentation.
101111
Thanks `@omarkohl`_ for the PR.
102112

113+
* Fix ``--fixtures`` to show all fixture definitions as opposed to just
114+
one per fixture name.
115+
Thanks to `@hackebrot`_ for the PR.
103116

117+
.. _#510: https://github.com/pytest-dev/pytest/issues/510
104118
.. _#1506: https://github.com/pytest-dev/pytest/pull/1506
119+
.. _#1496: https://github.com/pytest-dev/pytest/issue/1496
120+
.. _#1524: https://github.com/pytest-dev/pytest/issue/1524
105121

106122
.. _@prusse-martin: https://github.com/prusse-martin
123+
.. _@astraw38: https://github.com/astraw38
107124

108125

109126
2.9.1

HOWTORELEASE.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Note: this assumes you have already registered on pypi.
4141
8. Build the docs, you need a virtualenv with py and sphinx
4242
installed::
4343

44-
cd doc/en
44+
cd doc/en
4545
make html
4646

4747
Commit any changes before tagging the release.
@@ -71,7 +71,7 @@ Note: this assumes you have already registered on pypi.
7171

7272
11. Publish to pypi::
7373

74-
devpi push pytest-VERSION pypi:NAME
74+
devpi push pytest==VERSION pypi:NAME
7575

7676
where NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
7777
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.

_pytest/python.py

+15-17
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,6 @@ def setmulti(self, valtypes, argnames, valset, id, keywords, scopenum,
894894
getattr(self, valtype_for_arg)[arg] = val
895895
self.indices[arg] = param_index
896896
self._arg2scopenum[arg] = scopenum
897-
if val is _notexists:
898-
self._emptyparamspecified = True
899897
self._idlist.append(id)
900898
self.keywords.update(keywords)
901899

@@ -1014,6 +1012,15 @@ def parametrize(self, argnames, argvalues, indirect=False, ids=None,
10141012
argvalues = [(val,) for val in argvalues]
10151013
if not argvalues:
10161014
argvalues = [(_notexists,) * len(argnames)]
1015+
# we passed a empty list to parameterize, skip that test
1016+
#
1017+
fs, lineno = getfslineno(self.function)
1018+
newmark = pytest.mark.skip(
1019+
reason="got empty parameter set %r, function %s at %s:%d" % (
1020+
argnames, self.function.__name__, fs, lineno))
1021+
newmarks = newkeywords.setdefault(0, {})
1022+
newmarks[newmark.markname] = newmark
1023+
10171024

10181025
if scope is None:
10191026
scope = "function"
@@ -1206,12 +1213,12 @@ def _showfixtures_main(config, session):
12061213
assert fixturedefs is not None
12071214
if not fixturedefs:
12081215
continue
1209-
fixturedef = fixturedefs[-1]
1210-
loc = getlocation(fixturedef.func, curdir)
1211-
available.append((len(fixturedef.baseid),
1212-
fixturedef.func.__module__,
1213-
curdir.bestrelpath(loc),
1214-
fixturedef.argname, fixturedef))
1216+
for fixturedef in fixturedefs:
1217+
loc = getlocation(fixturedef.func, curdir)
1218+
available.append((len(fixturedef.baseid),
1219+
fixturedef.func.__module__,
1220+
curdir.bestrelpath(loc),
1221+
fixturedef.argname, fixturedef))
12151222

12161223
available.sort()
12171224
currentmodule = None
@@ -1703,15 +1710,6 @@ def runtest(self):
17031710
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
17041711

17051712
def setup(self):
1706-
# check if parametrization happend with an empty list
1707-
try:
1708-
self.callspec._emptyparamspecified
1709-
except AttributeError:
1710-
pass
1711-
else:
1712-
fs, lineno = self._getfslineno()
1713-
pytest.skip("got empty parameter set, function %s at %s:%d" %(
1714-
self.function.__name__, fs, lineno))
17151713
super(Function, self).setup()
17161714
fillfixtures(self)
17171715

_pytest/skipping.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _istrue(self):
120120
return self.result
121121
if self.holder:
122122
d = self._getglobals()
123-
if self.holder.args:
123+
if self.holder.args or 'condition' in self.holder.kwargs:
124124
self.result = False
125125
# "holder" might be a MarkInfo or a MarkDecorator; only
126126
# MarkInfo keeps track of all parameters it received in an
@@ -130,6 +130,8 @@ def _istrue(self):
130130
else:
131131
arglist = [(self.holder.args, self.holder.kwargs)]
132132
for args, kwargs in arglist:
133+
if 'condition' in kwargs:
134+
args = (kwargs['condition'],)
133135
for expr in args:
134136
self.expr = expr
135137
if isinstance(expr, py.builtin._basestring):

doc/en/announce/index.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Release announcements
77

88

99
sprint2016
10+
release-2.9.1
11+
release-2.9.1
1012
release-2.9.0
1113
release-2.8.7
1214
release-2.8.6
@@ -45,4 +47,3 @@ Release announcements
4547
release-2.0.2
4648
release-2.0.1
4749
release-2.0.0
48-

doc/en/announce/release-2.9.2.rst

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
pytest-2.9.2
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+
7+
See below for the changes and see docs at:
8+
9+
http://pytest.org
10+
11+
As usual, you can upgrade from pypi via::
12+
13+
pip install -U pytest
14+
15+
Thanks to all who contributed to this release, among them:
16+
17+
Adam Chainz
18+
Benjamin Dopplinger
19+
Bruno Oliveira
20+
Florian Bruhin
21+
John Towler
22+
Martin Prusse
23+
Meng Jue
24+
MengJueM
25+
Omar Kohl
26+
Quentin Pradet
27+
Ronny Pfannschmidt
28+
Thomas Güttler
29+
TomV
30+
Tyler Goodlet
31+
32+
33+
Happy testing,
34+
The py.test Development Team
35+
36+
37+
2.9.2 (compared to 2.9.1)
38+
---------------------------
39+
40+
**Bug Fixes**
41+
42+
* fix `#510`_: skip tests where one parameterize dimension was empty
43+
thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR
44+
45+
* Fix Xfail does not work with condition keyword argument.
46+
Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_
47+
for PR the (`#1524`_).
48+
49+
* Fix win32 path issue when puttinging custom config file with absolute path
50+
in ``pytest.main("-c your_absolute_path")``.
51+
52+
* Fix maximum recursion depth detection when raised error class is not aware
53+
of unicode/encoded bytes.
54+
Thanks `@prusse-martin`_ for the PR (`#1506`_).
55+
56+
* Fix ``pytest.mark.skip`` mark when used in strict mode.
57+
Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for
58+
showing how to fix the bug.
59+
60+
* Minor improvements and fixes to the documentation.
61+
Thanks `@omarkohl`_ for the PR.
62+
63+
* Fix ``--fixtures`` to show all fixture definitions as opposed to just
64+
one per fixture name.
65+
Thanks to `@hackebrot`_ for the PR.
66+
67+
.. _#510: https://github.com/pytest-dev/pytest/issues/510
68+
.. _#1506: https://github.com/pytest-dev/pytest/pull/1506
69+
.. _#1496: https://github.com/pytest-dev/pytest/issue/1496
70+
.. _#1524: https://github.com/pytest-dev/pytest/issue/1524
71+
72+
.. _@prusse-martin: https://github.com/prusse-martin
73+
.. _@astraw38: https://github.com/astraw38

doc/en/assert.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ you will see the return value of the function call::
2626

2727
$ py.test test_assert1.py
2828
======= test session starts ========
29-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
29+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
3030
rootdir: $REGENDOC_TMPDIR, inifile:
3131
collected 1 items
3232
@@ -161,7 +161,7 @@ if you run this module::
161161

162162
$ py.test test_assert2.py
163163
======= test session starts ========
164-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
164+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
165165
rootdir: $REGENDOC_TMPDIR, inifile:
166166
collected 1 items
167167
@@ -174,7 +174,7 @@ if you run this module::
174174
set1 = set("1308")
175175
set2 = set("8035")
176176
> assert set1 == set2
177-
E assert set(['0', '1', '3', '8']) == set(['0', '3', '5', '8'])
177+
E assert {'0', '1', '3', '8'} == {'0', '3', '5', '8'}
178178
E Extra items in the left set:
179179
E '1'
180180
E Extra items in the right set:

doc/en/cache.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ If you then run it with ``--lf``::
8080

8181
$ py.test --lf
8282
======= test session starts ========
83-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
83+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
8484
run-last-failure: rerun last 2 failures
8585
rootdir: $REGENDOC_TMPDIR, inifile:
8686
collected 50 items
@@ -121,7 +121,7 @@ of ``FF`` and dots)::
121121

122122
$ py.test --ff
123123
======= test session starts ========
124-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
124+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
125125
run-last-failure: rerun last 2 failures first
126126
rootdir: $REGENDOC_TMPDIR, inifile:
127127
collected 50 items
@@ -226,7 +226,7 @@ You can always peek at the content of the cache using the
226226

227227
$ py.test --cache-clear
228228
======= test session starts ========
229-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
229+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
230230
rootdir: $REGENDOC_TMPDIR, inifile:
231231
collected 1 items
232232

doc/en/capture.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ of the failing function and hide the other one::
6464

6565
$ py.test
6666
======= test session starts ========
67-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
67+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
6868
rootdir: $REGENDOC_TMPDIR, inifile:
6969
collected 2 items
7070

doc/en/doctest.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ then you can just invoke ``py.test`` without command line options::
4949

5050
$ py.test
5151
======= test session starts ========
52-
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
52+
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
5353
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
5454
collected 1 items
5555

0 commit comments

Comments
 (0)