diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 3e15e8e1e..9e05e5c54 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -88,8 +88,8 @@ jobs: step: [lintreadme, shellcheck, 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 @@ -171,7 +171,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: Give the test runner user a name to make provenance happy. run: sudo usermod -c 'CI Runner' $(whoami) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2ea912a7b..128ec980f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,7 +9,7 @@ on: - cron: '0 10 * * 2' concurrency: - group: build-${{ github.event.pull_request.number || github.ref }} + group: codeql-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: diff --git a/Makefile b/Makefile index 5f94311cc..e5daea9ad 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ MODULE=cwltool 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 diff --git a/cwltool.Dockerfile b/cwltool.Dockerfile index c17b6321f..69b11daef 100644 --- a/cwltool.Dockerfile +++ b/cwltool.Dockerfile @@ -5,7 +5,7 @@ RUN apk add --no-cache git gcc python3-dev libxml2-dev libxslt-dev libc-dev linu WORKDIR /cwltool COPY . . -RUN pip install toml -rmypy_requirements.txt "$(grep ruamel requirements.txt)" \ +RUN pip install toml -rmypy-requirements.txt "$(grep ruamel requirements.txt)" \ "$(grep schema.salad requirements.txt)" # schema-salad is needed to be installed (this time as pure Python) for # cwltool + mypyc diff --git a/cwltool/provenance_profile.py b/cwltool/provenance_profile.py index 39969fff7..025f5581d 100644 --- a/cwltool/provenance_profile.py +++ b/cwltool/provenance_profile.py @@ -45,13 +45,7 @@ WFPROV, ) from .stdfsaccess import StdFsAccess -from .utils import ( - CWLObjectType, - JobsType, - get_listing, - posix_path, - versionstring, -) +from .utils import CWLObjectType, JobsType, get_listing, posix_path, versionstring from .workflow_job import WorkflowJob if TYPE_CHECKING: 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 2fb42b3e0..2ef2fda50 100755 --- a/release-test.sh +++ b/release-test.sh @@ -7,6 +7,7 @@ export LC_ALL=C package=cwltool module=cwltool +extras="[deps]" if [ "$GITHUB_ACTIONS" = "true" ]; then # We are running as a GH Action @@ -24,7 +25,7 @@ run_tests() { "${test_prefix}"bin/py.test "--ignore=${mod_loc}/schemas/" \ --pyargs -x ${module} -n auto --dist=loadfile } -pipver=20.3 # minimum required version of pip for Python 3.10 +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 )" @@ -41,8 +42,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 -e . + pip install -rtest-requirements.txt ".${extras}" make test pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install mkdir testenv1/not-${module} @@ -67,7 +67,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 @@ -90,12 +90,14 @@ 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" +make mypy pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install mkdir ../not-${module} pushd ../not-${module} diff --git a/tests/test_trs.py b/tests/test_trs.py index acfee2f4c..52cd46a22 100644 --- a/tests/test_trs.py +++ b/tests/test_trs.py @@ -2,6 +2,7 @@ from unittest import mock from unittest.mock import MagicMock +from cwltool.loghandler import _logger from cwltool.main import main from .util import get_data @@ -21,8 +22,7 @@ def json(self) -> Any: return self.json_data -def mocked_requests_head(*args: Any) -> MockResponse1: - +def mocked_requests_head(*args: Any, **kwargs: Any) -> MockResponse1: return MockResponse1(None, 200) @@ -87,14 +87,18 @@ def mocked_requests_get(*args: Any, **kwargs: Any) -> MockResponse2: 200, ) - print("A mocked call to TRS missed, target was %s", args[0]) + _logger.debug("A mocked call to TRS missed, target was %s", args[0]) return MockResponse2(None, 404) @mock.patch("requests.Session.head", side_effect=mocked_requests_head) @mock.patch("requests.Session.get", side_effect=mocked_requests_get) def test_tool_trs_template(mock_head: MagicMock, mock_get: MagicMock) -> None: - params = ["--make-template", r"quay.io/briandoconnor/dockstore-tool-md5sum:1.0.4"] + params = [ + "--debug", + "--make-template", + r"quay.io/briandoconnor/dockstore-tool-md5sum:1.0.4", + ] return_value = main(params) mock_head.assert_called() mock_get.assert_called() @@ -105,6 +109,7 @@ def test_tool_trs_template(mock_head: MagicMock, mock_get: MagicMock) -> None: @mock.patch("requests.Session.get", side_effect=mocked_requests_get) def test_workflow_trs_template(mock_head: MagicMock, mock_get: MagicMock) -> None: params = [ + "--debug", "--make-template", r"#workflow/github.com/dockstore-testing/md5sum-checker:develop", ] diff --git a/tox.ini b/tox.ini index 4876e7fad..64121eeda 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,7 @@ deps = py3{6,7,8,9,10}-lint: black py3{6,7,8,9,10}-bandit: bandit py3{6,7,8,9,10}-bandit: importlib_metadata != 4.8.0 - py3{6,7,8,9,10}-mypy: -rmypy_requirements.txt + py3{6,7,8,9,10}-mypy: -rmypy-requirements.txt py39-pydocstyle: pydocstyle py39-pydocstyle: diff-cover py39-lintreadme: twine