Skip to content

Commit b55a4f8

Browse files
authored
Merge pull request #2744 from nicoddemus/pluggy-master
Add test environment using pluggy from master branch
2 parents e1f2254 + d01f08e commit b55a4f8

10 files changed

+71
-65
lines changed

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ env:
1919
- TOXENV=py27-xdist
2020
- TOXENV=py27-trial
2121
- TOXENV=py27-numpy
22-
- TOXENV=py36-pexpect
23-
- TOXENV=py36-xdist
24-
- TOXENV=py36-trial
25-
- TOXENV=py36-numpy
22+
- TOXENV=py27-pluggymaster
23+
- TOXENV=py35-pexpect
24+
- TOXENV=py35-xdist
25+
- TOXENV=py35-trial
26+
- TOXENV=py35-numpy
27+
- TOXENV=py35-pluggymaster
2628
- TOXENV=py27-nobyte
2729
- TOXENV=doctesting
2830
- TOXENV=docs

_pytest/config.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,6 @@ def parse_hookspec_opts(self, module_or_class, name):
241241
"historic": hasattr(method, "historic")}
242242
return opts
243243

244-
def _verify_hook(self, hook, hookmethod):
245-
super(PytestPluginManager, self)._verify_hook(hook, hookmethod)
246-
if "__multicall__" in hookmethod.argnames:
247-
fslineno = _pytest._code.getfslineno(hookmethod.function)
248-
warning = dict(code="I1",
249-
fslocation=fslineno,
250-
nodeid=None,
251-
message="%r hook uses deprecated __multicall__ "
252-
"argument" % (hook.name))
253-
self._warn(warning)
254-
255244
def register(self, plugin, name=None):
256245
ret = super(PytestPluginManager, self).register(plugin, name)
257246
if ret:

appveyor.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ environment:
2121
- TOXENV: "py27-xdist"
2222
- TOXENV: "py27-trial"
2323
- TOXENV: "py27-numpy"
24-
- TOXENV: "py36-pexpect"
25-
- TOXENV: "py36-xdist"
26-
- TOXENV: "py36-trial"
27-
- TOXENV: "py36-numpy"
24+
- TOXENV: "py27-pluggymaster"
25+
- TOXENV: "py35-pexpect"
26+
- TOXENV: "py35-xdist"
27+
- TOXENV: "py35-trial"
28+
- TOXENV: "py35-numpy"
29+
- TOXENV: "py35-pluggymaster"
2830
- TOXENV: "py27-nobyte"
2931
- TOXENV: "doctesting"
3032
- TOXENV: "py35-freeze"

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ def has_environment_marker_support():
4343

4444

4545
def main():
46-
install_requires = ['py>=1.4.33', 'six>=1.10.0','setuptools', 'pluggy>=0.4.0,<0.5']
46+
install_requires = ['py>=1.4.33', 'six>=1.10.0', 'setuptools']
47+
# if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy;
48+
# used by tox.ini to test with pluggy master
49+
if '_PYTEST_SETUP_SKIP_PLUGGY_DEP' not in os.environ:
50+
install_requires.append('pluggy>=0.4.0,<0.5')
4751
extras_require = {}
4852
if has_environment_marker_support():
4953
extras_require[':python_version=="2.6"'] = ['argparse', 'ordereddict']

testing/python/collect.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,10 +809,12 @@ def pytest_pycollect_makemodule(path, parent):
809809
def test_customized_pymakemodule_issue205_subdir(self, testdir):
810810
b = testdir.mkdir("a").mkdir("b")
811811
b.join("conftest.py").write(_pytest._code.Source("""
812-
def pytest_pycollect_makemodule(__multicall__):
813-
mod = __multicall__.execute()
812+
import pytest
813+
@pytest.hookimpl(hookwrapper=True)
814+
def pytest_pycollect_makemodule():
815+
outcome = yield
816+
mod = outcome.get_result()
814817
mod.obj.hello = "world"
815-
return mod
816818
"""))
817819
b.join("test_module.py").write(_pytest._code.Source("""
818820
def test_hello():

testing/test_collection.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,12 @@ def test_collect_report_postprocessing(self, testdir):
276276
""")
277277
testdir.makeconftest("""
278278
import pytest
279-
def pytest_make_collect_report(__multicall__):
280-
rep = __multicall__.execute()
279+
@pytest.hookimpl(hookwrapper=True)
280+
def pytest_make_collect_report():
281+
outcome = yield
282+
rep = outcome.get_result()
281283
rep.headerlines += ["header1"]
282-
return rep
284+
outcome.force_result(rep)
283285
""")
284286
result = testdir.runpytest(p)
285287
result.stdout.fnmatch_lines([

testing/test_pluginmanager.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,6 @@ def test_hook_proxy(self, testdir):
155155
ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
156156
assert ihook_a is not ihook_b
157157

158-
def test_warn_on_deprecated_multicall(self, pytestpm):
159-
warnings = []
160-
161-
class get_warnings(object):
162-
def pytest_logwarning(self, message):
163-
warnings.append(message)
164-
165-
class Plugin(object):
166-
def pytest_configure(self, __multicall__):
167-
pass
168-
169-
pytestpm.register(get_warnings())
170-
before = list(warnings)
171-
pytestpm.register(Plugin())
172-
assert len(warnings) == len(before) + 1
173-
assert "deprecated" in warnings[-1]
174-
175158
def test_warn_on_deprecated_addhooks(self, pytestpm):
176159
warnings = []
177160

testing/test_runner.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,14 @@ def test_hello():
637637

638638
def test_unicode_in_longrepr(testdir):
639639
testdir.makeconftest("""
640-
import py
641-
def pytest_runtest_makereport(__multicall__):
642-
rep = __multicall__.execute()
640+
# -*- coding: utf-8 -*-
641+
import pytest
642+
@pytest.hookimpl(hookwrapper=True)
643+
def pytest_runtest_makereport():
644+
outcome = yield
645+
rep = outcome.get_result()
643646
if rep.when == "call":
644-
rep.longrepr = py.builtin._totext("\\xc3\\xa4", "utf8")
645-
return rep
647+
rep.longrepr = u'ä'
646648
""")
647649
testdir.makepyfile("""
648650
def test_out():

testing/test_unittest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,10 @@ def test_notTornDown():
770770

771771
def test_issue333_result_clearing(testdir):
772772
testdir.makeconftest("""
773-
def pytest_runtest_call(__multicall__, item):
774-
__multicall__.execute()
773+
import pytest
774+
@pytest.hookimpl(hookwrapper=True)
775+
def pytest_runtest_call(item):
776+
yield
775777
assert 0
776778
""")
777779
testdir.makepyfile("""

tox.ini

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
minversion = 2.0
33
distshare = {homedir}/.tox/distshare
4-
# make sure to update environment list on appveyor.yml
4+
# make sure to update environment list in travis.yml and appveyor.yml
55
envlist =
66
linting
77
py26
@@ -12,14 +12,14 @@ envlist =
1212
py36
1313
py37
1414
pypy
15-
{py27,py35}-{pexpect,xdist,trial,numpy}
15+
{py27,py35}-{pexpect,xdist,trial,numpy,pluggymaster}
1616
py27-nobyte
1717
doctesting
1818
py35-freeze
1919
docs
2020

2121
[testenv]
22-
commands = pytest --lsof -rfsxX {posargs:testing}
22+
commands = pytest --lsof -ra {posargs:testing}
2323
passenv = USER USERNAME
2424
deps =
2525
hypothesis>=3.5.2
@@ -28,7 +28,7 @@ deps =
2828
requests
2929

3030
[testenv:py26]
31-
commands = pytest --lsof -rfsxX {posargs:testing}
31+
commands = pytest --lsof -ra {posargs:testing}
3232
# pinning mock to last supported version for python 2.6
3333
deps =
3434
hypothesis<3.0
@@ -43,7 +43,7 @@ deps =
4343
mock
4444
nose
4545
commands =
46-
pytest -n3 -rfsxX --runpytest=subprocess {posargs:testing}
46+
pytest -n3 -ra --runpytest=subprocess {posargs:testing}
4747

4848

4949
[testenv:linting]
@@ -66,26 +66,26 @@ deps =
6666
nose
6767
hypothesis>=3.5.2
6868
commands =
69-
pytest -n1 -rfsxX {posargs:testing}
69+
pytest -n1 -ra {posargs:testing}
7070

7171
[testenv:py35-xdist]
7272
deps = {[testenv:py27-xdist]deps}
7373
commands =
74-
pytest -n3 -rfsxX {posargs:testing}
74+
pytest -n3 -ra {posargs:testing}
7575

7676
[testenv:py27-pexpect]
7777
changedir = testing
7878
platform = linux|darwin
7979
deps = pexpect
8080
commands =
81-
pytest -rfsxX test_pdb.py test_terminal.py test_unittest.py
81+
pytest -ra test_pdb.py test_terminal.py test_unittest.py
8282

8383
[testenv:py35-pexpect]
8484
changedir = testing
8585
platform = linux|darwin
8686
deps = {[testenv:py27-pexpect]deps}
8787
commands =
88-
pytest -rfsxX test_pdb.py test_terminal.py test_unittest.py
88+
pytest -ra test_pdb.py test_terminal.py test_unittest.py
8989

9090
[testenv:py27-nobyte]
9191
deps =
@@ -95,7 +95,7 @@ distribute = true
9595
setenv =
9696
PYTHONDONTWRITEBYTECODE=1
9797
commands =
98-
pytest -n3 -rfsxX {posargs:testing}
98+
pytest -n3 -ra {posargs:testing}
9999

100100
[testenv:py27-trial]
101101
deps = twisted
@@ -110,12 +110,30 @@ commands =
110110
[testenv:py27-numpy]
111111
deps=numpy
112112
commands=
113-
pytest -rfsxX {posargs:testing/python/approx.py}
113+
pytest -ra {posargs:testing/python/approx.py}
114114

115115
[testenv:py35-numpy]
116116
deps=numpy
117117
commands=
118-
pytest -rfsxX {posargs:testing/python/approx.py}
118+
pytest -ra {posargs:testing/python/approx.py}
119+
120+
[testenv:py27-pluggymaster]
121+
passenv={[testenv]passenv}
122+
commands={[testenv]commands}
123+
setenv=
124+
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
125+
deps =
126+
{[testenv]deps}
127+
git+https://github.com/pytest-dev/pluggy.git@master
128+
129+
[testenv:py35-pluggymaster]
130+
passenv={[testenv:py27-pluggymaster]passenv}
131+
commands={[testenv:py27-pluggymaster]commands}
132+
setenv=
133+
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
134+
deps =
135+
{[testenv:py27-pluggymaster]deps}
136+
git+https://github.com/pytest-dev/pluggy.git@master
119137

120138
[testenv:docs]
121139
skipsdist = True
@@ -138,7 +156,7 @@ changedir = doc/
138156
deps =
139157
PyYAML
140158
commands =
141-
pytest -rfsxX en
159+
pytest -ra en
142160
pytest --doctest-modules --pyargs _pytest
143161

144162
[testenv:regen]
@@ -167,7 +185,7 @@ commands =
167185
[testenv:jython]
168186
changedir = testing
169187
commands =
170-
{envpython} {envbindir}/py.test-jython -rfsxX {posargs}
188+
{envpython} {envbindir}/py.test-jython -ra {posargs}
171189

172190
[testenv:py35-freeze]
173191
changedir = testing/freeze
@@ -194,7 +212,7 @@ commands =
194212
minversion = 2.0
195213
plugins = pytester
196214
#--pyargs --doctest-modules --ignore=.tox
197-
addopts = -rxsX -p pytester --ignore=testing/cx_freeze
215+
addopts = -ra -p pytester --ignore=testing/cx_freeze
198216
rsyncdirs = tox.ini pytest.py _pytest testing
199217
python_files = test_*.py *_test.py testing/*/*.py
200218
python_classes = Test Acceptance

0 commit comments

Comments
 (0)