From 53d58d2d6fad7faea95ebfd2aaee9b715767d5c7 Mon Sep 17 00:00:00 2001 From: Steve Brudenell Date: Mon, 24 Jun 2024 14:42:18 -0800 Subject: [PATCH] switch to legacy_tox_ini, remove tox-ini-fmt. I noticed https://github.com/tox-dev/tox-ini-fmt/issues/42, which makes it hard to use comments in tox.ini. Auto-formatting tox.ini was the main motivation to use a separate tox.ini at all, so just keep everything in pyproject.toml. Maybe tox will eventually have first-party support for pyproject.toml; this will make the transition that much simpler. It appears that tox==3.21.4 (appears on on ubuntu-22.04) can't actually parse the legacy_tox_ini option, and so does not get to the point of provisioning a tox environment for the approrpiate version. We now do proper provisioning ourselves in github ci. --- .github/workflows/tests.yaml | 9 ++++++--- .pre-commit-config.yaml | 4 ---- pyproject.toml | 30 ++++++++++++++++++++++++++++++ tox.ini | 23 ----------------------- 4 files changed, 36 insertions(+), 30 deletions(-) delete mode 100644 tox.ini diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e6c0d5a..447a54d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,9 +15,12 @@ jobs: - uses: actions/checkout@v4 - run: | sudo apt update - sudo apt install python3-btrfsutil tox - - run: | - sudo tox + sudo apt install python3-btrfsutil python3-virtualenv + python3 -m virtualenv /tmp/venv + source /tmp/venv/bin/activate + python3 -m pip install --upgrade pip + python3 -m pip install --upgrade tox + sudo -E env PATH=$PATH tox pre-commit: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 590fd48..dcb2bc5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,10 +21,6 @@ repos: rev: 2.1.3 hooks: - id: pyproject-fmt -- repo: https://github.com/tox-dev/tox-ini-fmt - rev: 1.3.1 - hooks: - - id: tox-ini-fmt - repo: https://github.com/google/yamlfmt rev: v0.12.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 0fb0358..1292103 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,36 @@ lint.isort.force-sort-within-sections = true lint.isort.order-by-type = false lint.pydocstyle.convention = "google" +[tool.coverage.run] +plugins = [ + "covdefaults", +] +source = [ + "btrfs2s3", + "tests", +] + +[tool.tox] +legacy_tox_ini = """ + [tox] + requires = + tox>=4.2 + env_list = + py + + [testenv] + system_site_packages = true + deps = + covdefaults + coverage + moto[s3] + pytest + commands = + coverage erase + coverage run -m pytest {posargs} + coverage report +""" + [tool.mypy] mypy_path = "typeshed" strict = true diff --git a/tox.ini b/tox.ini deleted file mode 100644 index c30459b..0000000 --- a/tox.ini +++ /dev/null @@ -1,23 +0,0 @@ -[tox] -requires = - tox>=4.2 -env_list = - py - -[testenv] -system_site_packages = true -deps = - covdefaults - coverage - moto[s3] - pytest -commands = - coverage erase - coverage run -m pytest {posargs} - coverage report - -[coverage:run] -plugins = covdefaults -source = - btrfs2s3 - tests