From 52da5c4c6d5a7a48b83f29144e322ccf2d49eb9c Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Sun, 16 Jan 2022 20:51:00 -0800 Subject: [PATCH 1/5] The matrix already excludes Ubuntu/Python 3.8 --- .github/workflows/run_tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 2223f4b7f..3f0504803 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -58,9 +58,6 @@ jobs: python -m pip install flake8 flake8 --config=setup.cfg --count --show-source --statistics - - name: Test with tox (except Ubuntu/Python 3.8) - # not in love with the following syntax, but it works, - # whereas "! (condition)" does NOT - if: (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') == false + - name: Test with tox run: | tox -e py-cov From 8a11df39af3520ebf681b18ebb9b8b7ad4f3afbc Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Sun, 16 Jan 2022 22:07:45 -0800 Subject: [PATCH 2/5] Remove tox dependency --- .coveragerc | 3 - .github/workflows/run_tests.yml | 12 +++- README.md | 2 +- dev-requirements.txt | 1 - pytest.ini | 8 +++ setup.cfg | 1 - tox.ini | 108 -------------------------------- 7 files changed, 19 insertions(+), 116 deletions(-) create mode 100644 pytest.ini delete mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc index d2e14c523..ad51f9f8a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,9 +10,6 @@ source = psautohint [paths] source = python/psautohint - .tox/*/lib/python*/site-packages/psautohint - .tox/*/Lib/site-packages/psautohint - .tox/pypy*/site-packages/psautohint [report] # Regexes for lines to exclude from consideration diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 3f0504803..5a1135a56 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -58,6 +58,14 @@ jobs: python -m pip install flake8 flake8 --config=setup.cfg --count --show-source --statistics - - name: Test with tox + - name: Install psautohint run: | - tox -e py-cov + python -m pip install . + + - name: Test with pytest + run: | + python -m pytest + + - name: Uninstall psautohint + run: | + python -m pip uninstall psautohint -y diff --git a/README.md b/README.md index 1ca9e01ad..21582d5c4 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Testing We have a test suite that can be run with: - tox + pytest Debugging --------- diff --git a/dev-requirements.txt b/dev-requirements.txt index ff3b958d8..c87a8f502 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,3 @@ -tox<3.8 # pyup: ignore coverage>=5.0.1 pytest==6.2.5 pytest-cov==3.0.0 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 000000000..d88429380 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,8 @@ +[pytest] +norecursedirs = data +testpaths = tests +addopts = + -v + -r a + --exitfirst + -n auto diff --git a/setup.cfg b/setup.cfg index 33ebbc78d..d0dd80093 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,6 +11,5 @@ exclude = .eggs, .git, .pytest_cache, - .tox, build, dist, diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 0972f00f8..000000000 --- a/tox.ini +++ /dev/null @@ -1,108 +0,0 @@ -[tox] -envlist = py{37,38,39}-cov,coverage -minversion = 2.9.1 -skip_missing_interpreters = true - -[pytest] -norecursedirs = data -testpaths = tests -addopts = - -v - -r a - --exitfirst - -[testenv] -description = run the tests with pytest under {basepython} -setenv = - COVERAGE_FILE={toxinidir}/.coverage.{envname} -deps = - -rrequirements.txt - tx: afdko -extras = testing -commands = - nocov: pytest -n {env:PYTEST_NUM_PROCESSES:auto} {posargs} - cov: pytest --cov="{envsitepackagesdir}/psautohint" --cov-config={toxinidir}/.coveragerc -n {env:PYTEST_NUM_PROCESSES:auto} {posargs} - -[testenv:coverage] -description = run locally after tests to combine coverage data and create reports; - generates a diff coverage against origin/master (or DIFF_AGAINST env var) -deps = - coverage >= 5.0.1, < 5.1.0 - diff_cover -skip_install = true -setenv = - COVERAGE_FILE={toxinidir}/.coverage -passenv = - DIFF_AGAINST -changedir = {toxinidir} -commands = - coverage erase - coverage combine - coverage report - coverage xml -o {toxworkdir}/coverage.xml - coverage html - diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml - -[testenv:coverage-c] -description = generate coverage for C library -deps = - -rrequirements.txt - pytest >= 5.3.0, < 6.0.0 - pytest-xdist < 2.0.0 -skip_install = true -setenv = - CFLAGS = --coverage - BUILD_DIR = {envdir}/build - LIB_DIR = {env:BUILD_DIR}/lib - PYTHONPATH = {env:PYTHONPATH:}{:}{env:LIB_DIR} -passenv = TOXENV CI CODECOV_* -changedir = {toxinidir} -commands = - python setup.py build --build-base {env:BUILD_DIR} --build-platlib {env:LIB_DIR} - pytest -n {env:PYTEST_NUM_PROCESSES:auto} {posargs} - -[testenv:codecov] -description = upload Python coverage data to codecov (only run on CI) -deps = - {[testenv:coverage]deps} - codecov -skip_install = true -setenv = {[testenv:coverage]setenv} -passenv = TOXENV CI CODECOV_* -changedir = {toxinidir} -commands = - coverage combine - codecov --env TOXENV - -[testenv:coverage-codecov-c] -description = generate C coverage data and upload to codecov (only run on CI) -deps = - {[testenv:coverage-c]deps} - codecov -skip_install = true -setenv = {[testenv:coverage-c]setenv} -passenv = {[testenv:coverage-c]passenv} -changedir = {toxinidir} -commands = - {[testenv:coverage-c]commands} - codecov --env {envname} - -[testenv:sdist] -description = build sdist to be uploaded to PyPI -skip_install = true -deps = - coverage >= 5.0.1, < 5.1.0 - setuptools >= 36.4.0 - wheel >= 0.31.0 -changedir = {toxinidir} -commands = - python -c 'import shutil; shutil.rmtree("dist", ignore_errors=True)' - python setup.py sdist --dist-dir dist - -[testenv:wheel] -description = build wheel package for upload to PyPI -skip_install = true -deps = {[testenv:sdist]deps} -changedir = {toxinidir} -commands = - python setup.py clean -a bdist_wheel From 6c217267b130ec861736609e54ae2616ff318dc7 Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Sun, 16 Jan 2022 22:36:40 -0800 Subject: [PATCH 3/5] Enable Python 3.10 --- .github/workflows/build_wheels.yml | 2 +- .github/workflows/run_tests.yml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 6e08445d5..d38b0aab6 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -37,7 +37,7 @@ jobs: CIBW_ARCHS_WINDOWS: AMD64 CIBW_ARCHS_LINUX: x86_64 CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 - CIBW_SKIP: "cp36* cp310* *musllinux*" + CIBW_SKIP: "cp36* *musllinux*" CIBW_ENVIRONMENT: "CFLAGS='-g0'" - name: Build sdist (Ubuntu only) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 5a1135a56..b331d6965 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -22,16 +22,21 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9'] + python-version: ['3.7', '3.8', '3.9', '3.10'] exclude: - os: macos-latest python-version: '3.7' - os: macos-latest python-version: '3.8' + - os: macos-latest + python-version: '3.9' - os: windows-latest python-version: '3.7' - os: windows-latest python-version: '3.8' + - os: windows-latest + python-version: '3.9' + # The coverage workflow runs on the config below - os: ubuntu-latest python-version: '3.8' From 5e3533909b663636275f5f1de352672fc82bba09 Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Sun, 16 Jan 2022 23:14:39 -0800 Subject: [PATCH 4/5] Upgrade cibuildwheel to v2.3.1 --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index d38b0aab6..d8fdd992d 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -28,7 +28,7 @@ jobs: python-version: '3.8' - name: Build wheels - uses: pypa/cibuildwheel@v2.3.0 + uses: pypa/cibuildwheel@v2.3.1 with: output-dir: dist env: From 2fc5fe2e6a7d29a65c627df61ecec92e5d5bcf07 Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Mon, 17 Jan 2022 00:19:52 -0800 Subject: [PATCH 5/5] Build Python 3.10 wheels in a separate step This is to allow for building the Linux wheels with the more recent 'manylinux2010' image instead of the 'manylinux1' image. 'manylinux1' does not support CPython 3.10 https://github.com/pypa/manylinux/issues/994 List of manylinux images: https://github.com/pypa/manylinux#docker-images --- .github/workflows/build_wheels.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index d8fdd992d..2fc5c212f 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -27,17 +27,30 @@ jobs: with: python-version: '3.8' - - name: Build wheels + - name: Build wheels (Python 3.7 through 3.9) uses: pypa/cibuildwheel@v2.3.1 with: output-dir: dist env: - CIBW_BUILD: "cp3*" + CIBW_BUILD: "cp37* cp38* cp39*" CIBW_ARCHS_MACOS: x86_64 arm64 CIBW_ARCHS_WINDOWS: AMD64 CIBW_ARCHS_LINUX: x86_64 CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 - CIBW_SKIP: "cp36* *musllinux*" + CIBW_SKIP: "*musllinux*" + CIBW_ENVIRONMENT: "CFLAGS='-g0'" + + - name: Build wheels (Python 3.10 only) + uses: pypa/cibuildwheel@v2.3.1 + with: + output-dir: dist + env: + CIBW_BUILD: "cp310*" + CIBW_ARCHS_MACOS: x86_64 arm64 + CIBW_ARCHS_WINDOWS: AMD64 + CIBW_ARCHS_LINUX: x86_64 + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 + CIBW_SKIP: "*musllinux*" CIBW_ENVIRONMENT: "CFLAGS='-g0'" - name: Build sdist (Ubuntu only)