diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8263ff9..a4e25ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - tox_env: [py39, py310, py311, py312, py313, pypy3, pep8] + tox_env: [py39, py310, py311, py312, py313, pypy3] # Use GitHub's Linux Docker host runs-on: ubuntu-latest @@ -32,23 +32,15 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install ruff - run: | - python3 -m pip install --break-system-packages ruff mypy + - name: Install tox + run: python -m pip install tox - name: Run ruff format run: | - ruff --version - if ! ruff format --check --quiet varlink - then - echo "Please run 'ruff format' on the above files or apply the diffs below manually" - ruff format --check --quiet --diff varlink - fi + tox -e ruff-format - name: Run ruff check run: | - ruff --version - ruff check varlink + tox -e ruff-check - name: Type Checking (mypy) run: | - python3 -m mypy --version - python3 -m mypy varlink/ + tox -e mypy runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index fe76d54..d18bfe5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,46 @@ local_scheme = "no-local-version" target-version = "py39" line-length = 109 lint.select = ["E", "F", "I", "UP"] + +[tool.mypy] +python_version = 3.9 + +### tox configuration ### +[tool.tox] +env_list = ["py313", "py312", "py311", "py310", "py39", "pypy3"] + +[tool.tox.env_run_base] +description = "Run test suite on {base_python}" +deps = ["-r{toxinidir}/test-requirements.txt"] +commands = [ + ["pytest", "--cov=varlink", "--cov-report=term", "{posargs:varlink}"] +] + +[tool.tox.env_run_base.set_env] +VIRTUAL_ENV="{envdir}" +BRANCH_NAME="master" +CLIENT_NAME="varlink" + +[tool.tox.env.ruff-format] +description = "Check formatting using the ruff tool" +deps = ["ruff"] +commands = [ + ["ruff", "--version"], + ["ruff", "format", "--quiet", "--check", "--diff", "{posargs:varlink}"] +] + +[tool.tox.env.ruff-check] +description = "Run linting checks using the ruff tool" +deps = ["ruff"] +commands = [ + ["ruff", "--version"], + ["ruff", "check", "{posargs:varlink}"] +] + +[tool.tox.env.mypy] +description = "Run type checking tool mypy" +deps = ["mypy"] +commands = [ + ["mypy", "--version"], + ["mypy", "{posargs:varlink}"] +] diff --git a/test-requirements.txt b/test-requirements.txt index 7696e32..9955dec 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,2 @@ -fixtures -nose2 +pytest +pytest-cov diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 7f72306..0000000 --- a/tox.ini +++ /dev/null @@ -1,20 +0,0 @@ -# tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - -[tox] -envlist = py313,py312,py311,py310,py39,pep8,pypy3 - -[testenv] -usedevelop = True -install_command = pip install {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} - BRANCH_NAME=master - CLIENT_NAME=varlink -deps = - -r{toxinidir}/test-requirements.txt -commands = - nose2 \ - --coverage varlink