Skip to content

Commit 3b47cb4

Browse files
Merge pull request #2222 from RonnyPfannschmidt/features
merge master into features
2 parents 34e98bc + 3f30c22 commit 3b47cb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+366
-260
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ env:
2929
- TESTENV=docs
3030

3131
matrix:
32-
allow_failures:
33-
# see #1989
34-
- env: TESTENV=py27-trial
35-
- env: TESTENV=py35-trial
3632
include:
3733
- env: TESTENV=py36
3834
python: '3.6-dev'
35+
- env: TESTENV=py37
36+
python: 'nightly'
3937

4038
script: tox --recreate -e $TESTENV
4139

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Duncan Betts
4848
Edison Gustavo Muenz
4949
Edoardo Batini
5050
Eduardo Schettino
51+
Eli Boyarski
5152
Elizaveta Shashkova
5253
Endre Galaczi
5354
Eric Hunsberger
@@ -71,6 +72,7 @@ Janne Vanhala
7172
Jason R. Coombs
7273
Javier Domingo Cansino
7374
Javier Romero
75+
Jeff Widman
7476
John Towler
7577
Jon Sonesen
7678
Jordan Guymon
@@ -142,6 +144,7 @@ Tom Viner
142144
Trevor Bekolay
143145
Tyler Goodlet
144146
Vasily Kuznetsov
147+
Victor Uriarte
145148
Vlad Dragos
146149
Wouter van Ackooy
147150
Xuecong Liao

CHANGELOG.rst

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Changes
5454
.. _@mattduck: https://github.com/mattduck
5555
.. _@wheerd: https://github.com/wheerd
5656
.. _@fogo: https://github.com/fogo
57-
.. _@lesteve: https://github.com/lesteve
5857
.. _@mandeep: https://github.com/mandeep
5958
.. _@unsignedint: https://github.com/unsignedint
6059

@@ -68,30 +67,63 @@ Changes
6867
.. _#2147: https://github.com/pytest-dev/pytest/issues/2147
6968
.. _#2208: https://github.com/pytest-dev/pytest/issues/2208
7069

71-
3.0.6.dev0 (unreleased)
70+
3.0.7 (unreleased)
7271
=======================
7372

7473
*
7574

75+
*
76+
77+
*
78+
79+
*
80+
81+
82+
3.0.6 (2017-01-22)
83+
==================
84+
85+
* pytest no longer generates ``PendingDeprecationWarning`` from its own operations, which was introduced by mistake in version ``3.0.5`` (`#2118`_).
86+
Thanks to `@nicoddemus`_ for the report and `@RonnyPfannschmidt`_ for the PR.
87+
88+
7689
* pytest no longer recognizes coroutine functions as yield tests (`#2129`_).
7790
Thanks to `@malinoff`_ for the PR.
7891

92+
* Plugins loaded by the ``PYTEST_PLUGINS`` environment variable are now automatically
93+
considered for assertion rewriting (`#2185`_).
94+
Thanks `@nicoddemus`_ for the PR.
95+
7996
* Improve error message when pytest.warns fails (`#2150`_). The type(s) of the
8097
expected warnings and the list of caught warnings is added to the
8198
error message. Thanks `@lesteve`_ for the PR.
8299

100+
* Fix ``pytester`` internal plugin to work correctly with latest versions of
101+
``zope.interface`` (`#1989`_). Thanks `@nicoddemus`_ for the PR.
102+
103+
* Assert statements of the ``pytester`` plugin again benefit from assertion rewriting (`#1920`_).
104+
Thanks `@RonnyPfannschmidt`_ for the report and `@nicoddemus`_ for the PR.
105+
83106
* Specifying tests with colons like ``test_foo.py::test_bar`` for tests in
84107
subdirectories with ini configuration files now uses the correct ini file
85108
(`#2148`_). Thanks `@pelme`_.
86109

87-
*
110+
* Fail ``testdir.runpytest().assert_outcomes()`` explicitly if the pytest
111+
terminal output it relies on is missing. Thanks to `@eli-b`_ for the PR.
112+
88113

114+
.. _@lesteve: https://github.com/lesteve
89115
.. _@malinoff: https://github.com/malinoff
90116
.. _@pelme: https://github.com/pelme
117+
.. _@eli-b: https://github.com/eli-b
118+
119+
.. _#2118: https://github.com/pytest-dev/pytest/issues/2118
91120

121+
.. _#1989: https://github.com/pytest-dev/pytest/issues/1989
122+
.. _#1920: https://github.com/pytest-dev/pytest/issues/1920
92123
.. _#2129: https://github.com/pytest-dev/pytest/issues/2129
93124
.. _#2148: https://github.com/pytest-dev/pytest/issues/2148
94125
.. _#2150: https://github.com/pytest-dev/pytest/issues/2150
126+
.. _#2185: https://github.com/pytest-dev/pytest/issues/2185
95127

96128

97129
3.0.5 (2016-12-05)
@@ -761,7 +793,7 @@ time or change existing behaviors in order to make them less surprising/more use
761793
Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_
762794
for PR the (`#1524`_).
763795

764-
* Fix win32 path issue when puttinging custom config file with absolute path
796+
* Fix win32 path issue when putting custom config file with absolute path
765797
in ``pytest.main("-c your_absolute_path")``.
766798

767799
* Fix maximum recursion depth detection when raised error class is not aware
@@ -1093,7 +1125,7 @@ time or change existing behaviors in order to make them less surprising/more use
10931125

10941126
- (experimental) adapt more SEMVER style versioning and change meaning of
10951127
master branch in git repo: "master" branch now keeps the bugfixes, changes
1096-
aimed for micro releases. "features" branch will only be be released
1128+
aimed for micro releases. "features" branch will only be released
10971129
with minor or major pytest releases.
10981130

10991131
- Fix issue #766 by removing documentation references to distutils.
@@ -1227,7 +1259,7 @@ time or change existing behaviors in order to make them less surprising/more use
12271259

12281260
- new option ``--import-mode`` to allow to change test module importing
12291261
behaviour to append to sys.path instead of prepending. This better allows
1230-
to run test modules against installated versions of a package even if the
1262+
to run test modules against installed versions of a package even if the
12311263
package under test has the same import root. In this example::
12321264

12331265
testing/__init__.py
@@ -1385,7 +1417,7 @@ time or change existing behaviors in order to make them less surprising/more use
13851417
explanations. Thanks Carl Meyer for the report and test case.
13861418

13871419
- fix issue553: properly handling inspect.getsourcelines failures in
1388-
FixtureLookupError which would lead to to an internal error,
1420+
FixtureLookupError which would lead to an internal error,
13891421
obfuscating the original problem. Thanks talljosh for initial
13901422
diagnose/patch and Bruno Oliveira for final patch.
13911423

@@ -1528,7 +1560,7 @@ time or change existing behaviors in order to make them less surprising/more use
15281560

15291561
- fix conftest related fixture visibility issue: when running with a
15301562
CWD outside of a test package pytest would get fixture discovery wrong.
1531-
Thanks to Wolfgang Schnerring for figuring out a reproducable example.
1563+
Thanks to Wolfgang Schnerring for figuring out a reproducible example.
15321564

15331565
- Introduce pytest_enter_pdb hook (needed e.g. by pytest_timeout to cancel the
15341566
timeout when interactively entering pdb). Thanks Wolfgang Schnerring.
@@ -1727,7 +1759,7 @@ time or change existing behaviors in order to make them less surprising/more use
17271759
- fix issue429: comparing byte strings with non-ascii chars in assert
17281760
expressions now work better. Thanks Floris Bruynooghe.
17291761

1730-
- make capfd/capsys.capture private, its unused and shouldnt be exposed
1762+
- make capfd/capsys.capture private, its unused and shouldn't be exposed
17311763

17321764

17331765
2.5.1 (2013-12-17)
@@ -1784,7 +1816,7 @@ time or change existing behaviors in order to make them less surprising/more use
17841816
to problems for more than >966 non-function scoped parameters).
17851817

17861818
- fix issue290 - there is preliminary support now for parametrizing
1787-
with repeated same values (sometimes useful to to test if calling
1819+
with repeated same values (sometimes useful to test if calling
17881820
a second time works as with the first time).
17891821

17901822
- close issue240 - document precisely how pytest module importing
@@ -1998,7 +2030,7 @@ new features:
19982030

19992031
- fix issue322: tearDownClass is not run if setUpClass failed. Thanks
20002032
Mathieu Agopian for the initial fix. Also make all of pytest/nose
2001-
finalizer mimick the same generic behaviour: if a setupX exists and
2033+
finalizer mimic the same generic behaviour: if a setupX exists and
20022034
fails, don't run teardownX. This internally introduces a new method
20032035
"node.addfinalizer()" helper which can only be called during the setup
20042036
phase of a node.
@@ -2117,11 +2149,11 @@ Bug fixes:
21172149
(thanks Adam Goucher)
21182150

21192151
- Issue 265 - integrate nose setup/teardown with setupstate
2120-
so it doesnt try to teardown if it did not setup
2152+
so it doesn't try to teardown if it did not setup
21212153

2122-
- issue 271 - dont write junitxml on slave nodes
2154+
- issue 271 - don't write junitxml on slave nodes
21232155

2124-
- Issue 274 - dont try to show full doctest example
2156+
- Issue 274 - don't try to show full doctest example
21252157
when doctest does not know the example location
21262158

21272159
- issue 280 - disable assertion rewriting on buggy CPython 2.6.0
@@ -2157,7 +2189,7 @@ Bug fixes:
21572189
- allow to specify prefixes starting with "_" when
21582190
customizing python_functions test discovery. (thanks Graham Horler)
21592191

2160-
- improve PYTEST_DEBUG tracing output by puting
2192+
- improve PYTEST_DEBUG tracing output by putting
21612193
extra data on a new lines with additional indent
21622194

21632195
- ensure OutcomeExceptions like skip/fail have initialized exception attributes
@@ -2206,7 +2238,7 @@ Bug fixes:
22062238
- fix issue209 - reintroduce python2.4 support by depending on newer
22072239
pylib which re-introduced statement-finding for pre-AST interpreters
22082240

2209-
- nose support: only call setup if its a callable, thanks Andrew
2241+
- nose support: only call setup if it's a callable, thanks Andrew
22102242
Taumoefolau
22112243

22122244
- fix issue219 - add py2.4-3.3 classifiers to TROVE list
@@ -2302,7 +2334,7 @@ Bug fixes:
23022334

23032335
- fix issue128: show captured output when capsys/capfd are used
23042336

2305-
- fix issue179: propperly show the dependency chain of factories
2337+
- fix issue179: properly show the dependency chain of factories
23062338

23072339
- pluginmanager.register(...) now raises ValueError if the
23082340
plugin has been already registered or the name is taken
@@ -2343,7 +2375,7 @@ Bug fixes:
23432375

23442376
- don't show deselected reason line if there is none
23452377

2346-
- py.test -vv will show all of assert comparisations instead of truncating
2378+
- py.test -vv will show all of assert comparisons instead of truncating
23472379

23482380
2.2.4 (2012-05-22)
23492381
==================
@@ -2354,7 +2386,7 @@ Bug fixes:
23542386
- fix issue with unittest: now @unittest.expectedFailure markers should
23552387
be processed correctly (you can also use @pytest.mark markers)
23562388
- document integration with the extended distribute/setuptools test commands
2357-
- fix issue 140: propperly get the real functions
2389+
- fix issue 140: properly get the real functions
23582390
of bound classmethods for setup/teardown_class
23592391
- fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net
23602392
- fix issue #143: call unconfigure/sessionfinish always when
@@ -2365,7 +2397,7 @@ Bug fixes:
23652397
2.2.3 (2012-02-05)
23662398
==================
23672399

2368-
- fix uploaded package to only include neccesary files
2400+
- fix uploaded package to only include necessary files
23692401

23702402
2.2.2 (2012-02-05)
23712403
==================
@@ -2506,7 +2538,7 @@ Bug fixes:
25062538
- don't require zlib (and other libs) for genscript plugin without
25072539
--genscript actually being used.
25082540

2509-
- speed up skips (by not doing a full traceback represenation
2541+
- speed up skips (by not doing a full traceback representation
25102542
internally)
25112543

25122544
- fix issue37: avoid invalid characters in junitxml's output
@@ -2554,9 +2586,9 @@ Bug fixes:
25542586
this.
25552587

25562588
- fixed typos in the docs (thanks Victor Garcia, Brianna Laugher) and particular
2557-
thanks to Laura Creighton who also revieved parts of the documentation.
2589+
thanks to Laura Creighton who also reviewed parts of the documentation.
25582590

2559-
- fix slighly wrong output of verbose progress reporting for classes
2591+
- fix slightly wrong output of verbose progress reporting for classes
25602592
(thanks Amaury)
25612593

25622594
- more precise (avoiding of) deprecation warnings for node.Class|Function accesses
@@ -2617,7 +2649,7 @@ Bug fixes:
26172649

26182650
- pytest-2.0 is now its own package and depends on pylib-2.0
26192651
- new ability: python -m pytest / python -m pytest.main ability
2620-
- new python invcation: pytest.main(args, plugins) to load
2652+
- new python invocation: pytest.main(args, plugins) to load
26212653
some custom plugins early.
26222654
- try harder to run unittest test suites in a more compatible manner
26232655
by deferring setup/teardown semantics to the unittest package.
@@ -2856,7 +2888,7 @@ Bug fixes:
28562888
- extend and refine xfail mechanism:
28572889
``@py.test.mark.xfail(run=False)`` do not run the decorated test
28582890
``@py.test.mark.xfail(reason="...")`` prints the reason string in xfail summaries
2859-
specifiying ``--runxfail`` on command line virtually ignores xfail markers
2891+
specifying ``--runxfail`` on command line virtually ignores xfail markers
28602892

28612893
- expose (previously internal) commonly useful methods:
28622894
py.io.get_terminal_with() -> return terminal width
@@ -3081,7 +3113,7 @@ Bug fixes:
30813113

30823114
* add the ability to specify a path for py.lookup to search in
30833115

3084-
* fix a funcarg cached_setup bug probably only occuring
3116+
* fix a funcarg cached_setup bug probably only occurring
30853117
in distributed testing and "module" scope with teardown.
30863118

30873119
* many fixes and changes for making the code base python3 compatible,
@@ -3347,10 +3379,10 @@ serve as a reference for developers.
33473379
* fixed issue with 2.5 type representations in py.test [45483, 45484]
33483380
* made that internal reporting issues displaying is done atomically in py.test
33493381
[45518]
3350-
* made that non-existing files are igored by the py.lookup script [45519]
3382+
* made that non-existing files are ignored by the py.lookup script [45519]
33513383
* improved exception name creation in py.test [45535]
33523384
* made that less threads are used in execnet [merge in 45539]
3353-
* removed lock required for atomical reporting issue displaying in py.test
3385+
* removed lock required for atomic reporting issue displaying in py.test
33543386
[45545]
33553387
* removed globals from execnet [45541, 45547]
33563388
* refactored cleanup mechanics, made that setDaemon is set to 1 to make atexit

_pytest/config.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,31 +402,26 @@ def consider_env(self):
402402
self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS"))
403403

404404
def consider_module(self, mod):
405-
plugins = getattr(mod, 'pytest_plugins', [])
406-
if isinstance(plugins, str):
407-
plugins = [plugins]
408-
self.rewrite_hook.mark_rewrite(*plugins)
409-
self._import_plugin_specs(plugins)
405+
self._import_plugin_specs(getattr(mod, 'pytest_plugins', []))
410406

411407
def _import_plugin_specs(self, spec):
412-
if spec:
413-
if isinstance(spec, str):
414-
spec = spec.split(",")
415-
for import_spec in spec:
416-
self.import_plugin(import_spec)
408+
plugins = _get_plugin_specs_as_list(spec)
409+
for import_spec in plugins:
410+
self.import_plugin(import_spec)
417411

418412
def import_plugin(self, modname):
419413
# most often modname refers to builtin modules, e.g. "pytester",
420414
# "terminal" or "capture". Those plugins are registered under their
421415
# basename for historic purposes but must be imported with the
422416
# _pytest prefix.
423-
assert isinstance(modname, str)
417+
assert isinstance(modname, str), "module name as string required, got %r" % modname
424418
if self.get_plugin(modname) is not None:
425419
return
426420
if modname in builtin_plugins:
427421
importspec = "_pytest." + modname
428422
else:
429423
importspec = modname
424+
self.rewrite_hook.mark_rewrite(importspec)
430425
try:
431426
__import__(importspec)
432427
except ImportError as e:
@@ -447,6 +442,24 @@ def import_plugin(self, modname):
447442
self.consider_module(mod)
448443

449444

445+
def _get_plugin_specs_as_list(specs):
446+
"""
447+
Parses a list of "plugin specs" and returns a list of plugin names.
448+
449+
Plugin specs can be given as a list of strings separated by "," or already as a list/tuple in
450+
which case it is returned as a list. Specs can also be `None` in which case an
451+
empty list is returned.
452+
"""
453+
if specs is not None:
454+
if isinstance(specs, str):
455+
specs = specs.split(',') if specs else []
456+
if not isinstance(specs, (list, tuple)):
457+
raise UsageError("Plugin specs must be a ','-separated string or a "
458+
"list/tuple of strings for plugin names. Given: %r" % specs)
459+
return list(specs)
460+
return []
461+
462+
450463
class Parser(object):
451464
""" Parser for command line arguments and ini-file values.
452465

0 commit comments

Comments
 (0)