Skip to content

Commit

Permalink
support Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Nov 16, 2021
1 parent 202b77a commit 8958ba0
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = E203, E266, E501, W503, E211, E731
max-line-length = 88
select = B,C,E,F,W,T4,B9
16 changes: 10 additions & 6 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:

tox:
Expand All @@ -16,7 +20,7 @@ jobs:
strategy:
matrix:
py-ver-major: [3]
py-ver-minor: [6, 7, 8, 9]
py-ver-minor: [6, 7, 8, 9, 10]
step: [lint, unit, mypy]

env:
Expand Down Expand Up @@ -54,7 +58,7 @@ jobs:

- name: Upload coverage to Codecov
if: ${{ matrix.step == 'unit' }}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2.1.0
with:
fail_ci_if_error: true

Expand All @@ -65,11 +69,11 @@ jobs:

strategy:
matrix:
step: [lint-readme, pydocstyle]
step: [lintreadme, pydocstyle]

env:
py-semver: 3.9
TOXENV: ${{ format('py39-{0}', matrix.step) }}
py-semver: "3.10"
TOXENV: ${{ format('py310-{0}', matrix.step) }}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -110,7 +114,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10" # quoted, otherwise that turns into the number 3.1

- name: Cache for pip
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include Makefile gittaggers.py test-requirements.txt mypy_requirements.txt requirements.txt
include Makefile gittaggers.py test-requirements.txt mypy-requirements.txt requirements.txt
include cwltest/cwltest-schema.yml
include cwltest/tests/*
include cwltest/tests/test-data/*
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PACKAGE=cwltest
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
DEVPKGS=diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
isort wheel autoflake flake8-bugbear pyupgrade bandit \
-rtest-requirements.txt -rmypy_requirements.txt
-rtest-requirements.txt -rmypy-requirements.txt
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
python-flake8 python-mock shellcheck
VERSION=2.2.$(shell TZ=UTC git log --first-parent --max-count=1 \
Expand Down
8 changes: 4 additions & 4 deletions cwltest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def check_keys(keys, expected, actual):
except CompareFail as e:
raise CompareFail.format(
expected, actual, f"field '{k}' failed comparison: {str(e)}"
)
) from e


def compare_file(expected, actual):
Expand Down Expand Up @@ -159,7 +159,7 @@ def compare_dict(expected, actual):
except CompareFail as e:
raise CompareFail.format(
expected, actual, f"failed comparison for key '{c}': {e}"
)
) from e
extra_keys = set(actual.keys()).difference(list(expected.keys()))
for k in extra_keys:
if actual[k] is not None:
Expand Down Expand Up @@ -194,13 +194,13 @@ def compare(expected, actual): # type: (Any, Any) -> None
try:
compare(expected[c], actual[c])
except CompareFail as e:
raise CompareFail.format(expected, actual, e)
raise CompareFail.format(expected, actual, e) from e
else:
if expected != actual:
raise CompareFail.format(expected, actual)

except Exception as e:
raise CompareFail(str(e))
raise CompareFail(str(e)) from e


def get_test_number_by_key(tests, key, value):
Expand Down
File renamed without changes.
16 changes: 9 additions & 7 deletions release-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export LC_ALL=C

package=cwltest
module=cwltest
extras=""

if [ "$GITHUB_ACTIONS" = "true" ]; then
# We are running as a GH Action
repo=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git
Expand All @@ -16,8 +18,8 @@ else
HEAD=$(git rev-parse HEAD)
fi
run_tests="bin/py.test --pyargs ${module}"
pipver=20.3b1 # minimum required version of pip for Python 3.9
setuptoolsver=41.1.0 # required for Python 3.9
pipver=20.3.3 # minimum required version of pip for Python 3.10
setuptoolsver=50.0.0 # required for Python 3.10
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

rm -Rf testenv? || /bin/true
Expand All @@ -33,7 +35,7 @@ then
rm -f testenv1/lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setuptoolsver} wheel
pip install -rtest-requirements.txt
pip install -rtest-requirements.txt ".${extras}"
make test
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir testenv1/not-${module}
Expand All @@ -59,7 +61,7 @@ rm -f lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setuptoolsver} wheel
# The following can fail if you haven't pushed your commits to ${repo}
pip install -e "git+${repo}@${HEAD}#egg=${package}"
pip install -e "git+${repo}@${HEAD}#egg=${package}${extras}"
pushd src/${package}
pip install -rtest-requirements.txt
make dist
Expand All @@ -83,13 +85,13 @@ rm -f lib/python-wheels/setuptools* \
&& pip install setuptools==${setuptoolsver} wheel
package_tar=$(find . -name "${package}*tar.gz")
pip install "-r${DIR}/test-requirements.txt"
pip install "${package_tar}"
pip install "${package_tar}${extras}"
mkdir out
tar --extract --directory=out -z -f ${package}*.tar.gz
pushd out/${package}*
make dist
make test
pip install "-r${DIR}/mypy_requirements.txt"
pip install "-r${DIR}/mypy-requirements.txt"
make mypy
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
mkdir ../not-${module}
Expand All @@ -107,7 +109,7 @@ source bin/activate
rm -f lib/python-wheels/setuptools* \
&& pip install --force-reinstall -U pip==${pipver} \
&& pip install setuptools==${setuptoolsver} wheel
pip install ${module}*.whl
pip install "$(ls ${module}*.whl)${extras}"
pip install "-r${DIR}/test-requirements.txt"
mkdir not-${module}
pushd not-${module}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Typing :: Typed",
],
)
64 changes: 36 additions & 28 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[tox]
envlist =
py{36,37,38,39}-lint,
py{36,37,38,39}-unit,
py{36,37,38,39}-bandit,
py{36,37,38,39}-mypy,
py{36,37,38,39,310}-lint,
py{36,37,38,39,310}-unit,
py{36,37,38,39,310}-bandit,
py{36,37,38,39,310}-mypy,
py39-pipconflictchecker,
py39-lint-readme,
py39-lintreadme,
py39-pydocstyle

skipsdist = True
skip_missing_interpreters = True

[pytest]
Expand All @@ -21,49 +20,56 @@ python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310

[testenv]
description =
py{36,37,38,39}-unit: Run the unit tests
py{36,37,38,39}-lint: Lint the Python code
py{36,37,38,39}-bandit: Search for common security issues
py{36,37,38,39}-mypy: Check for type safety
py{36,37,38,39,310}-unit: Run the unit tests
py{36,37,38,39,310}-lint: Lint the Python code
py{36,37,38,39,310}-bandit: Search for common security issues
py{36,37,38,39,310}-mypy: Check for type safety
py39-pydocstyle: docstring style checker
py39-lint-readme: Lint the README.rst->.md conversion
py39-lintreadme: Lint the README.rst->.md conversion

passenv =
CI
GITHUB_*
deps =
py{36,37,38,39}-{unit,lint,bandit,mypy}: -rrequirements.txt
py{36,37,38,39}-{unit,mypy}: -rtest-requirements.txt
py{36,37,38,39}-lint: flake8-bugbear
py{36,37,38,39}-lint: black
py{36,37,38,39}-bandit: bandit
py{36,37,38,39}-mypy: -rmypy_requirements.txt
py{36,37,38,39,310}-{unit,mypy}: -rrequirements.txt
py{36,37,38,39,310}-{unit,mypy}: -rtest-requirements.txt
py{36,37,38,39,310}-lint: flake8-bugbear
py{36,37,38,39,310}-lint: black
py{36,37,38,39,310}-bandit: bandit
py{36,37,38,39,310}-mypy: -rmypy-requirements.txt

setenv =
py{36,37,38,39}-unit: LC_ALL = C.UTF-8
py{36,37,38,39,310}-unit: LC_ALL = C.UTF-8

commands =
py{36,37,38,39}-unit: python -m pip install -U pip setuptools wheel
py{36,37,38,39}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
py{36,37,38,39}-bandit: bandit --recursive cwltest
py{36,37,38,39}-lint: make flake8
py{36,37,38,39}-lint: make format-check
py{36,37,38,39}-mypy: make mypy
py{36,37,38,39,310}-unit: python -m pip install -U pip setuptools wheel
py{36,37,38,39,310}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
py{36,37,38,39,310}-bandit: bandit --recursive cwltest --exclude cwltest/tests/*
py{36,37,38,39,310}-lint: make flake8
py{36,37,38,39,310}-lint: make format-check
py{36,37,38,39,310}-mypy: make mypy

whitelist_externals =
py{36,37,38,39}-lint: flake8
py{36,37,38,39}-lint: black
py{36,37,38,39}-{mypy,shellcheck,lint,unit}: make
py{36,37,38,39,310}-lint: flake8
py{36,37,38,39,310}-lint: black
py{36,37,38,39,310}-{mypy,shellcheck,lint,unit}: make

skip_install =
py{36,37,38,39,310}-lint: true
py{36,37,38,39,310}-bandit: true


[testenv:py39-pydocstyle]
whitelist_externals = make
commands = make diff_pydocstyle_report
deps =
pydocstyle
diff-cover
skip_install = true

[testenv:py39-pipconflictchecker]
commands = pipconflictchecker
Expand All @@ -72,7 +78,8 @@ deps =
pip-conflict-checker
pip==9.0.3

[testenv:py39-lint-readme]
[testenv:py39-lintreadme]
description = Lint the README.rst->.md conversion
commands =
python setup.py sdist
python setup.py bdist_wheel
Expand All @@ -81,3 +88,4 @@ deps =
twine
wheel
readme_renderer[md]
skip_install = true

0 comments on commit 8958ba0

Please sign in to comment.