Skip to content

Commit 7d60fcc

Browse files
Merge pull request #1643 from RonnyPfannschmidt/merge-master
Merge master
2 parents a2420ce + 18ef7de commit 7d60fcc

21 files changed

+418
-135
lines changed

AUTHORS

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@ Contributors include::
55

66
Abdeali JK
77
Abhijeet Kasurde
8+
Alexei Kozlenok
89
Anatoly Bubenkoff
910
Andreas Zeidler
1011
Andy Freeland
1112
Anthon van der Neut
1213
Armin Rigo
1314
Aron Curzon
1415
Aviv Palivoda
16+
Ben Webb
1517
Benjamin Peterson
1618
Bob Ippolito
1719
Brian Dorsey
1820
Brian Okken
1921
Brianna Laugher
2022
Bruno Oliveira
23+
Cal Leeming
2124
Carl Friedrich Bolz
2225
Charles Cloud
26+
Charnjit SiNGH (CCSJ)
2327
Chris Lamb
2428
Christian Theunert
2529
Christian Tismer
@@ -28,20 +32,24 @@ Daniel Grana
2832
Daniel Hahler
2933
Daniel Nuri
3034
Dave Hunt
35+
David Díaz-Barquero
3136
David Mohr
3237
David Vierra
3338
Edison Gustavo Muenz
3439
Eduardo Schettino
35-
Endre Galaczi
3640
Elizaveta Shashkova
41+
Endre Galaczi
42+
Eric Hunsberger
3743
Eric Hunsberger
3844
Eric Siegerman
3945
Erik M. Bray
46+
Feng Ma
4047
Florian Bruhin
4148
Floris Bruynooghe
4249
Gabriel Reis
4350
Georgy Dyuldin
4451
Graham Horler
52+
Greg Price
4553
Grig Gheorghiu
4654
Guido Wesdorp
4755
Harald Armin Massa
@@ -65,6 +73,7 @@ Mark Abramowitz
6573
Markus Unterwaditzer
6674
Martijn Faassen
6775
Martin Prusse
76+
Martin K. Scherer
6877
Matt Bachmann
6978
Matt Williams
7079
Michael Aquilina
@@ -84,18 +93,16 @@ Raphael Pierzina
8493
Roman Bolshakov
8594
Ronny Pfannschmidt
8695
Ross Lawley
96+
Russel Winder
8797
Ryan Wooden
8898
Samuele Pedroni
8999
Stephan Obermann
90100
Tareq Alayan
101+
Simon Gomizelj
102+
Stefano Taschini
103+
Stefan Farmbauer
104+
Thomas Grainger
91105
Tom Viner
92106
Trevor Bekolay
93107
Wouter van Ackooy
94-
David Díaz-Barquero
95-
Eric Hunsberger
96-
Simon Gomizelj
97-
Russel Winder
98-
Ben Webb
99-
Alexei Kozlenok
100-
Cal Leeming
101-
Feng Ma
108+
Bernard Pratz

CHANGELOG.rst

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,48 @@
8282
was only available for test modules. Thanks `@flub`_, `@sober7`_ and
8383
`@nicoddemus`_ for the PR (`#1619`_).
8484

85-
*
85+
* Text documents without any doctests no longer appear as "skipped".
86+
Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_).
87+
88+
* Fix internal error issue when ``method`` argument is missing for
89+
``teardown_method()``. Fixes (`#1605`_).
90+
91+
* Fix exception visualization in case the current working directory (CWD) gets
92+
deleted during testing. Fixes (`#1235`). Thanks `@bukzor`_ for reporting. PR by
93+
`@marscher`. Thanks `@nicoddemus`_ for his help.
94+
95+
* Ensure that a module within a namespace package can be found when it
96+
is specified on the command line together with the ``--pyargs``
97+
option. Thanks to `@taschini`_ for the PR (`#1597`_).
98+
99+
* Raise helpful failure message, when requesting parametrized fixture at runtime,
100+
e.g. with ``request.getfuncargvalue``. BACKWARD INCOMPAT: Previously these params
101+
were simply never defined. So a fixture decorated like ``@pytest.fixture(params=[0, 1, 2])``
102+
only ran once. Now a failure is raised. Fixes (`#460`_). Thanks to
103+
`@nikratio`_ for bug report, `@RedBeardCode`_ and `@tomviner`_ for PR.
104+
105+
* Create correct diff for strings ending with newlines. Fixes (`#1553`_).
106+
Thanks `@Vogtinator`_ for reporting. Thanks to `@RedBeardCode`_ and
107+
`@tomviner`_ for PR.
86108

87109
*
88110

111+
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
112+
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
113+
.. _#1597: https://github.com/pytest-dev/pytest/pull/1597
114+
.. _#460: https://github.com/pytest-dev/pytest/pull/460
115+
.. _#1553: https://github.com/pytest-dev/pytest/issues/1553
116+
117+
.. _@graingert: https://github.com/graingert
118+
.. _@taschini: https://github.com/taschini
119+
.. _@nikratio: https://github.com/nikratio
120+
.. _@RedBeardCode: https://github.com/RedBeardCode
121+
.. _@Vogtinator: https://github.com/Vogtinator
122+
89123
* Fix `#1421`_: Exit tests if a collection error occurs and add
90124
``--continue-on-collection-errors`` option to restore previous behaviour.
91125
Thanks `@olegpidsadnyi`_ and `@omarkohl`_ for the complete PR (`#1628`_).
92126

93-
*
94127

95128
*
96129

@@ -294,7 +327,7 @@
294327
Thanks `@biern`_ for the PR.
295328

296329
* Fix `traceback style docs`_ to describe all of the available options
297-
(auto/long/short/line/native/no), with `auto` being the default since v2.6.
330+
(auto/long/short/line/native/no), with ``auto`` being the default since v2.6.
298331
Thanks `@hackebrot`_ for the PR.
299332

300333
* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records

CONTRIBUTING.rst

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ to fix the bug yet.
4848
Fix bugs
4949
--------
5050

51-
Look through the GitHub issues for bugs. Here is sample filter you can use:
51+
Look through the GitHub issues for bugs. Here is a filter you can use:
5252
https://github.com/pytest-dev/pytest/labels/bug
5353

5454
:ref:`Talk <contact>` to developers to find out how you can fix specific bugs.
@@ -60,8 +60,7 @@ Don't forget to check the issue trackers of your favourite plugins, too!
6060
Implement features
6161
------------------
6262

63-
Look through the GitHub issues for enhancements. Here is sample filter you
64-
can use:
63+
Look through the GitHub issues for enhancements. Here is a filter you can use:
6564
https://github.com/pytest-dev/pytest/labels/enhancement
6665

6766
:ref:`Talk <contact>` to developers to find out how you can implement specific
@@ -70,16 +69,15 @@ features.
7069
Write documentation
7170
-------------------
7271

73-
pytest could always use more documentation. What exactly is needed?
72+
Pytest could always use more documentation. What exactly is needed?
7473

7574
* More complementary documentation. Have you perhaps found something unclear?
7675
* Documentation translations. We currently have only English.
7776
* Docstrings. There can never be too many of them.
7877
* Blog posts, articles and such -- they're all very appreciated.
7978

80-
You can also edit documentation files directly in the Github web interface
81-
without needing to make a fork and local copy. This can be convenient for
82-
small fixes.
79+
You can also edit documentation files directly in the GitHub web interface,
80+
without using a local copy. This can be convenient for small fixes.
8381

8482

8583
.. _submitplugin:
@@ -95,13 +93,14 @@ in repositories living under the ``pytest-dev`` organisations:
9593
- `pytest-dev on Bitbucket <https://bitbucket.org/pytest-dev>`_
9694

9795
All pytest-dev Contributors team members have write access to all contained
98-
repositories. pytest core and plugins are generally developed
96+
repositories. Pytest core and plugins are generally developed
9997
using `pull requests`_ to respective repositories.
10098

10199
The objectives of the ``pytest-dev`` organisation are:
102100

103101
* Having a central location for popular pytest plugins
104-
* Sharing some of the maintenance responsibility (in case a maintainer no longer whishes to maintain a plugin)
102+
* Sharing some of the maintenance responsibility (in case a maintainer no
103+
longer wishes to maintain a plugin)
105104

106105
You can submit your plugin by subscribing to the `pytest-dev mail list
107106
<https://mail.python.org/mailman/listinfo/pytest-dev>`_ and writing a
@@ -127,27 +126,18 @@ transferred to the ``pytest-dev`` organisation.
127126
Here's a rundown of how a repository transfer usually proceeds
128127
(using a repository named ``joedoe/pytest-xyz`` as example):
129128

130-
* One of the ``pytest-dev`` administrators creates:
131-
132-
- ``pytest-xyz-admin`` team, with full administration rights to
133-
``pytest-dev/pytest-xyz``.
134-
- ``pytest-xyz-developers`` team, with write access to
135-
``pytest-dev/pytest-xyz``.
136-
137-
* ``joedoe`` is invited to the ``pytest-xyz-admin`` team;
138-
139-
* After accepting the invitation, ``joedoe`` transfers the repository from its
140-
original location to ``pytest-dev/pytest-xyz`` (A nice feature is that GitHub handles URL redirection from
141-
the old to the new location automatically).
142-
143-
* ``joedoe`` is free to add any other collaborators to the
144-
``pytest-xyz-admin`` or ``pytest-xyz-developers`` team as desired.
129+
* ``joedoe`` transfers repository ownership to ``pytest-dev`` administrator ``calvin``.
130+
* ``calvin`` creates ``pytest-xyz-admin`` and ``pytest-xyz-developers`` teams, inviting ``joedoe`` to both as **maintainer**.
131+
* ``calvin`` transfers repository to ``pytest-dev`` and configures team access:
132+
133+
- ``pytest-xyz-admin`` **admin** access;
134+
- ``pytest-xyz-developers`` **write** access;
145135

146136
The ``pytest-dev/Contributors`` team has write access to all projects, and
147137
every project administrator is in it. We recommend that each plugin has at least three
148138
people who have the right to release to PyPI.
149139

150-
Repository owners can be assured that no ``pytest-dev`` administrator will ever make
140+
Repository owners can rest assured that no ``pytest-dev`` administrator will ever make
151141
releases of your repository or take ownership in any way, except in rare cases
152142
where someone becomes unresponsive after months of contact attempts.
153143
As stated, the objective is to share maintenance and avoid "plugin-abandon".
@@ -159,15 +149,11 @@ As stated, the objective is to share maintenance and avoid "plugin-abandon".
159149
Preparing Pull Requests on GitHub
160150
---------------------------------
161151

162-
There's an excellent tutorial on how Pull Requests work in the
163-
`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_
164-
165-
166152
.. note::
167153
What is a "pull request"? It informs project's core developers about the
168154
changes you want to review and merge. Pull requests are stored on
169155
`GitHub servers <https://github.com/pytest-dev/pytest/pulls>`_.
170-
Once you send pull request, we can discuss it's potential modifications and
156+
Once you send a pull request, we can discuss its potential modifications and
171157
even add more commits to it later on.
172158

173159
There's an excellent tutorial on how Pull Requests work in the
@@ -216,19 +202,19 @@ but here is a simple overview:
216202
This command will run tests via the "tox" tool against Python 2.7 and 3.5
217203
and also perform "lint" coding-style checks. ``runtox.py`` is
218204
a thin wrapper around ``tox`` which installs from a development package
219-
index where newer (not yet released to pypi) versions of dependencies
205+
index where newer (not yet released to PyPI) versions of dependencies
220206
(especially ``py``) might be present.
221207

222208
#. You can now edit your local working copy.
223209

224210
You can now make the changes you want and run the tests again as necessary.
225211

226-
To run tests on py27 and pass options to pytest (e.g. enter pdb on failure)
227-
to pytest you can do::
212+
To run tests on Python 2.7 and pass options to pytest (e.g. enter pdb on
213+
failure) to pytest you can do::
228214

229215
$ python3 runtox.py -e py27 -- --pdb
230216

231-
or to only run tests in a particular test module on py35::
217+
Or to only run tests in a particular test module on Python 3.5::
232218

233219
$ python3 runtox.py -e py35 -- testing/test_config.py
234220

@@ -237,9 +223,9 @@ but here is a simple overview:
237223
$ git commit -a -m "<commit message>"
238224
$ git push -u
239225

240-
Make sure you add a CHANGELOG message, and add yourself to AUTHORS. If you
241-
are unsure about either of these steps, submit your pull request and we'll
242-
help you fix it up.
226+
Make sure you add a message to ``CHANGELOG.rst`` and add yourself to
227+
``AUTHORS``. If you are unsure about either of these steps, submit your
228+
pull request and we'll help you fix it up.
243229

244230
#. Finally, submit a pull request through the GitHub website using this data::
245231

@@ -248,6 +234,6 @@ but here is a simple overview:
248234

249235
base-fork: pytest-dev/pytest
250236
base: master # if it's a bugfix
251-
base: feature # if it's a feature
237+
base: features # if it's a feature
252238

253239

_pytest/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#
2-
32
__version__ = '2.10.0.dev1'

_pytest/_code/code.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import re
44

55
import py
6-
76
builtin_repr = repr
87

98
reprlib = py.builtin._tryimport('repr', 'reprlib')
@@ -36,12 +35,16 @@ def __ne__(self, other):
3635
def path(self):
3736
""" return a path object pointing to source code (note that it
3837
might not point to an actually existing file). """
39-
p = py.path.local(self.raw.co_filename)
40-
# maybe don't try this checking
41-
if not p.check():
38+
try:
39+
p = py.path.local(self.raw.co_filename)
40+
# maybe don't try this checking
41+
if not p.check():
42+
raise OSError("py.path check failed.")
43+
except OSError:
4244
# XXX maybe try harder like the weird logic
4345
# in the standard lib [linecache.updatecache] does?
4446
p = self.raw.co_filename
47+
4548
return p
4649

4750
@property

_pytest/assertion/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,10 @@ def _diff_text(left, right, verbose=False):
225225
'characters in diff, use -v to show') % i]
226226
left = left[:-i]
227227
right = right[:-i]
228+
keepends = True
228229
explanation += [line.strip('\n')
229-
for line in ndiff(left.splitlines(),
230-
right.splitlines())]
230+
for line in ndiff(left.splitlines(keepends),
231+
right.splitlines(keepends))]
231232
return explanation
232233

233234

_pytest/doctest.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,28 @@ def get_optionflags(parent):
146146
return flag_acc
147147

148148

149-
class DoctestTextfile(DoctestItem, pytest.Module):
149+
class DoctestTextfile(pytest.Module):
150+
obj = None
150151

151-
def runtest(self):
152+
def collect(self):
152153
import doctest
153-
fixture_request = _setup_fixtures(self)
154154

155155
# inspired by doctest.testfile; ideally we would use it directly,
156156
# but it doesn't support passing a custom checker
157157
text = self.fspath.read()
158158
filename = str(self.fspath)
159159
name = self.fspath.basename
160-
globs = dict(getfixture=fixture_request.getfuncargvalue)
161-
if '__name__' not in globs:
162-
globs['__name__'] = '__main__'
160+
globs = {'__name__': '__main__'}
163161

164-
for name, value in fixture_request.getfuncargvalue('doctest_namespace').items():
165-
globs[name] = value
166162

167163
optionflags = get_optionflags(self)
168164
runner = doctest.DebugRunner(verbose=0, optionflags=optionflags,
169165
checker=_get_checker())
170166

171167
parser = doctest.DocTestParser()
172168
test = parser.get_doctest(text, globs, name, filename, 0)
173-
_check_all_skipped(test)
174-
runner.run(test)
169+
if test.examples:
170+
yield DoctestItem(test.name, self, runner, test)
175171

176172

177173
def _check_all_skipped(test):

0 commit comments

Comments
 (0)