Commit 72e0c1eb authored by Scott Talbert's avatar Scott Talbert

Update upstream source from tag 'upstream/1.25.0'

Update to upstream version '1.25.0'
with Debian dir 3c21fea4ff3c48b6631affe4f0f53d9dd0786e45
parents 6cfa9dbd 0fd09f90
......@@ -11,18 +11,9 @@ notifications:
email:
- pytest-commit@python.org
python:
- '2.7'
- '3.4'
- '3.5'
- '3.6'
env:
- TOXENV=py-pytest30
- TOXENV=py-pytest31
- TOXENV=py-pytest32
- TOXENV=py-pytest33
install: pip install tox setuptools_scm
install:
- pip install -U pip
- pip install tox setuptools_scm
script: tox
stages:
......@@ -42,7 +33,14 @@ jobs:
env: TOXENV=py27-pytestlatest
- stage: test
# python x env above are already included into this stage
python: "3.4"
env: TOXENV=py34-pytestlatest
- python: "3.5"
env: TOXENV=py35-pytestlatest
- python: "3.7"
env: TOXENV=py37-pytestlatest
sudo: required
dist: xenial
- python: "2.7"
env: TOXENV=py27-pytestmaster
- python: "2.7"
......
pytest-xdist 1.25.0 (2018-12-12)
================================
Deprecations and Removals
-------------------------
- `#372 <https://github.com/pytest-dev/pytest-xdist/issues/372>`_: Pytest versions older than 3.6 are no longer supported.
Features
--------
- `#373 <https://github.com/pytest-dev/pytest-xdist/issues/373>`_: Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines.
- `#388 <https://github.com/pytest-dev/pytest-xdist/issues/388>`_: ``mainargv`` is made available in ``workerinput`` from the host's ``sys.argv``.
This can be used via ``request.config.workerinput["mainargv"]``.
Bug Fixes
---------
- `#332 <https://github.com/pytest-dev/pytest-xdist/issues/332>`_: Fix report of module-level skips (``pytest.skip(reason, allow_module_level=True)``).
- `#378 <https://github.com/pytest-dev/pytest-xdist/issues/378>`_: Fix support for gevent monkeypatching
- `#384 <https://github.com/pytest-dev/pytest-xdist/issues/384>`_: pytest 4.1 support: ``ExceptionInfo`` API changes.
- `#390 <https://github.com/pytest-dev/pytest-xdist/issues/390>`_: pytest 4.1 support: ``pytest_logwarning`` hook removed.
pytest-xdist 1.24.1 (2018-11-09)
================================
......
Metadata-Version: 1.2
Name: pytest-xdist
Version: 1.24.1
Version: 1.25.0
Summary: pytest xdist plugin for distributed testing and loop-on-failing modes
Home-page: https://github.com/pytest-dev/pytest-xdist
Author: holger krekel and contributors
......@@ -296,4 +296,5 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
environment:
matrix:
# note: please use "tox --listenvs" to populate the build matrix
- TOXENV: "py27-pytest33"
- TOXENV: "py34-pytest33"
- TOXENV: "py35-pytest33"
- TOXENV: "py36-pytest33"
- TOXENV: "py27-pytestlatest"
- TOXENV: "py34-pytestlatest"
- TOXENV: "py35-pytestlatest"
- TOXENV: "py36-pytestlatest"
- TOXENV: "py27-pytest33-pexpect"
- TOXENV: "py36-pytest33-pexpect"
- TOXENV: "py37-pytestlatest"
- TOXENV: "py27-pytestmaster"
- TOXENV: "py36-pytestmaster"
- TOXENV: "py27-pytestfeatures"
- TOXENV: "py36-pytestfeatures"
install:
- C:\Python36\python -m pip install -U tox setuptools_scm pip
- C:\Python37\python -m pip install -U pip
- C:\Python37\python -m pip install -U tox setuptools_scm
build: false # Not a C# project, build stuff at the test step instead.
test_script:
- C:\Python36\python -m tox
- C:\Python37\python -m tox
# We don't deploy anything on tags with AppVeyor, we use Travis instead, so we
# might as well save resources
......
from setuptools import setup, find_packages
install_requires = ["execnet>=1.1", "pytest>=3.0.0", "pytest-forked", "six"]
install_requires = ["execnet>=1.1", "pytest>=3.6.0", "pytest-forked", "six"]
setup(
......@@ -40,5 +40,6 @@ setup(
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
)
......@@ -358,6 +358,30 @@ class TestDistEach:
class TestTerminalReporting:
@pytest.mark.parametrize("verbosity", ["", "-q", "-v"])
def test_output_verbosity(self, testdir, verbosity):
testdir.makepyfile(
"""
def test_ok():
pass
"""
)
args = ["-n1"]
if verbosity:
args.append(verbosity)
result = testdir.runpytest(*args)
out = result.stdout.str()
if verbosity == "-v":
assert "scheduling tests" in out
assert "gw" in out
elif verbosity == "-q":
assert "scheduling tests" not in out
assert "gw" not in out
assert "bringing up nodes..." in out
else:
assert "scheduling tests" not in out
assert "gw" in out
def test_pass_skip_fail(self, testdir):
testdir.makepyfile(
"""
......@@ -517,16 +541,15 @@ def test_session_testscollected(testdir):
assert collected_file.read() == "collected = 3"
def test_funcarg_teardown_failure(testdir):
def test_fixture_teardown_failure(testdir):
p = testdir.makepyfile(
"""
import pytest
@pytest.fixture
@pytest.fixture(scope="module")
def myarg(request):
def teardown(val):
raise ValueError(val)
return request.cached_setup(setup=lambda: 42, teardown=teardown,
scope="module")
yield 42
raise ValueError(42)
def test_hello(myarg):
pass
"""
......@@ -612,6 +635,11 @@ def test_skipping(testdir):
def test_issue34_pluginloading_in_subprocess(testdir):
import _pytest.hookspec
if not hasattr(_pytest.hookspec, "pytest_namespace"):
pytest.skip("this pytest version no longer supports pytest_namespace()")
testdir.tmpdir.join("plugin123.py").write(
textwrap.dedent(
"""
......@@ -708,16 +736,6 @@ def test_sub_plugins_disabled(testdir, plugin):
class TestWarnings:
@pytest.fixture(autouse=True)
def skip_if_unsupported_pytest_version(self):
"""Skip tests of this class if we are running in a pytest version which does not
support warnings yet.
"""
from pkg_resources import parse_version
if parse_version(pytest.__version__) < parse_version("3.1"):
pytest.skip("pytest warnings requires >= 3.1")
@pytest.mark.parametrize("n", ["-n0", "-n1"])
@pytest.mark.parametrize("warn_type", ["pytest", "builtin"])
def test_warnings(self, testdir, n, warn_type):
......
import py
import pytest
from pkg_resources import parse_version
from xdist.looponfail import RemoteControl
from xdist.looponfail import StatRecorder
......@@ -214,7 +217,11 @@ class TestLooponFailing:
assert "test_one" not in remotecontrol.failures[0]
assert "test_two" in remotecontrol.failures[0]
@py.test.mark.xfail(py.test.__version__ >= "3.1", reason="broken by pytest 3.1+")
@pytest.mark.xfail(
parse_version(pytest.__version__) >= parse_version("3.1"),
reason="broken by pytest 3.1+",
strict=True,
)
def test_looponfail_removed_test(self, testdir):
modcol = testdir.getmodulecol(
"""
......
import py
import pprint
import pytest
import sys
from xdist.workermanage import WorkerController, unserialize_report
from xdist.remote import serialize_report
import execnet
......@@ -292,14 +294,11 @@ class TestWorkerInteractor:
ev = worker.popevent("workerfinished")
assert "workeroutput" in ev.kwargs
@pytest.mark.skipif(
pytest.__version__ >= "3.0", reason="skip at module level illegal in pytest 3.0"
)
def test_remote_collect_skip(self, worker):
worker.testdir.makepyfile(
"""
import py
py.test.skip("hello")
import pytest
pytest.skip("hello", allow_module_level=True)
"""
)
worker.setup()
......@@ -307,10 +306,9 @@ class TestWorkerInteractor:
assert not ev.kwargs
ev = worker.popevent()
assert ev.name == "collectreport"
ev = worker.popevent()
assert ev.name == "collectreport"
rep = unserialize_report(ev.name, ev.kwargs["data"])
assert rep.skipped
assert rep.longrepr[2] == "Skipped: hello"
ev = worker.popevent("collectionfinish")
assert not ev.kwargs["ids"]
......@@ -400,3 +398,66 @@ def test_remote_env_vars(testdir):
)
result = testdir.runpytest("-n2", "--max-worker-restart=0")
assert result.ret == 0
def test_remote_inner_argv(testdir):
"""Test/document the behavior due to execnet using `python -c`."""
testdir.makepyfile(
"""
import sys
def test_argv():
assert sys.argv == ["-c"]
"""
)
result = testdir.runpytest("-n1")
assert result.ret == 0
def test_remote_mainargv(testdir):
outer_argv = sys.argv
testdir.makepyfile(
"""
def test_mainargv(request):
assert request.config.workerinput["mainargv"] == {!r}
""".format(
outer_argv
)
)
result = testdir.runpytest("-n1")
assert result.ret == 0
def test_remote_usage_prog(testdir, request):
if not hasattr(request.config._parser, "prog"):
pytest.skip("prog not available in config parser")
testdir.makeconftest(
"""
import pytest
config_parser = None
@pytest.fixture
def get_config_parser():
return config_parser
def pytest_configure(config):
global config_parser
config_parser = config._parser
"""
)
testdir.makepyfile(
"""
import sys
def test(get_config_parser, request):
get_config_parser._getparser().error("my_usage_error")
"""
)
result = testdir.runpytest_subprocess("-n1")
assert result.ret == 1
result.stdout.fnmatch_lines(
["usage: pytest.py *", "pytest.py: error: my_usage_error"]
)
[tox]
# if you change the envlist, please update .travis.yml file as well
envlist=
linting
py{27,34,35,36}-pytest{30,31,32,33,latest}
py{27,36}-pytest36-pexpect
py{27,34,35,36,37}-pytestlatest
py{27,36}-pytest{master,features}
[testenv]
changedir=testing
passenv = USER USERNAME
deps =
pycmd
# to avoid .eggs
setuptools_scm
pytest30: pytest~=3.0.5
pytest31: pytest~=3.1.0
pytest32: pytest~=3.2.0
pytest33: pytest~=3.3.0
pytestlatest: pytest
pytestmaster: git+https://github.com/pytest-dev/pytest.git@master
pytestfeatures: git+https://github.com/pytest-dev/pytest.git@features
pexpect: pexpect
filelock
platform=
pexpect: linux|darwin
commands=
pytest {posargs}
......@@ -48,7 +35,7 @@ commands =
towncrier --version {posargs} --yes
[pytest]
addopts = -rsfxX
addopts = -ra
[flake8]
max-line-length = 120
......
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '1.24.1'
version = '1.25.0'
......@@ -229,9 +229,10 @@ class DSession(object):
if self.terminal and not self.sched.has_pending:
self.trdist.ensure_show_status()
self.terminal.write_line("")
self.terminal.write_line(
"scheduling tests via %s" % (self.sched.__class__.__name__)
)
if self.config.option.verbose > 0:
self.terminal.write_line(
"scheduling tests via %s" % (self.sched.__class__.__name__)
)
self.sched.schedule()
def worker_logstart(self, node, nodeid, location):
......@@ -259,10 +260,10 @@ class DSession(object):
def worker_collectreport(self, node, rep):
"""Emitted when a node calls the pytest_collectreport hook.
Because we only need the report when there's a failure, as optimization
we only expect to receive failed reports from workers (#330).
Because we only need the report when there's a failure/skip, as optimization
we only expect to receive failed/skipped reports from workers (#330).
"""
assert rep.failed
assert not rep.passed
self._failed_worker_collectreport(node, rep)
def worker_logwarning(self, message, code, nodeid, fslocation):
......@@ -344,8 +345,11 @@ class TerminalDistReporter(object):
self.rewrite(self.getstatus())
def getstatus(self):
parts = ["%s %s" % (spec.id, self._status[spec.id]) for spec in self._specs]
return " / ".join(parts)
if self.config.option.verbose >= 0:
parts = ["%s %s" % (spec.id, self._status[spec.id]) for spec in self._specs]
return " / ".join(parts)
else:
return "bringing up nodes..."
def rewrite(self, line, newline=False):
pline = line + " " * max(self._lastlen - len(line), 0)
......
......@@ -32,7 +32,7 @@ def pytest_cmdline_main(config):
if config.getoption("looponfail"):
usepdb = config.getoption("usepdb") # a core option
if usepdb:
raise pytest.UsageError("--pdb incompatible with --looponfail.")
raise pytest.UsageError("--pdb is incompatible with --looponfail.")
looponfail_main(config)
return 2 # looponfail only can get stop with ctrl-C anyway
......
......@@ -126,12 +126,12 @@ def pytest_addoption(parser):
)
parser.addini(
"rsyncdirs",
"list of (relative) paths to be rsynced for" " remote distributed testing.",
"list of (relative) paths to be rsynced for remote distributed testing.",
type="pathlist",
)
parser.addini(
"rsyncignore",
"list of (relative) glob-style paths to be ignored " "for rsyncing.",
"list of (relative) glob-style paths to be ignored for rsyncing.",
type="pathlist",
)
parser.addini(
......
......@@ -110,19 +110,22 @@ class WorkerInteractor(object):
self.sendevent("testreport", data=data)
def pytest_collectreport(self, report):
# master only needs reports that failed, as optimization send only them instead (#330)
if report.failed:
# send only reports that have not passed to master as optimization (#330)
if not report.passed:
data = serialize_report(report)
self.sendevent("collectreport", data=data)
def pytest_logwarning(self, message, code, nodeid, fslocation):
self.sendevent(
"logwarning",
message=message,
code=code,
nodeid=nodeid,
fslocation=str(fslocation),
)
# the pytest_logwarning hook was removed in pytest 4.1
if hasattr(_pytest.hookspec, "pytest_logwarning"):
def pytest_logwarning(self, message, code, nodeid, fslocation):
self.sendevent(
"logwarning",
message=message,
code=code,
nodeid=nodeid,
fslocation=str(fslocation),
)
# the pytest_warning_captured hook was introduced in pytest 3.8
if hasattr(_pytest.hookspec, "pytest_warning_captured"):
......@@ -261,6 +264,7 @@ if __name__ == "__channelexec__":
import py
config = remote_initconfig(option_dict, args)
config._parser.prog = os.path.basename(workerinput["mainargv"][0])
config.workerinput = workerinput
config.workeroutput = {}
# TODO: deprecated name, backward compatibility only. Remove it in future
......
......@@ -187,7 +187,7 @@ class LoadScopeScheduling(object):
break
else:
raise RuntimeError(
"Unable to identify crashitem on a workload with " "pending items"
"Unable to identify crashitem on a workload with pending items"
)
# Made uncompleted work unit available again
......
......@@ -2,6 +2,7 @@ from __future__ import print_function
import fnmatch
import os
import re
import sys
import threading
import py
......@@ -213,6 +214,7 @@ class WorkerController(object):
"workercount": len(nodemanager.specs),
"slaveid": gateway.id,
"slavecount": len(nodemanager.specs),
"mainargv": sys.argv,
}
# TODO: deprecated name, backward compatibility only. Remove it in future
self.slaveinput = self.workerinput
......@@ -268,7 +270,7 @@ class WorkerController(object):
if not self._down:
try:
self.sendcommand("shutdown")
except IOError:
except (IOError, OSError):
pass
self._shutdown_sent = True
......@@ -345,7 +347,11 @@ class WorkerController(object):
except: # noqa
from _pytest._code import ExceptionInfo
excinfo = ExceptionInfo()
# ExceptionInfo API changed in pytest 4.1
if hasattr(ExceptionInfo, "from_current"):
excinfo = ExceptionInfo.from_current()
else:
excinfo = ExceptionInfo()
print("!" * 20, excinfo)
self.config.notify_exception(excinfo)
self.shutdown()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment