From 2b43e42f62b0a3009d842a4e44df30d1131e99b8 Mon Sep 17 00:00:00 2001 From: Jose Rodriguez Date: Mon, 1 Aug 2022 22:03:49 +0200 Subject: [PATCH] build: drop tox in favor of poe --- .flake8 | 17 +++++++ .github/workflows/python-app.yml | 21 ++++---- poetry.lock | 84 ++++++++++++++++++++++---------- pyproject.toml | 23 ++++++++- tox.ini | 48 ------------------ 5 files changed, 105 insertions(+), 88 deletions(-) create mode 100644 .flake8 delete mode 100644 tox.ini diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..8e30726e0 --- /dev/null +++ b/.flake8 @@ -0,0 +1,17 @@ +[flake8] +max-line-length = 120 +ignore = E722, E731, E741, W504, E203, W503 +exclude = + build/, + dist/, + .cache/, + .tox/, + benchmarks/, + examples/, + library/, + library-asm/, + src/parsetab/, + src/ply/, + scratch/, + venv/, + .git/ diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 7c2bf6961..b72718d38 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -9,6 +9,9 @@ on: pull_request: branches: [ master ] +env: + POETRY_VIRTUALENVS_CREATE: false + jobs: build: @@ -32,15 +35,9 @@ jobs: python -m pip install --upgrade pip pip install poetry poetry install - - name: Cache tox environments - id: cache-tox - uses: actions/cache@v2 - with: - path: .tox - # setup.cfg, pyproject.toml, and .pre-commit-config.yaml have - # versioning info that would impact the tox environment. hashFiles - # only takes a single file path or pattern at the moment. - key: ${{ runner.os }}-${{ matrix.python }}-tox-${{ hashFiles('setup.cfg') }}-${{ hashFiles('pyproject.toml') }} - - - name: Run Tox - run: poetry run tox -- --no-cov + + - name: Lint code + run: poe lint + + - name: Run tests + run: poe test diff --git a/poetry.lock b/poetry.lock index a3b8830a4..b60eebd17 100644 --- a/poetry.lock +++ b/poetry.lock @@ -77,6 +77,20 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +[[package]] +name = "coverage" +version = "6.4.2" +description = "Code coverage measurement for Python" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + +[package.extras] +toml = ["tomli"] + [[package]] name = "distlib" version = "0.3.4" @@ -261,6 +275,14 @@ python-versions = ">=3.6" [package.dependencies] pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" +[[package]] +name = "pastel" +version = "0.2.1" +description = "Bring colors to your terminal." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + [[package]] name = "pathspec" version = "0.9.0" @@ -293,6 +315,21 @@ python-versions = ">=3.6" dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "poethepoet" +version = "0.15.0" +description = "A task runner that works well with poetry." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +pastel = ">=0.2.1,<0.3.0" +tomli = ">=1.2.2" + +[package.extras] +poetry_plugin = ["poetry (>=1.0,<2.0)"] + [[package]] name = "pre-commit" version = "2.17.0" @@ -365,6 +402,21 @@ toml = "*" [package.extras] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] +[[package]] +name = "pytest-cov" +version = "3.0.0" +description = "Pytest plugin for measuring coverage." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["virtualenv", "pytest-xdist", "six", "process-tests", "hunter", "fields"] + [[package]] name = "pytest-timeout" version = "1.4.2" @@ -430,28 +482,6 @@ category = "dev" optional = false python-versions = ">=3.6" -[[package]] -name = "tox" -version = "3.24.5" -description = "tox is a generic virtualenv management and test command line tool" -category = "dev" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" - -[package.dependencies] -colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} -filelock = ">=3.0.0" -packaging = ">=14" -pluggy = ">=0.12.0" -py = ">=1.4.17" -six = ">=1.14.0" -toml = ">=0.9.4" -virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" - -[package.extras] -docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] -testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "psutil (>=5.6.1)", "pathlib2 (>=2.3.3)"] - [[package]] name = "typing-extensions" version = "4.0.1" @@ -504,7 +534,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "a7ee71d5890ac4ac694f555f84a0be2363168ed39df0e089fc5933a38109ab1f" +content-hash = "62ae07e021df088277125af7e504108bf9f96b042ed1749cd105ed87890e6d38" [metadata.files] atomicwrites = [ @@ -556,6 +586,7 @@ colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, ] +coverage = [] distlib = [ {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, @@ -672,6 +703,7 @@ packaging = [ {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, ] +pastel = [] pathspec = [ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, @@ -684,6 +716,7 @@ pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] +poethepoet = [] pre-commit = [ {file = "pre_commit-2.17.0-py2.py3-none-any.whl", hash = "sha256:725fa7459782d7bec5ead072810e47351de01709be838c2ce1726b9591dad616"}, {file = "pre_commit-2.17.0.tar.gz", hash = "sha256:c1a8040ff15ad3d648c70cc3e55b93e4d2d5b687320955505587fd79bbaed06a"}, @@ -708,6 +741,7 @@ pytest = [ {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, ] +pytest-cov = [] pytest-timeout = [ {file = "pytest-timeout-1.4.2.tar.gz", hash = "sha256:20b3113cf6e4e80ce2d403b6fb56e9e1b871b510259206d40ff8d609f48bda76"}, {file = "pytest_timeout-1.4.2-py2.py3-none-any.whl", hash = "sha256:541d7aa19b9a6b4e475c759fd6073ef43d7cdc9a92d95644c260076eb257a063"}, @@ -767,10 +801,6 @@ tomli = [ {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, ] -tox = [ - {file = "tox-3.24.5-py2.py3-none-any.whl", hash = "sha256:be3362472a33094bce26727f5f771ca0facf6dafa217f65875314e9a6600c95c"}, - {file = "tox-3.24.5.tar.gz", hash = "sha256:67e0e32c90e278251fea45b696d0fef3879089ccbe979b0c556d35d5a70e2993"}, -] typing-extensions = [ {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, diff --git a/pyproject.toml b/pyproject.toml index edba6d183..6dedf5016 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,6 @@ zxbpp = 'src.libzxbpp.zxbpp:entry_point' python = "^3.8" [tool.poetry.dev-dependencies] -tox = "^3.15.1" flake8 = "^3.8.2" pytest = "^6.2.5" pytest-timeout = "^1.3.4" @@ -52,6 +51,8 @@ bump2version = "^1.0.0" pre-commit = "^2.15.0" black = "^22.1.0" mkdocs = "^1.2.2" +poethepoet = "^0.15.0" +pytest-cov = "^3.0.0" [build-system] requires = ["poetry>=0.12"] @@ -60,3 +61,23 @@ build-backend = "poetry.masonry.api" [tool.black] line-length = 120 target-version = ['py38'] + +[tool.poe.tasks] +[[tool.poe.tasks.lint]] +help = "Check code style and typing..." +shell = """ + flake8 src tests && + black --check src tests + """ + +[[tool.poe.tasks.test]] +help = "Run tests" +shell = "pytest tests --color=yes" + +[[tool.poe.tasks.format]] +help = "Formats code" +shell = "black src tests" + +[tool.pytest.ini_options] +minversion = "6.0" +norecursedirs = ["test_*tmp", "runtime"] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index ab1277a5c..000000000 --- a/tox.ini +++ /dev/null @@ -1,48 +0,0 @@ -[tox] -envlist = lint,py38 - -[testenv] -setenv = LANG=en_US.UTF-8 -deps = - pytest - pytest-cov - pytest-timeout - -commands = - py.test {posargs: \ - --cov-report html:htmlcov/{envname} \ - --cov src } tests - -[flake8] -max-line-length = 120 -ignore = E722, E731, E741, W504, E203, W503 -exclude = - build/, - dist/, - .cache/, - .tox/, - benchmarks/, - examples/, - library/, - library-asm/, - src/parsetab/, - src/ply/, - scratch/, - venv/, - .git/ - -[testenv:lint] -deps = - flake8 - black - -commands = - flake8 - black src --check - -[travis] -python = - 3.8: py38, flake8 - -[pytest] -norecursedirs = test_*tmp runtime