diff options
-rw-r--r-- | .github/workflows/test.yml | 8 | ||||
-rw-r--r-- | Dockerfile | 2 | ||||
-rw-r--r-- | pyproject.toml | 4 | ||||
-rw-r--r-- | requirements-test.txt | 1 | ||||
-rw-r--r-- | tests/meta/test_dists.py (renamed from tests/smoke/test_dists.py) | 18 | ||||
-rw-r--r-- | tests/smoke/__init__.py | 0 | ||||
-rw-r--r-- | tox.ini | 11 |
7 files changed, 22 insertions, 22 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0cbe44a..07e4ab9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,18 +32,18 @@ jobs: - version: "3.9" toxenv: py39 - version: "3.10" - toxenv: py310,smoke + toxenv: py310,meta - version: '3.11.0-alpha - 3.11' # SemVer's version range syntax - toxenv: py311,smoke + toxenv: py311,meta include: - os: macos-latest python: version: "3.10" - toxenv: py310,smoke + toxenv: py310,meta - os: windows-latest python: version: "3.10" - toxenv: py310,smoke + toxenv: py310,meta steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python.version }} @@ -3,7 +3,7 @@ FROM python:3.10-${PYTHON_FLAVOR} AS build WORKDIR /opt/python-gitlab COPY . . -RUN python setup.py bdist_wheel +RUN pip install build && python -m build FROM python:3.10-${PYTHON_FLAVOR} diff --git a/pyproject.toml b/pyproject.toml index 549caa9..3bbe356 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,13 +32,13 @@ module = [ "tests.*", "tests.functional.*", "tests.functional.api.*", - "tests.unit.*", - "tests.smoke.*" + "tests.unit.*" ] ignore_errors = true [tool.semantic_release] branch = "main" +build_command = "pip install build && python -m build" version_variable = "gitlab/_version.py:__version__" commit_subject = "chore: release v{version}" commit_message = "" diff --git a/requirements-test.txt b/requirements-test.txt index 6265bd8..135b671 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,3 +1,4 @@ +build==0.8.0 coverage pytest==7.1.2 pytest-console-scripts==1.3.1 diff --git a/tests/smoke/test_dists.py b/tests/meta/test_dists.py index b951eca..6f88e1f 100644 --- a/tests/smoke/test_dists.py +++ b/tests/meta/test_dists.py @@ -1,14 +1,13 @@ import tarfile import zipfile from pathlib import Path -from sys import version_info +from subprocess import CompletedProcess, run +from sys import executable, version_info import pytest -from setuptools import sandbox from gitlab._version import __title__, __version__ -DIST_DIR = Path("dist") DOCS_DIR = "docs" TEST_DIR = "tests" SDIST_FILE = f"{__title__}-{__version__}.tar.gz" @@ -18,17 +17,16 @@ WHEEL_FILE = ( @pytest.fixture(scope="function") -def build(): - sandbox.run_setup("setup.py", ["--quiet", "clean", "--all"]) - return sandbox.run_setup("setup.py", ["--quiet", "sdist", "bdist_wheel"]) +def build(tmpdir: Path): + return run([executable, "-m", "build", "--outdir", str(tmpdir)], check=True) -def test_sdist_includes_tests(build): - sdist = tarfile.open(DIST_DIR / SDIST_FILE, "r:gz") +def test_sdist_includes_tests(build: CompletedProcess, tmpdir: Path) -> None: + sdist = tarfile.open(tmpdir / SDIST_FILE, "r:gz") test_dir = sdist.getmember(f"{__title__}-{__version__}/{TEST_DIR}") assert test_dir.isdir() -def test_wheel_excludes_docs_and_tests(build): - wheel = zipfile.ZipFile(DIST_DIR / WHEEL_FILE) +def test_wheel_excludes_docs_and_tests(build: CompletedProcess, tmpdir: Path) -> None: + wheel = zipfile.ZipFile(tmpdir / WHEEL_FILE) assert not any(file.startswith((DOCS_DIR, TEST_DIR)) for file in wheel.namelist()) diff --git a/tests/smoke/__init__.py b/tests/smoke/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/tests/smoke/__init__.py +++ /dev/null @@ -15,7 +15,7 @@ isolated_build = True deps = -r{toxinidir}/requirements.txt -r{toxinidir}/requirements-test.txt commands = - pytest tests/unit tests/meta {posargs} + pytest tests/unit {posargs} [testenv:black] basepython = python3 @@ -62,9 +62,10 @@ commands = [testenv:twine-check] basepython = python3 deps = -r{toxinidir}/requirements.txt + build twine commands = - python3 setup.py sdist bdist_wheel + python -m build twine check dist/* [testenv:venv] @@ -88,7 +89,7 @@ commands = sphinx-build -n -W --keep-going -b html docs build/sphinx/html [testenv:cover] commands = pytest --cov --cov-report term --cov-report html \ - --cov-report xml tests/unit tests/meta {posargs} + --cov-report xml tests/unit {posargs} [coverage:run] omit = *tests* @@ -111,6 +112,6 @@ deps = -r{toxinidir}/requirements-docker.txt commands = pytest --cov --cov-report xml tests/functional/api {posargs} -[testenv:smoke] +[testenv:meta] deps = -r{toxinidir}/requirements-test.txt -commands = pytest tests/smoke {posargs} +commands = pytest tests/meta {posargs} |