Merge pull request #2744 from nicoddemus/pluggy-master
Add test environment using pluggy from master branch
This commit is contained in:
commit
b55a4f805f
10
.travis.yml
10
.travis.yml
|
@ -19,10 +19,12 @@ env:
|
||||||
- TOXENV=py27-xdist
|
- TOXENV=py27-xdist
|
||||||
- TOXENV=py27-trial
|
- TOXENV=py27-trial
|
||||||
- TOXENV=py27-numpy
|
- TOXENV=py27-numpy
|
||||||
- TOXENV=py36-pexpect
|
- TOXENV=py27-pluggymaster
|
||||||
- TOXENV=py36-xdist
|
- TOXENV=py35-pexpect
|
||||||
- TOXENV=py36-trial
|
- TOXENV=py35-xdist
|
||||||
- TOXENV=py36-numpy
|
- TOXENV=py35-trial
|
||||||
|
- TOXENV=py35-numpy
|
||||||
|
- TOXENV=py35-pluggymaster
|
||||||
- TOXENV=py27-nobyte
|
- TOXENV=py27-nobyte
|
||||||
- TOXENV=doctesting
|
- TOXENV=doctesting
|
||||||
- TOXENV=docs
|
- TOXENV=docs
|
||||||
|
|
|
@ -241,17 +241,6 @@ class PytestPluginManager(PluginManager):
|
||||||
"historic": hasattr(method, "historic")}
|
"historic": hasattr(method, "historic")}
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def _verify_hook(self, hook, hookmethod):
|
|
||||||
super(PytestPluginManager, self)._verify_hook(hook, hookmethod)
|
|
||||||
if "__multicall__" in hookmethod.argnames:
|
|
||||||
fslineno = _pytest._code.getfslineno(hookmethod.function)
|
|
||||||
warning = dict(code="I1",
|
|
||||||
fslocation=fslineno,
|
|
||||||
nodeid=None,
|
|
||||||
message="%r hook uses deprecated __multicall__ "
|
|
||||||
"argument" % (hook.name))
|
|
||||||
self._warn(warning)
|
|
||||||
|
|
||||||
def register(self, plugin, name=None):
|
def register(self, plugin, name=None):
|
||||||
ret = super(PytestPluginManager, self).register(plugin, name)
|
ret = super(PytestPluginManager, self).register(plugin, name)
|
||||||
if ret:
|
if ret:
|
||||||
|
|
10
appveyor.yml
10
appveyor.yml
|
@ -21,10 +21,12 @@ environment:
|
||||||
- TOXENV: "py27-xdist"
|
- TOXENV: "py27-xdist"
|
||||||
- TOXENV: "py27-trial"
|
- TOXENV: "py27-trial"
|
||||||
- TOXENV: "py27-numpy"
|
- TOXENV: "py27-numpy"
|
||||||
- TOXENV: "py36-pexpect"
|
- TOXENV: "py27-pluggymaster"
|
||||||
- TOXENV: "py36-xdist"
|
- TOXENV: "py35-pexpect"
|
||||||
- TOXENV: "py36-trial"
|
- TOXENV: "py35-xdist"
|
||||||
- TOXENV: "py36-numpy"
|
- TOXENV: "py35-trial"
|
||||||
|
- TOXENV: "py35-numpy"
|
||||||
|
- TOXENV: "py35-pluggymaster"
|
||||||
- TOXENV: "py27-nobyte"
|
- TOXENV: "py27-nobyte"
|
||||||
- TOXENV: "doctesting"
|
- TOXENV: "doctesting"
|
||||||
- TOXENV: "py35-freeze"
|
- TOXENV: "py35-freeze"
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -43,7 +43,11 @@ def has_environment_marker_support():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
install_requires = ['py>=1.4.33', 'six>=1.10.0','setuptools', 'pluggy>=0.4.0,<0.5']
|
install_requires = ['py>=1.4.33', 'six>=1.10.0', 'setuptools']
|
||||||
|
# if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy;
|
||||||
|
# used by tox.ini to test with pluggy master
|
||||||
|
if '_PYTEST_SETUP_SKIP_PLUGGY_DEP' not in os.environ:
|
||||||
|
install_requires.append('pluggy>=0.4.0,<0.5')
|
||||||
extras_require = {}
|
extras_require = {}
|
||||||
if has_environment_marker_support():
|
if has_environment_marker_support():
|
||||||
extras_require[':python_version=="2.6"'] = ['argparse', 'ordereddict']
|
extras_require[':python_version=="2.6"'] = ['argparse', 'ordereddict']
|
||||||
|
|
|
@ -809,10 +809,12 @@ class TestConftestCustomization(object):
|
||||||
def test_customized_pymakemodule_issue205_subdir(self, testdir):
|
def test_customized_pymakemodule_issue205_subdir(self, testdir):
|
||||||
b = testdir.mkdir("a").mkdir("b")
|
b = testdir.mkdir("a").mkdir("b")
|
||||||
b.join("conftest.py").write(_pytest._code.Source("""
|
b.join("conftest.py").write(_pytest._code.Source("""
|
||||||
def pytest_pycollect_makemodule(__multicall__):
|
import pytest
|
||||||
mod = __multicall__.execute()
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_pycollect_makemodule():
|
||||||
|
outcome = yield
|
||||||
|
mod = outcome.get_result()
|
||||||
mod.obj.hello = "world"
|
mod.obj.hello = "world"
|
||||||
return mod
|
|
||||||
"""))
|
"""))
|
||||||
b.join("test_module.py").write(_pytest._code.Source("""
|
b.join("test_module.py").write(_pytest._code.Source("""
|
||||||
def test_hello():
|
def test_hello():
|
||||||
|
|
|
@ -276,10 +276,12 @@ class TestPrunetraceback(object):
|
||||||
""")
|
""")
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
import pytest
|
import pytest
|
||||||
def pytest_make_collect_report(__multicall__):
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
rep = __multicall__.execute()
|
def pytest_make_collect_report():
|
||||||
|
outcome = yield
|
||||||
|
rep = outcome.get_result()
|
||||||
rep.headerlines += ["header1"]
|
rep.headerlines += ["header1"]
|
||||||
return rep
|
outcome.force_result(rep)
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest(p)
|
result = testdir.runpytest(p)
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
|
|
|
@ -155,23 +155,6 @@ class TestPytestPluginInteractions(object):
|
||||||
ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
|
ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
|
||||||
assert ihook_a is not ihook_b
|
assert ihook_a is not ihook_b
|
||||||
|
|
||||||
def test_warn_on_deprecated_multicall(self, pytestpm):
|
|
||||||
warnings = []
|
|
||||||
|
|
||||||
class get_warnings(object):
|
|
||||||
def pytest_logwarning(self, message):
|
|
||||||
warnings.append(message)
|
|
||||||
|
|
||||||
class Plugin(object):
|
|
||||||
def pytest_configure(self, __multicall__):
|
|
||||||
pass
|
|
||||||
|
|
||||||
pytestpm.register(get_warnings())
|
|
||||||
before = list(warnings)
|
|
||||||
pytestpm.register(Plugin())
|
|
||||||
assert len(warnings) == len(before) + 1
|
|
||||||
assert "deprecated" in warnings[-1]
|
|
||||||
|
|
||||||
def test_warn_on_deprecated_addhooks(self, pytestpm):
|
def test_warn_on_deprecated_addhooks(self, pytestpm):
|
||||||
warnings = []
|
warnings = []
|
||||||
|
|
||||||
|
|
|
@ -637,12 +637,14 @@ def test_pytest_cmdline_main(testdir):
|
||||||
|
|
||||||
def test_unicode_in_longrepr(testdir):
|
def test_unicode_in_longrepr(testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
import py
|
# -*- coding: utf-8 -*-
|
||||||
def pytest_runtest_makereport(__multicall__):
|
import pytest
|
||||||
rep = __multicall__.execute()
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_runtest_makereport():
|
||||||
|
outcome = yield
|
||||||
|
rep = outcome.get_result()
|
||||||
if rep.when == "call":
|
if rep.when == "call":
|
||||||
rep.longrepr = py.builtin._totext("\\xc3\\xa4", "utf8")
|
rep.longrepr = u'ä'
|
||||||
return rep
|
|
||||||
""")
|
""")
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
def test_out():
|
def test_out():
|
||||||
|
|
|
@ -770,8 +770,10 @@ def test_no_teardown_if_setupclass_failed(testdir):
|
||||||
|
|
||||||
def test_issue333_result_clearing(testdir):
|
def test_issue333_result_clearing(testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_runtest_call(__multicall__, item):
|
import pytest
|
||||||
__multicall__.execute()
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_runtest_call(item):
|
||||||
|
yield
|
||||||
assert 0
|
assert 0
|
||||||
""")
|
""")
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
|
48
tox.ini
48
tox.ini
|
@ -1,7 +1,7 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion = 2.0
|
minversion = 2.0
|
||||||
distshare = {homedir}/.tox/distshare
|
distshare = {homedir}/.tox/distshare
|
||||||
# make sure to update environment list on appveyor.yml
|
# make sure to update environment list in travis.yml and appveyor.yml
|
||||||
envlist =
|
envlist =
|
||||||
linting
|
linting
|
||||||
py26
|
py26
|
||||||
|
@ -12,14 +12,14 @@ envlist =
|
||||||
py36
|
py36
|
||||||
py37
|
py37
|
||||||
pypy
|
pypy
|
||||||
{py27,py35}-{pexpect,xdist,trial,numpy}
|
{py27,py35}-{pexpect,xdist,trial,numpy,pluggymaster}
|
||||||
py27-nobyte
|
py27-nobyte
|
||||||
doctesting
|
doctesting
|
||||||
py35-freeze
|
py35-freeze
|
||||||
docs
|
docs
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands = pytest --lsof -rfsxX {posargs:testing}
|
commands = pytest --lsof -ra {posargs:testing}
|
||||||
passenv = USER USERNAME
|
passenv = USER USERNAME
|
||||||
deps =
|
deps =
|
||||||
hypothesis>=3.5.2
|
hypothesis>=3.5.2
|
||||||
|
@ -28,7 +28,7 @@ deps =
|
||||||
requests
|
requests
|
||||||
|
|
||||||
[testenv:py26]
|
[testenv:py26]
|
||||||
commands = pytest --lsof -rfsxX {posargs:testing}
|
commands = pytest --lsof -ra {posargs:testing}
|
||||||
# pinning mock to last supported version for python 2.6
|
# pinning mock to last supported version for python 2.6
|
||||||
deps =
|
deps =
|
||||||
hypothesis<3.0
|
hypothesis<3.0
|
||||||
|
@ -43,7 +43,7 @@ deps =
|
||||||
mock
|
mock
|
||||||
nose
|
nose
|
||||||
commands =
|
commands =
|
||||||
pytest -n3 -rfsxX --runpytest=subprocess {posargs:testing}
|
pytest -n3 -ra --runpytest=subprocess {posargs:testing}
|
||||||
|
|
||||||
|
|
||||||
[testenv:linting]
|
[testenv:linting]
|
||||||
|
@ -66,26 +66,26 @@ deps =
|
||||||
nose
|
nose
|
||||||
hypothesis>=3.5.2
|
hypothesis>=3.5.2
|
||||||
commands =
|
commands =
|
||||||
pytest -n1 -rfsxX {posargs:testing}
|
pytest -n1 -ra {posargs:testing}
|
||||||
|
|
||||||
[testenv:py35-xdist]
|
[testenv:py35-xdist]
|
||||||
deps = {[testenv:py27-xdist]deps}
|
deps = {[testenv:py27-xdist]deps}
|
||||||
commands =
|
commands =
|
||||||
pytest -n3 -rfsxX {posargs:testing}
|
pytest -n3 -ra {posargs:testing}
|
||||||
|
|
||||||
[testenv:py27-pexpect]
|
[testenv:py27-pexpect]
|
||||||
changedir = testing
|
changedir = testing
|
||||||
platform = linux|darwin
|
platform = linux|darwin
|
||||||
deps = pexpect
|
deps = pexpect
|
||||||
commands =
|
commands =
|
||||||
pytest -rfsxX test_pdb.py test_terminal.py test_unittest.py
|
pytest -ra test_pdb.py test_terminal.py test_unittest.py
|
||||||
|
|
||||||
[testenv:py35-pexpect]
|
[testenv:py35-pexpect]
|
||||||
changedir = testing
|
changedir = testing
|
||||||
platform = linux|darwin
|
platform = linux|darwin
|
||||||
deps = {[testenv:py27-pexpect]deps}
|
deps = {[testenv:py27-pexpect]deps}
|
||||||
commands =
|
commands =
|
||||||
pytest -rfsxX test_pdb.py test_terminal.py test_unittest.py
|
pytest -ra test_pdb.py test_terminal.py test_unittest.py
|
||||||
|
|
||||||
[testenv:py27-nobyte]
|
[testenv:py27-nobyte]
|
||||||
deps =
|
deps =
|
||||||
|
@ -95,7 +95,7 @@ distribute = true
|
||||||
setenv =
|
setenv =
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
commands =
|
commands =
|
||||||
pytest -n3 -rfsxX {posargs:testing}
|
pytest -n3 -ra {posargs:testing}
|
||||||
|
|
||||||
[testenv:py27-trial]
|
[testenv:py27-trial]
|
||||||
deps = twisted
|
deps = twisted
|
||||||
|
@ -110,12 +110,30 @@ commands =
|
||||||
[testenv:py27-numpy]
|
[testenv:py27-numpy]
|
||||||
deps=numpy
|
deps=numpy
|
||||||
commands=
|
commands=
|
||||||
pytest -rfsxX {posargs:testing/python/approx.py}
|
pytest -ra {posargs:testing/python/approx.py}
|
||||||
|
|
||||||
[testenv:py35-numpy]
|
[testenv:py35-numpy]
|
||||||
deps=numpy
|
deps=numpy
|
||||||
commands=
|
commands=
|
||||||
pytest -rfsxX {posargs:testing/python/approx.py}
|
pytest -ra {posargs:testing/python/approx.py}
|
||||||
|
|
||||||
|
[testenv:py27-pluggymaster]
|
||||||
|
passenv={[testenv]passenv}
|
||||||
|
commands={[testenv]commands}
|
||||||
|
setenv=
|
||||||
|
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
git+https://github.com/pytest-dev/pluggy.git@master
|
||||||
|
|
||||||
|
[testenv:py35-pluggymaster]
|
||||||
|
passenv={[testenv:py27-pluggymaster]passenv}
|
||||||
|
commands={[testenv:py27-pluggymaster]commands}
|
||||||
|
setenv=
|
||||||
|
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
|
||||||
|
deps =
|
||||||
|
{[testenv:py27-pluggymaster]deps}
|
||||||
|
git+https://github.com/pytest-dev/pluggy.git@master
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
@ -138,7 +156,7 @@ changedir = doc/
|
||||||
deps =
|
deps =
|
||||||
PyYAML
|
PyYAML
|
||||||
commands =
|
commands =
|
||||||
pytest -rfsxX en
|
pytest -ra en
|
||||||
pytest --doctest-modules --pyargs _pytest
|
pytest --doctest-modules --pyargs _pytest
|
||||||
|
|
||||||
[testenv:regen]
|
[testenv:regen]
|
||||||
|
@ -167,7 +185,7 @@ commands =
|
||||||
[testenv:jython]
|
[testenv:jython]
|
||||||
changedir = testing
|
changedir = testing
|
||||||
commands =
|
commands =
|
||||||
{envpython} {envbindir}/py.test-jython -rfsxX {posargs}
|
{envpython} {envbindir}/py.test-jython -ra {posargs}
|
||||||
|
|
||||||
[testenv:py35-freeze]
|
[testenv:py35-freeze]
|
||||||
changedir = testing/freeze
|
changedir = testing/freeze
|
||||||
|
@ -194,7 +212,7 @@ commands =
|
||||||
minversion = 2.0
|
minversion = 2.0
|
||||||
plugins = pytester
|
plugins = pytester
|
||||||
#--pyargs --doctest-modules --ignore=.tox
|
#--pyargs --doctest-modules --ignore=.tox
|
||||||
addopts = -rxsX -p pytester --ignore=testing/cx_freeze
|
addopts = -ra -p pytester --ignore=testing/cx_freeze
|
||||||
rsyncdirs = tox.ini pytest.py _pytest testing
|
rsyncdirs = tox.ini pytest.py _pytest testing
|
||||||
python_files = test_*.py *_test.py testing/*/*.py
|
python_files = test_*.py *_test.py testing/*/*.py
|
||||||
python_classes = Test Acceptance
|
python_classes = Test Acceptance
|
||||||
|
|
Loading…
Reference in New Issue