Merge pull request #831 from pytest-dev/fix-setup

fix and update packaging
This commit is contained in:
Bruno Oliveira
2022-10-25 12:32:31 -03:00
committed by GitHub
8 changed files with 10 additions and 14 deletions

View File

@@ -70,12 +70,12 @@ jobs:
- name: Install wheel - name: Install wheel
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install wheel pip install build
- name: Build package - name: Build package
run: | run: |
python setup.py sdist bdist_wheel python -m build
- name: Publish package to PyPI - name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: __token__ user: __token__
password: ${{ secrets.pypi_token }} password: ${{ secrets.pypi_token }}

View File

@@ -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 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 much greater than the number of workers (or, strictly speaking, when there
are at least 2 tests for every node). are at least 2 tests for every node).

View File

@@ -1,6 +1,5 @@
[build-system] [build-system]
requires = [ requires = [
# sync with setup.py until we discard non-pep-517/518
"setuptools>=45.0", "setuptools>=45.0",
"setuptools-scm[toml]>=6.2.3", "setuptools-scm[toml]>=6.2.3",
"wheel", "wheel",

View File

@@ -44,7 +44,6 @@ python_requires = >=3.6
install_requires = install_requires =
execnet>=1.1 execnet>=1.1
pytest>=6.2.0 pytest>=6.2.0
setup_requires = # left empty, enforce using isolated build system
[options.packages.find] [options.packages.find]
where = src where = src

View File

@@ -1,4 +0,0 @@
from setuptools import setup
if __name__ == "__main__":
setup()

View File

@@ -18,7 +18,9 @@ def pytest_xdist_auto_num_workers(config):
try: try:
return int(env_var) return int(env_var)
except ValueError: 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: try:
import psutil import psutil

View File

@@ -28,8 +28,8 @@ class Producer:
""" """
Simplified implementation of the same interface as py.log, for backward compatibility Simplified implementation of the same interface as py.log, for backward compatibility
since we dropped the dependency on pylib. since we dropped the dependency on pylib.
Note: this is defined here because this module can't depend on xdist, so we need Note: this is defined here because this module can't depend on xdist, so we need
to have the other way around. to have the other way around.
""" """
def __init__(self, name: str, *, enabled: bool = True): def __init__(self, name: str, *, enabled: bool = True):

View File

@@ -12,7 +12,8 @@ import pytest
@pytest.fixture @pytest.fixture
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch): def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch):
"""Make pytest-xdist believe the system has 3 CPUs""" """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.delattr(os, "sched_getaffinity", raising=False)
monkeypatch.setattr(os, "cpu_count", lambda: 3) monkeypatch.setattr(os, "cpu_count", lambda: 3)