diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..35967ff --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +ignore = E203, E266, E501, W503, E211, E731 +max-line-length = 88 +select = B,C,E,F,W,T4,B9 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index cf34d1d..573fb61 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -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: @@ -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: @@ -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 @@ -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 @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in index 6e775fd..74643c8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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/* diff --git a/Makefile b/Makefile index abda48e..ea7110e 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/cwltest/utils.py b/cwltest/utils.py index 984d8a8..50e1cb5 100644 --- a/cwltest/utils.py +++ b/cwltest/utils.py @@ -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): @@ -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: @@ -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): diff --git a/mypy_requirements.txt b/mypy-requirements.txt similarity index 100% rename from mypy_requirements.txt rename to mypy-requirements.txt diff --git a/release-test.sh b/release-test.sh index dcb6d90..e840392 100755 --- a/release-test.sh +++ b/release-test.sh @@ -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 @@ -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 @@ -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} @@ -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 @@ -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} @@ -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} diff --git a/setup.py b/setup.py index bb098fb..9c1d31b 100644 --- a/setup.py +++ b/setup.py @@ -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", ], ) diff --git a/tox.ini b/tox.ini index 52e21a3..82b219b 100644 --- a/tox.ini +++ b/tox.ini @@ -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] @@ -21,42 +20,48 @@ 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 @@ -64,6 +69,7 @@ commands = make diff_pydocstyle_report deps = pydocstyle diff-cover +skip_install = true [testenv:py39-pipconflictchecker] commands = pipconflictchecker @@ -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 @@ -81,3 +88,4 @@ deps = twine wheel readme_renderer[md] +skip_install = true