Skip to content

Commit 9d2149d

Browse files
authored
Merge pull request #1884 from pytest-dev/master
merge master into features
2 parents c5675d3 + 82218e4 commit 9d2149d

40 files changed

Lines changed: 312 additions & 387 deletions

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ env:
2626
- TESTENV=py27-nobyte
2727
- TESTENV=doctesting
2828
- TESTENV=freeze
29+
- TESTENV=docs
2930

3031
script: tox --recreate -e $TESTENV
3132

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Contributors include::
55

66
Abdeali JK
77
Abhijeet Kasurde
8+
Ahn Ki-Wook
89
Alexei Kozlenok
910
Anatoly Bubenkoff
1011
Andreas Zeidler
@@ -69,6 +70,7 @@ Javier Domingo Cansino
6970
Javier Romero
7071
John Towler
7172
Jon Sonesen
73+
Jordan Guymon
7274
Joshua Bronson
7375
Jurko Gospodnetić
7476
Justyna Janczyszyn

CHANGELOG.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@
33

44
*
55

6-
*
6+
* Improve error message when passing non-string ids to ``pytest.mark.parametrize`` (`#1857`_).
7+
Thanks `@okken`_ for the report and `@nicoddemus`_ for the PR.
78

8-
*
9+
* Add ``buffer`` attribute to stdin stub class ``pytest.capture.DontReadFromInput``
10+
Thanks `@joguSD`_ for the PR.
11+
12+
* Fix ``UnicodeEncodeError`` when string comparison with unicode has failed. (`#1864`_)
13+
Thanks `@AiOO`_ for the PR
914

1015
*
1116

17+
.. _@joguSD: https://github.com/joguSD
18+
.. _@AiOO: https://github.com/AiOO
19+
20+
.. _#1857: https://github.com/pytest-dev/pytest/issues/1857
21+
.. _#1864: https://github.com/pytest-dev/pytest/issues/1864
22+
1223

1324
3.0.2.dev
1425
=========

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ To execute it::
3535

3636
$ pytest
3737
======= test session starts ========
38-
platform linux -- Python 3.4.3, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
3938
collected 1 items
4039

4140
test_sample.py F
@@ -52,7 +51,7 @@ To execute it::
5251
======= 1 failed in 0.12 seconds ========
5352

5453

55-
Due to ``py.test``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.
54+
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.
5655

5756

5857
Features
@@ -64,7 +63,7 @@ Features
6463
<http://docs.pytest.org/en/latest/goodpractices.html#python-test-discovery>`_
6564
of test modules and functions;
6665

67-
- `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
66+
- `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
6867
managing small or parametrized long-lived test resources;
6968

7069
- Can run `unittest <http://docs.pytest.org/en/latest/unittest.html>`_ (or trial),

_pytest/_code/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def __init__(self, tup=None, exprinfo=None):
354354
if exprinfo is None and isinstance(tup[1], AssertionError):
355355
exprinfo = getattr(tup[1], 'msg', None)
356356
if exprinfo is None:
357-
exprinfo = str(tup[1])
357+
exprinfo = py._builtin._totext(tup[1])
358358
if exprinfo and exprinfo.startswith('assert '):
359359
self._striptext = 'AssertionError: '
360360
self._excinfo = tup

_pytest/capture.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,13 @@ def isatty(self):
455455
def close(self):
456456
pass
457457

458+
@property
459+
def buffer(self):
460+
if sys.version_info >= (3,0):
461+
return self
462+
else:
463+
raise AttributeError('redirected stdin has no attribute buffer')
464+
458465

459466
def _readline_workaround():
460467
"""

_pytest/debugging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def pytest_addoption(parser):
1414
group._addoption(
1515
'--pdbcls', dest="usepdb_cls", metavar="modulename:classname",
1616
help="start a custom interactive Python debugger on errors. "
17-
"For example: --pdbcls=IPython.core.debugger:Pdb")
17+
"For example: --pdbcls=IPython.terminal.debugger:TerminalPdb")
1818

1919
def pytest_namespace():
2020
return {'set_trace': pytestPDB().set_trace}

_pytest/python.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -711,31 +711,26 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
711711
They help to inspect a test function and to generate tests according to
712712
test configuration or values specified in the class or module where a
713713
test function is defined.
714-
715-
:ivar fixturenames: set of fixture names required by the test function
716-
717-
:ivar function: underlying python test function
718-
719-
:ivar cls: class object where the test function is defined in or ``None``.
720-
721-
:ivar module: the module object where the test function is defined in.
722-
723-
:ivar config: access to the :class:`_pytest.config.Config` object for the
724-
test session.
725-
726-
:ivar funcargnames:
727-
.. deprecated:: 2.3
728-
Use ``fixturenames`` instead.
729714
"""
730715
def __init__(self, function, fixtureinfo, config, cls=None, module=None):
716+
#: access to the :class:`_pytest.config.Config` object for the test session
731717
self.config = config
718+
719+
#: the module object where the test function is defined in.
732720
self.module = module
721+
722+
#: underlying python test function
733723
self.function = function
724+
725+
#: set of fixture names required by the test function
734726
self.fixturenames = fixtureinfo.names_closure
735-
self._arg2fixturedefs = fixtureinfo.name2fixturedefs
727+
728+
#: class object where the test function is defined in or ``None``.
736729
self.cls = cls
730+
737731
self._calls = []
738732
self._ids = py.builtin.set()
733+
self._arg2fixturedefs = fixtureinfo.name2fixturedefs
739734

740735
def parametrize(self, argnames, argvalues, indirect=False, ids=None,
741736
scope=None):
@@ -778,6 +773,7 @@ def parametrize(self, argnames, argvalues, indirect=False, ids=None,
778773
"""
779774
from _pytest.fixtures import scopes
780775
from _pytest.mark import extract_argvalue
776+
from py.io import saferepr
781777

782778
unwrapped_argvalues = []
783779
newkeywords = []
@@ -831,9 +827,14 @@ def parametrize(self, argnames, argvalues, indirect=False, ids=None,
831827
if callable(ids):
832828
idfn = ids
833829
ids = None
834-
if ids and len(ids) != len(argvalues):
835-
raise ValueError('%d tests specified with %d ids' %(
836-
len(argvalues), len(ids)))
830+
if ids:
831+
if len(ids) != len(argvalues):
832+
raise ValueError('%d tests specified with %d ids' %(
833+
len(argvalues), len(ids)))
834+
for id_value in ids:
835+
if id_value is not None and not isinstance(id_value, str):
836+
msg = 'ids must be list of strings, found: %s (type: %s)'
837+
raise ValueError(msg % (saferepr(id_value), type(id_value).__name__))
837838
ids = idmaker(argnames, argvalues, idfn, ids, self.config)
838839
newcalls = []
839840
for callspec in self._calls or [CallSpec2(self)]:

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ environment:
1010
# builds timing out in AppVeyor
1111
- TOXENV: "linting,py26,py27,py33,py34,py35,pypy"
1212
- TOXENV: "py27-pexpect,py27-xdist,py27-trial,py35-pexpect,py35-xdist,py35-trial"
13-
- TOXENV: "py27-nobyte,doctesting,freeze"
13+
- TOXENV: "py27-nobyte,doctesting,freeze,docs"
1414

1515
install:
1616
- echo Installed Pythons

doc/en/adopt.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:orphan:
2+
3+
.. warnings about this file not being included in any toctree will be suppressed by :orphan:
4+
15
26
April 2015 is "adopt pytest month"
37
=============================================

0 commit comments

Comments
 (0)