From 0c981d35475ab6eaee2e6a5ead44442bf07d6e61 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 25 Oct 2022 17:07:47 +0200 Subject: [PATCH] fix and update packaging * drop empty setup.py which "breaks" on incomplete build envs * use the build package to build the dist * update the gh workflow to use it fixup noise from pre-commit --- .github/workflows/main.yml | 6 +++--- changelog/812.feature | 1 - pyproject.toml | 1 - setup.cfg | 1 - setup.py | 4 ---- src/xdist/plugin.py | 4 +++- src/xdist/remote.py | 4 ++-- testing/test_plugin.py | 3 ++- 8 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 setup.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7359cfe4..0d944e6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,12 +70,12 @@ jobs: - name: Install wheel run: | python -m pip install --upgrade pip - pip install wheel + pip install build - name: Build package run: | - python setup.py sdist bdist_wheel + python -m build - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.pypi_token }} diff --git a/changelog/812.feature b/changelog/812.feature index 1d0eb0ee..3eca0b39 100644 --- a/changelog/812.feature +++ b/changelog/812.feature @@ -19,4 +19,3 @@ the fixture, the fixture was created only once. So restore the old behavior for typical cases where the number of tests is much greater than the number of workers (or, strictly speaking, when there are at least 2 tests for every node). - diff --git a/pyproject.toml b/pyproject.toml index 1a462ccd..863e7dbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [build-system] requires = [ - # sync with setup.py until we discard non-pep-517/518 "setuptools>=45.0", "setuptools-scm[toml]>=6.2.3", "wheel", diff --git a/setup.cfg b/setup.cfg index 88871d11..094de03c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,7 +44,6 @@ python_requires = >=3.6 install_requires = execnet>=1.1 pytest>=6.2.0 -setup_requires = # left empty, enforce using isolated build system [options.packages.find] where = src diff --git a/setup.py b/setup.py deleted file mode 100644 index 7f1a1763..00000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - -if __name__ == "__main__": - setup() diff --git a/src/xdist/plugin.py b/src/xdist/plugin.py index a4e92846..a24864ec 100644 --- a/src/xdist/plugin.py +++ b/src/xdist/plugin.py @@ -18,7 +18,9 @@ def pytest_xdist_auto_num_workers(config): try: return int(env_var) except ValueError: - warnings.warn("PYTEST_XDIST_AUTO_NUM_WORKERS is not a number: {env_var!r}. Ignoring it.") + warnings.warn( + "PYTEST_XDIST_AUTO_NUM_WORKERS is not a number: {env_var!r}. Ignoring it." + ) try: import psutil diff --git a/src/xdist/remote.py b/src/xdist/remote.py index edf6ae35..5d0c8997 100644 --- a/src/xdist/remote.py +++ b/src/xdist/remote.py @@ -28,8 +28,8 @@ class Producer: """ Simplified implementation of the same interface as py.log, for backward compatibility since we dropped the dependency on pylib. - Note: this is defined here because this module can't depend on xdist, so we need - to have the other way around. + Note: this is defined here because this module can't depend on xdist, so we need + to have the other way around. """ def __init__(self, name: str, *, enabled: bool = True): diff --git a/testing/test_plugin.py b/testing/test_plugin.py index 0ed8329c..c17a2734 100644 --- a/testing/test_plugin.py +++ b/testing/test_plugin.py @@ -12,7 +12,8 @@ @pytest.fixture def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch): """Make pytest-xdist believe the system has 3 CPUs""" - monkeypatch.setitem(sys.modules, "psutil", None) # block import + # block import + monkeypatch.setitem(sys.modules, "psutil", None) # type: ignore monkeypatch.delattr(os, "sched_getaffinity", raising=False) monkeypatch.setattr(os, "cpu_count", lambda: 3)