Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b487ed5e1 | ||
|
|
ecf4d3be31 | ||
|
|
87d89795e3 | ||
|
|
b4544c8849 | ||
|
|
66dc3904b4 | ||
|
|
e0ce1b7418 | ||
|
|
ed47f0e01a | ||
|
|
1c8178abc5 | ||
|
|
9807064f66 | ||
|
|
766e67ce52 | ||
|
|
305aeeacec | ||
|
|
90fc616906 | ||
|
|
5f4d6ea0e6 | ||
|
|
a0ad5cf041 | ||
|
|
5e0b40cea2 | ||
|
|
513e203ee1 | ||
|
|
a5c65dd1e4 | ||
|
|
ccb14f24fc | ||
|
|
76dbde0475 | ||
|
|
1167e1609c | ||
|
|
348a956724 | ||
|
|
dba716ba91 | ||
|
|
e7c42f0b3b |
14
.github/workflows/main.yml
vendored
14
.github/workflows/main.yml
vendored
@@ -15,8 +15,10 @@ jobs:
|
|||||||
- "py37-pytestlatest"
|
- "py37-pytestlatest"
|
||||||
- "py38-pytestlatest"
|
- "py38-pytestlatest"
|
||||||
- "py39-pytestlatest"
|
- "py39-pytestlatest"
|
||||||
|
- "py310-pytestlatest"
|
||||||
- "py38-pytestmain"
|
- "py38-pytestmain"
|
||||||
- "py38-psutil"
|
- "py38-psutil"
|
||||||
|
- "py38-setproctitle"
|
||||||
|
|
||||||
os: [ubuntu-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest]
|
||||||
include:
|
include:
|
||||||
@@ -28,15 +30,19 @@ jobs:
|
|||||||
python: "3.8"
|
python: "3.8"
|
||||||
- tox_env: "py39-pytestlatest"
|
- tox_env: "py39-pytestlatest"
|
||||||
python: "3.9"
|
python: "3.9"
|
||||||
|
- tox_env: "py310-pytestlatest"
|
||||||
|
python: "3.10-dev"
|
||||||
- tox_env: "py38-pytestmain"
|
- tox_env: "py38-pytestmain"
|
||||||
python: "3.8"
|
python: "3.8"
|
||||||
- tox_env: "py38-psutil"
|
- tox_env: "py38-psutil"
|
||||||
python: "3.8"
|
python: "3.8"
|
||||||
|
- tox_env: "py38-setproctitle"
|
||||||
|
python: "3.8"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
- name: Install tox
|
- name: Install tox
|
||||||
@@ -56,9 +62,9 @@ jobs:
|
|||||||
needs: build
|
needs: build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
- name: Install wheel
|
- name: Install wheel
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 21.6b0
|
rev: 21.9b0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: [--safe, --quiet, --target-version, py35]
|
args: [--safe, --quiet, --target-version, py35]
|
||||||
@@ -17,7 +17,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v2.19.4
|
rev: v2.26.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py3-plus]
|
args: [--py3-plus]
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
pytest-xdist 2.4.0 (2021-09-20)
|
||||||
|
===============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- `#696 <https://github.com/pytest-dev/pytest-xdist/issues/696>`_: On Linux, the process title now changes to indicate the current worker state (running/idle).
|
||||||
|
|
||||||
|
Depends on the `setproctitle <https://pypi.org/project/setproctitle/>`__ package, which can be installed with ``pip install pytest-xdist[setproctitle]``.
|
||||||
|
|
||||||
|
- `#704 <https://github.com/pytest-dev/pytest-xdist/issues/704>`_: Add support for Python 3.10.
|
||||||
|
|
||||||
|
|
||||||
pytest-xdist 2.3.0 (2021-06-16)
|
pytest-xdist 2.3.0 (2021-06-16)
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
|
|||||||
20
README.rst
20
README.rst
@@ -317,6 +317,26 @@ Since version 2.0, the following functions are also available in the ``xdist`` m
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
Identifying workers from the system environment
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
*New in version UNRELEASED TBD FIXME*
|
||||||
|
|
||||||
|
If the `setproctitle`_ package is installed, ``pytest-xdist`` will use it to
|
||||||
|
update the process title (command line) on its workers to show their current
|
||||||
|
state. The titles used are ``[pytest-xdist running] file.py/node::id`` and
|
||||||
|
``[pytest-xdist idle]``, visible in standard tools like ``ps`` and ``top`` on
|
||||||
|
Linux, Mac OS X and BSD systems. For Windows, please follow `setproctitle`_'s
|
||||||
|
pointer regarding the Process Explorer tool.
|
||||||
|
|
||||||
|
This is intended purely as an UX enhancement, e.g. to track down issues with
|
||||||
|
long-running or CPU intensive tests. Errors in changing the title are ignored
|
||||||
|
silently. Please try not to rely on the title format or title changes in
|
||||||
|
external scripts.
|
||||||
|
|
||||||
|
.. _`setproctitle`: https://pypi.org/project/setproctitle/
|
||||||
|
|
||||||
|
|
||||||
Uniquely identifying the current test run
|
Uniquely identifying the current test run
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
|
|||||||
7
setup.py
7
setup.py
@@ -18,7 +18,11 @@ setup(
|
|||||||
platforms=["linux", "osx", "win32"],
|
platforms=["linux", "osx", "win32"],
|
||||||
packages=find_packages(where="src"),
|
packages=find_packages(where="src"),
|
||||||
package_dir={"": "src"},
|
package_dir={"": "src"},
|
||||||
extras_require={"testing": ["filelock"], "psutil": ["psutil>=3.0"]},
|
extras_require={
|
||||||
|
"testing": ["filelock"],
|
||||||
|
"psutil": ["psutil>=3.0"],
|
||||||
|
"setproctitle": ["setproctitle"],
|
||||||
|
},
|
||||||
entry_points={
|
entry_points={
|
||||||
"pytest11": ["xdist = xdist.plugin", "xdist.looponfail = xdist.looponfail"]
|
"pytest11": ["xdist = xdist.plugin", "xdist.looponfail = xdist.looponfail"]
|
||||||
},
|
},
|
||||||
@@ -44,5 +48,6 @@ setup(
|
|||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,6 +16,21 @@ from execnet.gateway_base import dumps, DumpError
|
|||||||
|
|
||||||
from _pytest.config import _prepareconfig, Config
|
from _pytest.config import _prepareconfig, Config
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
except ImportError:
|
||||||
|
|
||||||
|
def setproctitle(title):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def worker_title(title):
|
||||||
|
try:
|
||||||
|
setproctitle(title)
|
||||||
|
except Exception:
|
||||||
|
# changing the process name is very optional, no errors please
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class WorkerInteractor:
|
class WorkerInteractor:
|
||||||
def __init__(self, config, channel):
|
def __init__(self, config, channel):
|
||||||
@@ -85,9 +100,14 @@ class WorkerInteractor:
|
|||||||
else:
|
else:
|
||||||
nextitem = None
|
nextitem = None
|
||||||
|
|
||||||
|
worker_title("[pytest-xdist running] %s" % item.nodeid)
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
|
self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
|
||||||
duration = time.time() - start
|
duration = time.time() - start
|
||||||
|
|
||||||
|
worker_title("[pytest-xdist idle]")
|
||||||
|
|
||||||
self.sendevent(
|
self.sendevent(
|
||||||
"runtest_protocol_complete", item_index=self.item_index, duration=duration
|
"runtest_protocol_complete", item_index=self.item_index, duration=duration
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ def test_fixture_teardown_failure(testdir):
|
|||||||
pass
|
pass
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest_subprocess("--debug", p) # , "-n1")
|
result = testdir.runpytest_subprocess(p, "-n1")
|
||||||
result.stdout.fnmatch_lines(["*ValueError*42*", "*1 passed*1 error*"])
|
result.stdout.fnmatch_lines(["*ValueError*42*", "*1 passed*1 error*"])
|
||||||
assert result.ret
|
assert result.ret
|
||||||
|
|
||||||
|
|||||||
11
tox.ini
11
tox.ini
@@ -1,9 +1,10 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist=
|
envlist=
|
||||||
linting
|
linting
|
||||||
py{36,37,38,39}-pytestlatest
|
py{36,37,38,39,310}-pytestlatest
|
||||||
py38-pytestmain
|
py38-pytestmain
|
||||||
py38-psutil
|
py38-psutil
|
||||||
|
py38-setproctitle
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
extras = testing
|
extras = testing
|
||||||
@@ -21,6 +22,14 @@ deps = pytest
|
|||||||
commands =
|
commands =
|
||||||
pytest {posargs:-k psutil}
|
pytest {posargs:-k psutil}
|
||||||
|
|
||||||
|
[testenv:py38-setproctitle]
|
||||||
|
extras =
|
||||||
|
testing
|
||||||
|
setproctitle
|
||||||
|
deps = pytest
|
||||||
|
commands =
|
||||||
|
pytest {posargs}
|
||||||
|
|
||||||
[testenv:release]
|
[testenv:release]
|
||||||
changedir=
|
changedir=
|
||||||
decription = do a release, required posarg of the version number
|
decription = do a release, required posarg of the version number
|
||||||
|
|||||||
Reference in New Issue
Block a user