Skip to content

Commit a736e26

Browse files
committed
Merge remote-tracking branch 'pytest-dev/master' into fix-issue-138
2 parents fbc5ba0 + a70e927 commit a736e26

38 files changed

+307
-88
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Thanks for submitting an issue!
22

33
Here's a quick checklist in what to include:
44

5-
[ ] Include a detailed description of the bug or suggestion
6-
[ ] `pip list` of the virtual environment you are using
7-
[ ] py.test and operating system versions
8-
[ ] Minimal example if possible
5+
- [ ] Include a detailed description of the bug or suggestion
6+
- [ ] `pip list` of the virtual environment you are using
7+
- [ ] py.test and operating system versions
8+
- [ ] Minimal example if possible

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Thanks for submitting a PR, your contribution is really appreciated!
22

33
Here's a quick checklist that should be present in PRs:
44

5-
[ ] Target: for bug or doc fixes, target `master`; for new features, target `features`
6-
[ ] Make sure to include one or more tests for your change
7-
[ ] Add yourself to `AUTHORS`
8-
[ ] Add a new entry to the `CHANGELOG` (choose any open position to avoid merge conflicts with other PRs)
5+
- [ ] Target: for bug or doc fixes, target `master`; for new features, target `features`
6+
- [ ] Make sure to include one or more tests for your change
7+
- [ ] Add yourself to `AUTHORS`
8+
- [ ] Add a new entry to the `CHANGELOG` (choose any open position to avoid merge conflicts with other PRs)

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Andy Freeland
1010
Anthon van der Neut
1111
Armin Rigo
1212
Aron Curzon
13+
Aviv Palivoda
1314
Benjamin Peterson
1415
Bob Ippolito
1516
Brian Dorsey
@@ -23,6 +24,7 @@ Christian Theunert
2324
Christian Tismer
2425
Christopher Gilling
2526
Daniel Grana
27+
Daniel Hahler
2628
Daniel Nuri
2729
Dave Hunt
2830
David Mohr
@@ -59,6 +61,7 @@ Marc Schlaich
5961
Mark Abramowitz
6062
Markus Unterwaditzer
6163
Martijn Faassen
64+
Matt Bachmann
6265
Michael Aquilina
6366
Michael Birtwell
6467
Michael Droettboom

CHANGELOG.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,49 @@
1-
2.9.1.dev1
1+
2.9.2.dev1
22
==========
33

44
**Bug Fixes**
55

66
*
77

8+
*
9+
10+
*
11+
12+
*
13+
14+
15+
2.9.1
16+
=====
17+
18+
**Bug Fixes**
19+
20+
* Improve error message when a plugin fails to load.
21+
Thanks `@nicoddemus`_ for the PR.
22+
23+
* Fix (`#1178 <https://github.com/pytest-dev/pytest/issues/1178>`_):
24+
``pytest.fail`` with non-ascii characters raises an internal pytest error.
25+
Thanks `@nicoddemus`_ for the PR.
26+
827
* Fix (`#469`_): junit parses report.nodeid incorrectly, when params IDs
928
contain ``::``. Thanks `@tomviner`_ for the PR (`#1431`_).
1029

11-
*
30+
* Fix (`#578 <https://github.com/pytest-dev/pytest/issues/578>`_): SyntaxErrors
31+
containing non-ascii lines at the point of failure generated an internal
32+
py.test error.
33+
Thanks `@asottile`_ for the report and `@nicoddemus`_ for the PR.
34+
35+
* Fix (`#1437`_): When passing in a bytestring regex pattern to parameterize
36+
attempt to decode it as utf-8 ignoring errors.
37+
38+
* Fix (`#649`_): parametrized test nodes cannot be specified to run on the command line.
1239

40+
41+
.. _#1437: https://github.com/pytest-dev/pytest/issues/1437
1342
.. _#469: https://github.com/pytest-dev/pytest/issues/469
1443
.. _#1431: https://github.com/pytest-dev/pytest/pull/1431
44+
.. _#649: https://github.com/pytest-dev/pytest/issues/649
45+
46+
.. _@asottile: https://github.com/asottile
1547

1648

1749
2.9.0

_pytest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#
2-
__version__ = '2.9.1.dev1'
2+
__version__ = '2.9.2.dev1'

_pytest/_code/_py2traceback.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def format_exception_only(etype, value):
4747
filename = filename or "<string>"
4848
lines.append(' File "%s", line %d\n' % (filename, lineno))
4949
if badline is not None:
50-
lines.append(' %s\n' % badline.strip())
50+
if isinstance(badline, bytes): # python 2 only
51+
badline = badline.decode('utf-8', 'replace')
52+
lines.append(u' %s\n' % badline.strip())
5153
if offset is not None:
5254
caretspace = badline.rstrip('\n')[:offset].lstrip()
5355
# non-space whitespace (likes tabs) must be kept for alignment

_pytest/cacheprovider.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def pytest_sessionfinish(self, session):
149149
config = self.config
150150
if config.getvalue("cacheshow") or hasattr(config, "slaveinput"):
151151
return
152-
config.cache.set("cache/lastfailed", self.lastfailed)
152+
prev_failed = config.cache.get("cache/lastfailed", None) is not None
153+
if (session.testscollected and prev_failed) or self.lastfailed:
154+
config.cache.set("cache/lastfailed", self.lastfailed)
153155

154156

155157
def pytest_addoption(parser):

_pytest/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,13 @@ def import_plugin(self, modname):
383383
importspec = modname
384384
try:
385385
__import__(importspec)
386-
except ImportError:
387-
raise
386+
except ImportError as e:
387+
new_exc = ImportError('Error importing plugin "%s": %s' % (modname, e))
388+
# copy over name and path attributes
389+
for attr in ('name', 'path'):
390+
if hasattr(e, attr):
391+
setattr(new_exc, attr, getattr(e, attr))
392+
raise new_exc
388393
except Exception as e:
389394
import pytest
390395
if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception):

_pytest/hookspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def pytest_cmdline_main(config):
8181
""" called for performing the main command line action. The default
8282
implementation will invoke the configure hooks and runtest_mainloop. """
8383

84-
def pytest_load_initial_conftests(args, early_config, parser):
84+
def pytest_load_initial_conftests(early_config, parser, args):
8585
""" implements the loading of initial conftest files ahead
8686
of command line option parsing. """
8787

_pytest/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,8 @@ def _matchnodes(self, matching, names):
718718
if rep.passed:
719719
has_matched = False
720720
for x in rep.result:
721-
if x.name == name:
721+
# TODO: remove parametrized workaround once collection structure contains parametrization
722+
if x.name == name or x.name.split("[")[0] == name:
722723
resultnodes.extend(self.matchnodes([x], nextnames))
723724
has_matched = True
724725
# XXX accept IDs that don't have "()" for class instances

_pytest/python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def _prunetraceback(self, excinfo):
740740
def _repr_failure_py(self, excinfo, style="long"):
741741
if excinfo.errisinstance(pytest.fail.Exception):
742742
if not excinfo.value.pytrace:
743-
return str(excinfo.value)
743+
return py._builtin._totext(excinfo.value)
744744
return super(FunctionMixin, self)._repr_failure_py(excinfo,
745745
style=style)
746746

@@ -1115,7 +1115,7 @@ def _idval(val, argname, idx, idfn):
11151115
elif isinstance(val, (float, int, str, bool, NoneType)):
11161116
return str(val)
11171117
elif isinstance(val, REGEX_TYPE):
1118-
return val.pattern
1118+
return _escape_bytes(val.pattern) if isinstance(val.pattern, bytes) else val.pattern
11191119
elif enum is not None and isinstance(val, enum.Enum):
11201120
return str(val)
11211121
elif isclass(val) and hasattr(val, '__name__'):

_pytest/runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ def __init__(self, msg=None, pytrace=True):
435435

436436
def __repr__(self):
437437
if self.msg:
438-
return str(self.msg)
438+
val = self.msg
439+
if isinstance(val, bytes):
440+
val = py._builtin._totext(val, errors='replace')
441+
return val
439442
return "<%s instance>" %(self.__class__.__name__,)
440443
__str__ = __repr__
441444

doc/en/announce/release-2.9.1.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
pytest-2.9.1
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+
Bruno Oliveira
18+
Daniel Hahler
19+
Dmitry Malinovsky
20+
Florian Bruhin
21+
Floris Bruynooghe
22+
Matt Bachmann
23+
Ronny Pfannschmidt
24+
TomV
25+
Vladimir Bolshakov
26+
Zearin
27+
palaviv
28+
29+
30+
Happy testing,
31+
The py.test Development Team
32+
33+
34+
2.9.1 (compared to 2.9.0)
35+
-------------------------
36+
37+
**Bug Fixes**
38+
39+
* Improve error message when a plugin fails to load.
40+
Thanks `@nicoddemus`_ for the PR.
41+
42+
* Fix (`#1178 <https://github.com/pytest-dev/pytest/issues/1178>`_):
43+
``pytest.fail`` with non-ascii characters raises an internal pytest error.
44+
Thanks `@nicoddemus`_ for the PR.
45+
46+
* Fix (`#469`_): junit parses report.nodeid incorrectly, when params IDs
47+
contain ``::``. Thanks `@tomviner`_ for the PR (`#1431`_).
48+
49+
* Fix (`#578 <https://github.com/pytest-dev/pytest/issues/578>`_): SyntaxErrors
50+
containing non-ascii lines at the point of failure generated an internal
51+
py.test error.
52+
Thanks `@asottile`_ for the report and `@nicoddemus`_ for the PR.
53+
54+
* Fix (`#1437`_): When passing in a bytestring regex pattern to parameterize
55+
attempt to decode it as utf-8 ignoring errors.
56+
57+
* Fix (`#649`_): parametrized test nodes cannot be specified to run on the command line.
58+
59+
60+
.. _#1437: https://github.com/pytest-dev/pytest/issues/1437
61+
.. _#469: https://github.com/pytest-dev/pytest/issues/469
62+
.. _#1431: https://github.com/pytest-dev/pytest/pull/1431
63+
.. _#649: https://github.com/pytest-dev/pytest/issues/649
64+
65+
.. _@asottile: https://github.com/asottile

doc/en/assert.rst

Lines changed: 2 additions & 2 deletions
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.0, py-1.4.31, pluggy-0.3.1
29+
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
3030
rootdir: $REGENDOC_TMPDIR, inifile:
3131
collected 1 items
3232
@@ -143,7 +143,7 @@ if you run this module::
143143

144144
$ py.test test_assert2.py
145145
======= test session starts ========
146-
platform linux -- Python 3.4.0, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
146+
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
147147
rootdir: $REGENDOC_TMPDIR, inifile:
148148
collected 1 items
149149

doc/en/cache.rst

Lines changed: 3 additions & 3 deletions
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.0, py-1.4.31, pluggy-0.3.1
83+
platform linux -- Python 3.4.0, pytest-2.9.1, 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.0, py-1.4.31, pluggy-0.3.1
124+
platform linux -- Python 3.4.0, pytest-2.9.1, 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.0, py-1.4.31, pluggy-0.3.1
229+
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
230230
rootdir: $REGENDOC_TMPDIR, inifile:
231231
collected 1 items
232232

doc/en/capture.rst

Lines changed: 1 addition & 1 deletion
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.0, py-1.4.31, pluggy-0.3.1
67+
platform linux -- Python 3.4.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
6868
rootdir: $REGENDOC_TMPDIR, inifile:
6969
collected 2 items
7070

doc/en/doctest.rst

Lines changed: 1 addition & 1 deletion
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.0, py-1.4.31, pluggy-0.3.1
52+
platform linux -- Python 3.4.0, pytest-2.9.1, 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)