From b1c09f6d1c3316a3f725fadf803a8e974df07c19 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 09:05:05 -0500 Subject: [PATCH 01/34] minimal gha This is just to confirm it is running before adding lots of config (presumably with errors...). --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..01f7f5f5c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: + - dev + - master + tags: + - v* + pull_request: + branches: + - "*" + schedule: + # Daily at 05:14 + - cron: '14 5 * * *' + +jobs: + all: + name: All + runs-on: ubuntu-latest + steps: + - name: This + shell: python + run: | + import this From d923e218b7d44e4e9869ee5c2706e98c2ca4a5a8 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 09:14:06 -0500 Subject: [PATCH 02/34] add in actual testing --- .github/workflows/ci.yml | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01f7f5f5c..12be8bc33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,111 @@ on: - cron: '14 5 * * *' jobs: + test: + # Should match JOB_NAME below + name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + runs-on: ${{ matrix.os.runs-on }} + container: ${{ matrix.os.container[matrix.python.docker] }} + strategy: + fail-fast: false + matrix: + task: + - name: Test + tox: test + coverage: true + os: + - name: Linux + runs-on: ubuntu-latest + python_platform: linux + matrix: linux + container: + 2.7: docker://python:2.7-buster + 3.6: docker://python:3.6-buster + 3.7: docker://python:3.7-buster + 3.8: docker://python:3.8-buster + 3.9: docker://python:3.9-buster + pypy2: docker://pypy:2-jessie + pypy3: docker://pypy:3-stretch + - name: Windows + runs-on: windows-latest + python_platform: win32 + matrix: windows + - name: macOS + runs-on: macos-latest + python_platform: darwin + matrix: macos + python: + - name: CPython 3.6 + tox: py36 + action: 3.6 + docker: 3.6 + - name: CPython 3.7 + tox: py37 + action: 3.7 + docker: 3.7 + - name: CPython 3.8 + tox: py38 + action: 3.8 + docker: 3.8 +# - name: CPython 3.9 +# tox: py39 +# action: 3.9 +# docker: 3.9 + arch: + - name: x86 + action: x86 + matrix: x86 + - name: x64 + action: x64 + matrix: x64 + exclude: + - os: + matrix: linux + arch: + matrix: x86 + - os: + matrix: macos + arch: + matrix: x86 + env: + # Should match name above + JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up ${{ matrix.python.name }} + if: job.container == '' + uses: actions/setup-python@v2 + with: + python-version: '${{ matrix.python.action }}.0-alpha - ${{ matrix.python.action }}.X' + architecture: '${{ matrix.arch.action }}' + - name: Install + run: | + pip install --upgrade pip setuptools wheel + pip install --upgrade tox coveralls + - uses: twisted/python-info-action@v1.0.1 + - name: Test + run: | + tox -vv -e ${{ matrix.python.tox }} + - name: Coverage Processing + if: matrix.task.coverage + run: | + mkdir coverage_reports + cp .coverage "coverage_reports/coverage.${{ env.JOB_NAME }}" + cp coverage.xml "coverage_reports/coverage.${{ env.JOB_NAME }}.xml" + coveralls + - name: Publish Coverage + if: matrix.task.coverage + uses: actions/upload-artifact@v2 + with: + name: coverage + path: coverage_reports/* all: name: All runs-on: ubuntu-latest + needs: + - test steps: - name: This shell: python From 9dddf845826791d2c7d7e45ca9456467eadb94bc Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 09:25:41 -0500 Subject: [PATCH 03/34] misc --- .github/workflows/ci.yml | 24 ++++++++++++++++++++---- tox.ini | 6 ++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12be8bc33..7823e2371 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,10 @@ jobs: python_platform: darwin matrix: macos python: + - name: CPython 2.7 + tox: py27 + action: 2.7 + docker: 2.7 - name: CPython 3.6 tox: py36 action: 3.6 @@ -61,10 +65,22 @@ jobs: tox: py38 action: 3.8 docker: 3.8 -# - name: CPython 3.9 -# tox: py39 -# action: 3.9 -# docker: 3.9 + - name: CPython 3.9 + tox: py39 + action: 3.9 + docker: 3.9 + - name: PyPy 2.7 + tox: pypy27 + action: pypy-2.7 + docker: pypy2.7 + - name: PyPy 3.6 + tox: pypy36 + action: pypy-3.6 + docker: pypy3.6 + - name: PyPy 3.7 + tox: pypy37 + action: pypy-3.7 + docker: pypy3.7 arch: - name: x86 action: x86 diff --git a/tox.ini b/tox.ini index 909d6a74d..247cde1f5 100644 --- a/tox.ini +++ b/tox.ini @@ -4,11 +4,13 @@ # directory. [tox] -envlist = py27, py35, py36, py37, pypy +envlist = py{27,py27,36,37,38,py36,py37} [testenv] deps = -r requirements-tests.txt -commands = py.test {posargs} +commands = + py{27,py27}: py.test {posargs} + py{36,37,38,py36,py37}: py.test {posargs} test/test_server_asyncio.py test setenv = with_gmp=no [flake8] From a66951091f57af191efb36d7562540ac68aa0cce Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 09:45:05 -0500 Subject: [PATCH 04/34] actually use coverage in tox --- tox.ini | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 247cde1f5..44d52f11e 100644 --- a/tox.ini +++ b/tox.ini @@ -9,9 +9,10 @@ envlist = py{27,py27,36,37,38,py36,py37} [testenv] deps = -r requirements-tests.txt commands = - py{27,py27}: py.test {posargs} - py{36,37,38,py36,py37}: py.test {posargs} test/test_server_asyncio.py test -setenv = with_gmp=no + pytest {posargs:--cov=pymodbus/ --cov-report term-missing {env:PYTEST_PY3_ARGS}} +setenv = + with_gmp=no + py{36,37,38,py36,py37}: PYTEST_PY3_ARGS = test/test_server_asyncio.py test [flake8] exclude = .tox From 6f114d0baf3895e3319b8a4b12f70997d2a8ff4b Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 09:47:34 -0500 Subject: [PATCH 05/34] coverage xml --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 44d52f11e..9a965648b 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ envlist = py{27,py27,36,37,38,py36,py37} deps = -r requirements-tests.txt commands = pytest {posargs:--cov=pymodbus/ --cov-report term-missing {env:PYTEST_PY3_ARGS}} + coverage xml setenv = with_gmp=no py{36,37,38,py36,py37}: PYTEST_PY3_ARGS = test/test_server_asyncio.py test From e09746ce7e656a745fec0e26622e22d02decb4cb Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:00:11 -0500 Subject: [PATCH 06/34] skip coveralls upload for now --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7823e2371..7be0d2c13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,8 @@ jobs: mkdir coverage_reports cp .coverage "coverage_reports/coverage.${{ env.JOB_NAME }}" cp coverage.xml "coverage_reports/coverage.${{ env.JOB_NAME }}.xml" - coveralls +# TODO: deal with the classic secrets and forked PRs issue... +# coveralls - name: Publish Coverage if: matrix.task.coverage uses: actions/upload-artifact@v2 From 1117b1b03f6a5cbe353b3ef27bd5f5acc0ebc50b Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:01:09 -0500 Subject: [PATCH 07/34] remove travis to avoid continued spamming with pointless builds --- .travis.yml | 35 ----------------------------------- scripts/travis.sh | 11 ----------- 2 files changed, 46 deletions(-) delete mode 100644 .travis.yml delete mode 100755 scripts/travis.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ae4bc08e5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -sudo: false -language: python -matrix: - include: - - os: linux - python: "2.7" - - os: linux - python: "3.6" - - os: linux - python: "3.7" - - os: linux - python: "3.8" - - os: osx - osx_image: xcode8.3 - language: generic -before_install: - - if [ $TRAVIS_OS_NAME = osx ]; then brew update; fi - - if [ $TRAVIS_OS_NAME = osx ]; then brew install openssl; fi -# - if [$TRAVIS_OS_NAME = osx ]; then python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"; fi - -install: -# - scripts/travis.sh pip install pip-accel - - if [ $TRAVIS_OS_NAME = osx ]; then scripts/travis.sh pip install -U "\"setuptools<45"\"; else pip install -U setuptools --upgrade ; fi - - scripts/travis.sh pip install coveralls - - scripts/travis.sh pip install --requirement=requirements-checks.txt - - scripts/travis.sh pip install --requirement=requirements-tests.txt - - scripts/travis.sh LC_ALL=C pip install . -script: -# - scripts/travis.sh make check - - scripts/travis.sh make test -after_success: - - scripts/travis.sh coveralls -branches: - except: - - /^[0-9]/ diff --git a/scripts/travis.sh b/scripts/travis.sh deleted file mode 100755 index 8f4338270..000000000 --- a/scripts/travis.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -e -set -x -if [ "$TRAVIS_OS_NAME" = osx ]; then - VIRTUAL_ENV="$HOME/.virtualenvs/python2.7" - if [ ! -x "$VIRTUAL_ENV/bin/python" ]; then - virtualenv "$VIRTUAL_ENV" - fi - source "$VIRTUAL_ENV/bin/activate" -fi - -eval "$@" From d75533255e9bada24caf98e08efc726976e8ccc9 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:31:44 -0500 Subject: [PATCH 08/34] adjust py2 exclusions --- test/conftest.py | 13 ++++++++++--- tox.ini | 7 ++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 748fd4b7a..c8e3a2df7 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,3 +1,10 @@ -from pymodbus.compat import IS_PYTHON3, PYTHON_VERSION -if not IS_PYTHON3 or IS_PYTHON3 and PYTHON_VERSION.minor < 7: - collect_ignore = ["test_server_asyncio.py"] +from pymodbus.compat import PYTHON_VERSION + +if PYTHON_VERSION < (3,): + collect_ignore = [ + # TODO: do these really need to be ignored on py2 or can they just get + # super() etc fixed? + "test_client_async.py", + "test_client_async_tornado.py", + "test_server_asyncio.py", + ] diff --git a/tox.ini b/tox.ini index 9a965648b..c5238f7bd 100644 --- a/tox.ini +++ b/tox.ini @@ -9,11 +9,12 @@ envlist = py{27,py27,36,37,38,py36,py37} [testenv] deps = -r requirements-tests.txt commands = - pytest {posargs:--cov=pymodbus/ --cov-report term-missing {env:PYTEST_PY3_ARGS}} - coverage xml + pytest {posargs:--cov=pymodbus/ --cov-report term-missing} + # TODO: do this unconditionally once i figure out the exclusion of + # async/await files in py2 + py{36,37,38,py36,py37}: coverage xml setenv = with_gmp=no - py{36,37,38,py36,py37}: PYTEST_PY3_ARGS = test/test_server_asyncio.py test [flake8] exclude = .tox From a0fb7f9576292f3bd69766b7439d1bfb415bcc2d Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:38:53 -0500 Subject: [PATCH 09/34] coverage xml --ignore-errors --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index c5238f7bd..1ec82ddc1 100644 --- a/tox.ini +++ b/tox.ini @@ -10,9 +10,7 @@ envlist = py{27,py27,36,37,38,py36,py37} deps = -r requirements-tests.txt commands = pytest {posargs:--cov=pymodbus/ --cov-report term-missing} - # TODO: do this unconditionally once i figure out the exclusion of - # async/await files in py2 - py{36,37,38,py36,py37}: coverage xml + coverage xml --ignore-errors setenv = with_gmp=no From e52dfa274e46fc07360280fdf4af9c91aac4c59f Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:43:28 -0500 Subject: [PATCH 10/34] fix python action for pypy --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7be0d2c13..8c3385ddc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,12 +104,18 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up ${{ matrix.python.name }} - if: job.container == '' + - name: Set up ${{ matrix.python.name }} (if CPython) + if: ${{ job.container == '' && matrix.python.implementation == 'cpython'}} uses: actions/setup-python@v2 with: python-version: '${{ matrix.python.action }}.0-alpha - ${{ matrix.python.action }}.X' architecture: '${{ matrix.arch.action }}' + - name: Set up ${{ matrix.python.name }} (if PyPy) + if: ${{ job.container == '' && matrix.python.implementation == 'pypy'}} + uses: actions/setup-python@v2 + with: + python-version: '${{ matrix.python.action }}' + architecture: '${{ matrix.arch.action }}' - name: Install run: | pip install --upgrade pip setuptools wheel From 612dbfb8aff6e43ed37f5e7b58a816680a01742f Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:45:54 -0500 Subject: [PATCH 11/34] add matrix.python.implementation --- .github/workflows/ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c3385ddc..c4cddd8be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,34 +53,42 @@ jobs: tox: py27 action: 2.7 docker: 2.7 + implementation: cpython + - name: PyPy 2.7 + tox: pypy27 + action: pypy-2.7 + docker: pypy2.7 + implementation: pypy - name: CPython 3.6 tox: py36 action: 3.6 docker: 3.6 + implementation: cpython - name: CPython 3.7 tox: py37 action: 3.7 docker: 3.7 + implementation: cpython - name: CPython 3.8 tox: py38 action: 3.8 docker: 3.8 + implementation: cpython - name: CPython 3.9 tox: py39 action: 3.9 docker: 3.9 - - name: PyPy 2.7 - tox: pypy27 - action: pypy-2.7 - docker: pypy2.7 + implementation: cpython - name: PyPy 3.6 tox: pypy36 action: pypy-3.6 docker: pypy3.6 + implementation: pypy - name: PyPy 3.7 tox: pypy37 action: pypy-3.7 docker: pypy3.7 + implementation: pypy arch: - name: x86 action: x86 From f62b12d13c4a5efa07a3062e0929cf28b4427f64 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 10:54:19 -0500 Subject: [PATCH 12/34] use twisted's serial extra --- requirements-tests.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index eba656a38..b7d4bb23c 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -14,6 +14,6 @@ sqlalchemy>=1.1.15 #wsgiref>=0.1.2 verboselogs >= 1.5 tornado==4.5.3 -Twisted>=20.3.0 +Twisted[serial]>=20.3.0 zope.interface>=4.4.0 asynctest>=0.10.0 diff --git a/setup.py b/setup.py index 60e7c4eef..20b210c05 100644 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ 'sphinx_rtd_theme', 'humanfriendly'], 'twisted': [ - 'twisted >= 20.3.0', + 'twisted[serial] >= 20.3.0', 'pyasn1 >= 0.1.4', ], 'tornado': [ From f599c3b3a7e71cbe2eeca6f2615c8c9f1db3db7e Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 11:42:24 -0500 Subject: [PATCH 13/34] pytest-cov for xml --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 1ec82ddc1..b0fb1fd25 100644 --- a/tox.ini +++ b/tox.ini @@ -9,8 +9,7 @@ envlist = py{27,py27,36,37,38,py36,py37} [testenv] deps = -r requirements-tests.txt commands = - pytest {posargs:--cov=pymodbus/ --cov-report term-missing} - coverage xml --ignore-errors + pytest {posargs:--cov=pymodbus/ --cov-report=term-missing --cov-report=xml} setenv = with_gmp=no From d64ec353be873955f2b21f23e9ae0615fc0e6e6c Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 14:28:04 -0500 Subject: [PATCH 14/34] exclude windows and macos They can be enabled in separate PRs that fix their issues. --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4cddd8be..fd0ed6107 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,14 +40,14 @@ jobs: 3.9: docker://python:3.9-buster pypy2: docker://pypy:2-jessie pypy3: docker://pypy:3-stretch - - name: Windows - runs-on: windows-latest - python_platform: win32 - matrix: windows - - name: macOS - runs-on: macos-latest - python_platform: darwin - matrix: macos +# - name: Windows +# runs-on: windows-latest +# python_platform: win32 +# matrix: windows +# - name: macOS +# runs-on: macos-latest +# python_platform: darwin +# matrix: macos python: - name: CPython 2.7 tox: py27 From 36dba19452704344907f42ce1ecc2bb3baf522ba Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 14:42:30 -0500 Subject: [PATCH 15/34] Fixup test_client_async[_tornado].py for py2 testing --- pymodbus/client/asynchronous/tornado/__init__.py | 2 +- test/conftest.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pymodbus/client/asynchronous/tornado/__init__.py b/pymodbus/client/asynchronous/tornado/__init__.py index 29e0e4db2..bbf9585ed 100644 --- a/pymodbus/client/asynchronous/tornado/__init__.py +++ b/pymodbus/client/asynchronous/tornado/__init__.py @@ -315,7 +315,7 @@ def __init__(self, *args, **kwargs): self.silent_interval = 3.5 * self._t0 self.silent_interval = round(self.silent_interval, 6) self.last_frame_end = 0.0 - super().__init__(*args, **kwargs) + super(AsyncModbusSerialClient, self).__init__(*args, **kwargs) def get_socket(self): """ diff --git a/test/conftest.py b/test/conftest.py index c8e3a2df7..861074ca3 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,10 +1,8 @@ from pymodbus.compat import PYTHON_VERSION if PYTHON_VERSION < (3,): + # These files use syntax introduced in Python 3 (not necessarily 3.0) and + # just won't be run during tests in Python 2. collect_ignore = [ - # TODO: do these really need to be ignored on py2 or can they just get - # super() etc fixed? - "test_client_async.py", - "test_client_async_tornado.py", "test_server_asyncio.py", ] From b12dd6a0b61f01f54ba2c9f8b1ae9e541c1c3d98 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 14:44:12 -0500 Subject: [PATCH 16/34] add cpython39 to tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index b0fb1fd25..64a3721fe 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # directory. [tox] -envlist = py{27,py27,36,37,38,py36,py37} +envlist = py{27,py27,36,37,38,39,py36,py37} [testenv] deps = -r requirements-tests.txt From 9a98534334f8565ac12194392b475cdbaec54d98 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 15:50:11 -0500 Subject: [PATCH 17/34] preliminary addition of checks --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++++++++++- tox.ini | 13 +++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd0ed6107..ed4fdab00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,6 @@ jobs: task: - name: Test tox: test - coverage: true os: - name: Linux runs-on: ubuntu-latest @@ -146,11 +145,57 @@ jobs: with: name: coverage path: coverage_reports/* + check: + # Should match JOB_NAME below + name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + runs-on: ${{ matrix.os.runs-on }} + container: ${{ matrix.os.container[matrix.python.docker] }} + strategy: + fail-fast: false + matrix: + task: + - name: flake8 + tox: flake8 + - name: Docs + tox: docs + os: + - name: Linux + runs-on: ubuntu-latest + python_platform: linux + matrix: linux + container: + 3.8: docker://python:3.8-buster + python: + - name: CPython 3.8 + tox: py38 + action: 3.8 + docker: 3.8 + implementation: cpython + arch: + - name: x64 + action: x64 + matrix: x64 + env: + # Should match name above + JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install + run: | + pip install --upgrade pip setuptools wheel + pip install --upgrade tox + - uses: twisted/python-info-action@v1.0.1 + - name: Test + run: | + tox -vv -e ${{ matrix.task.tox }} all: name: All runs-on: ubuntu-latest needs: - test + - check steps: - name: This shell: python diff --git a/tox.ini b/tox.ini index 64a3721fe..c09224bc3 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,19 @@ commands = setenv = with_gmp=no +[testenv:flake8] +deps = -r requirements-checks.txt +commands = + flake8 + +[testenv:docs] +allowlist_externals = + make +deps = -r requirements-docs.txt +commands = + make -C doc/ clean + make -C doc/ html + [flake8] exclude = .tox ignore = D211,D400,E731 From 9615b68a1ef99c356e3ef94e836eb0e8e759320e Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sat, 16 Jan 2021 16:07:30 -0500 Subject: [PATCH 18/34] switch to the maintained m2r2 fork --- doc/conf.py | 2 +- requirements-docs.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 294b41b79..4f0dc4122 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -47,7 +47,7 @@ # ones. #extensions = ['sphinx.ext.autodoc', 'm2r', 'recommonmark'] -extensions = ['sphinx.ext.autodoc', 'm2r'] +extensions = ['sphinx.ext.autodoc', 'm2r2'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/requirements-docs.txt b/requirements-docs.txt index f1165c9c6..b0a4d2416 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -13,5 +13,5 @@ tornado>=4.5.3 # Required to parse some files Twisted>=17.1.0 # Required to parse some files prompt_toolkit>=2.0.4 click>=7.0 -m2r>=0.2.0 +m2r2>=0.2.0 From 5faa8fe3eb346b2e50b4b9d13482bcb899f9ba2b Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 17 Jan 2021 09:35:01 -0500 Subject: [PATCH 19/34] python3.7 for checks flake8 supposedly works better here --- .github/workflows/ci.yml | 8 ++++---- tox.ini | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed4fdab00..9cac6ebb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,10 +166,10 @@ jobs: container: 3.8: docker://python:3.8-buster python: - - name: CPython 3.8 - tox: py38 - action: 3.8 - docker: 3.8 + - name: CPython 3.7 + tox: py37 + action: 3.7 + docker: 3.7 implementation: cpython arch: - name: x64 diff --git a/tox.ini b/tox.ini index c09224bc3..00ee19b88 100644 --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,7 @@ setenv = with_gmp=no [testenv:flake8] +basepython = python3.7 deps = -r requirements-checks.txt commands = flake8 From 5fe4e4a500204d71255615e6ea2b6340ea8733bb Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 17 Jan 2021 09:42:32 -0500 Subject: [PATCH 20/34] a bit more for flake8 --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cac6ebb6..c05ce93dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,13 +164,20 @@ jobs: python_platform: linux matrix: linux container: + 3.7: docker://python:3.7-buster 3.8: docker://python:3.8-buster python: + # Using 3.7 for now since flake8 is super noisy with 3.8 - name: CPython 3.7 tox: py37 action: 3.7 docker: 3.7 implementation: cpython +# - name: CPython 3.8 +# tox: py38 +# action: 3.8 +# docker: 3.8 +# implementation: cpython arch: - name: x64 action: x64 From 26c0f1693a3aa7dc9d5aee4b40de1e1c475cda33 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 17 Jan 2021 10:26:18 -0500 Subject: [PATCH 21/34] back to 3.8 for checks and continue on error for flake8 --- .github/workflows/ci.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c05ce93dc..64f2410a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,6 +156,7 @@ jobs: task: - name: flake8 tox: flake8 + continue_on_error: true - name: Docs tox: docs os: @@ -164,20 +165,13 @@ jobs: python_platform: linux matrix: linux container: - 3.7: docker://python:3.7-buster 3.8: docker://python:3.8-buster python: - # Using 3.7 for now since flake8 is super noisy with 3.8 - - name: CPython 3.7 - tox: py37 - action: 3.7 - docker: 3.7 + - name: CPython 3.8 + tox: py38 + action: 3.8 + docker: 3.8 implementation: cpython -# - name: CPython 3.8 -# tox: py38 -# action: 3.8 -# docker: 3.8 -# implementation: cpython arch: - name: x64 action: x64 @@ -195,6 +189,7 @@ jobs: pip install --upgrade tox - uses: twisted/python-info-action@v1.0.1 - name: Test + continue-on-error: matrix.task.continue_on_error run: | tox -vv -e ${{ matrix.task.tox }} all: From b490edbacfa3f108e127c0b0da6d4f6a9820d870 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 17 Jan 2021 10:29:05 -0500 Subject: [PATCH 22/34] ${{ }} --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64f2410a8..70646e3fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -189,7 +189,7 @@ jobs: pip install --upgrade tox - uses: twisted/python-info-action@v1.0.1 - name: Test - continue-on-error: matrix.task.continue_on_error + continue-on-error: ${{ matrix.task.continue_on_error }} run: | tox -vv -e ${{ matrix.task.tox }} all: From 42a93ccb8d2ec2ef00409a06696bbfe81a275f1e Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 09:26:25 -0500 Subject: [PATCH 23/34] remove coveralls for now --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70646e3fe..3f1d12d10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,7 @@ jobs: - name: Install run: | pip install --upgrade pip setuptools wheel - pip install --upgrade tox coveralls + pip install --upgrade tox - uses: twisted/python-info-action@v1.0.1 - name: Test run: | @@ -137,8 +137,6 @@ jobs: mkdir coverage_reports cp .coverage "coverage_reports/coverage.${{ env.JOB_NAME }}" cp coverage.xml "coverage_reports/coverage.${{ env.JOB_NAME }}.xml" -# TODO: deal with the classic secrets and forked PRs issue... -# coveralls - name: Publish Coverage if: matrix.task.coverage uses: actions/upload-artifact@v2 From 35e1468949e74dad4480ad7847b63723f2136e4d Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 09:27:27 -0500 Subject: [PATCH 24/34] touchup conftest.py --- test/conftest.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 861074ca3..55e688160 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,8 +1,5 @@ from pymodbus.compat import PYTHON_VERSION - if PYTHON_VERSION < (3,): - # These files use syntax introduced in Python 3 (not necessarily 3.0) and - # just won't be run during tests in Python 2. - collect_ignore = [ - "test_server_asyncio.py", - ] + # These files use syntax introduced between Python 2 and our lowest + # supported Python 3 version. We just won't run these tests in Python 2. + collect_ignore = ["test_server_asyncio.py"] From 50c723aace6df92a0adf13d522795881377f75be Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 09:33:51 -0500 Subject: [PATCH 25/34] drop basepython for flake8 environment --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 00ee19b88..c09224bc3 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,6 @@ setenv = with_gmp=no [testenv:flake8] -basepython = python3.7 deps = -r requirements-checks.txt commands = flake8 From 4f7413d8c2522b3d4f07e9523b0b72be5582f019 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 10:04:06 -0500 Subject: [PATCH 26/34] intra-gha combined coverage --- .github/workflows/ci.yml | 58 +++++++++++++++++++++++++++++++++++++-- requirements-coverage.txt | 1 + requirements-tests.txt | 2 +- tox.ini | 6 ++++ 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 requirements-coverage.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f1d12d10..f7c010f57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,7 +137,7 @@ jobs: mkdir coverage_reports cp .coverage "coverage_reports/coverage.${{ env.JOB_NAME }}" cp coverage.xml "coverage_reports/coverage.${{ env.JOB_NAME }}.xml" - - name: Publish Coverage + - name: Upload Coverage if: matrix.task.coverage uses: actions/upload-artifact@v2 with: @@ -190,12 +190,66 @@ jobs: continue-on-error: ${{ matrix.task.continue_on_error }} run: | tox -vv -e ${{ matrix.task.tox }} + coverage: + # Should match JOB_NAME below + name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + runs-on: ${{ matrix.os.runs-on }} + needs: + - test + container: ${{ matrix.os.container[matrix.python.docker] }} + strategy: + fail-fast: false + matrix: + task: + - name: Coverage + tox: combined-coverage + download_coverage: true + os: + - name: Linux + runs-on: ubuntu-latest + python_platform: linux + matrix: linux + container: + 3.8: docker://python:3.8-buster + python: + - name: CPython 3.8 + tox: py38 + action: 3.8 + docker: 3.8 + implementation: cpython + arch: + - name: x64 + action: x64 + matrix: x64 + env: + # Should match name above + JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install + run: | + pip install --upgrade pip setuptools wheel + pip install --upgrade tox + - uses: twisted/python-info-action@v1.0.1 + - name: Download Coverage + if: matrix.task.download_coverage + uses: actions/download-artifact@v2 + with: + name: coverage + path: coverage_reports + - name: Test + continue-on-error: ${{ matrix.task.continue_on_error }} + run: | + tox -vv -e ${{ matrix.task.tox }} all: name: All runs-on: ubuntu-latest needs: - - test - check + - coverage + - test steps: - name: This shell: python diff --git a/requirements-coverage.txt b/requirements-coverage.txt new file mode 100644 index 000000000..9808587c9 --- /dev/null +++ b/requirements-coverage.txt @@ -0,0 +1 @@ +coverage >= 4.2 diff --git a/requirements-tests.txt b/requirements-tests.txt index b7d4bb23c..5eca1922c 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,6 +1,6 @@ bcrypt>=3.1.6 capturer >= 2.2 -coverage >= 4.2 +-r requirements-coverage.txt cryptography>= 2.3 mock >= 1.0.1 pyserial-asyncio>=0.4.0;python_version>="3.4" diff --git a/tox.ini b/tox.ini index c09224bc3..72b6ff970 100644 --- a/tox.ini +++ b/tox.ini @@ -26,6 +26,12 @@ commands = make -C doc/ clean make -C doc/ html +[testenv:combined-coverage] +deps = -r requirements-coverage.txt +commands = + coverage combine coverage_reports + coverage report --fail-under=90 --ignore-errors + [flake8] exclude = .tox ignore = D211,D400,E731 From 5e03ca744d1df240126105cf0b38a6f89e17b91f Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 10:11:29 -0500 Subject: [PATCH 27/34] coverage: true --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7c010f57..49aa4d4fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: task: - name: Test tox: test + coverage: true os: - name: Linux runs-on: ubuntu-latest From 99e24a285ac5864341a633b0d00849c8bf217ad8 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 10:30:28 -0500 Subject: [PATCH 28/34] . --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49aa4d4fa..d045324df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,7 +136,7 @@ jobs: if: matrix.task.coverage run: | mkdir coverage_reports - cp .coverage "coverage_reports/coverage.${{ env.JOB_NAME }}" + cp .coverage "coverage_reports/.coverage.${{ env.JOB_NAME }}" cp coverage.xml "coverage_reports/coverage.${{ env.JOB_NAME }}.xml" - name: Upload Coverage if: matrix.task.coverage From cc5c0d6fd3212f72071ca3fb1efeceb4d95b34ea Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 13:17:38 -0500 Subject: [PATCH 29/34] ls -la coverage_reports --- tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tox.ini b/tox.ini index 72b6ff970..9fc001bce 100644 --- a/tox.ini +++ b/tox.ini @@ -27,8 +27,11 @@ commands = make -C doc/ html [testenv:combined-coverage] +allowlist_externals = + ls deps = -r requirements-coverage.txt commands = + ls -la coverage_reports coverage combine coverage_reports coverage report --fail-under=90 --ignore-errors From 9d11bae3e96e89c43cbe6c5a6830423a487d94bd Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Jan 2021 13:41:13 -0500 Subject: [PATCH 30/34] remove copy/paste error qt references --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d045324df..e0afe8025 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ on: jobs: test: # Should match JOB_NAME below - name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} runs-on: ${{ matrix.os.runs-on }} container: ${{ matrix.os.container[matrix.python.docker] }} strategy: @@ -107,7 +107,7 @@ jobs: matrix: x86 env: # Should match name above - JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} steps: - uses: actions/checkout@v2 with: @@ -146,7 +146,7 @@ jobs: path: coverage_reports/* check: # Should match JOB_NAME below - name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} runs-on: ${{ matrix.os.runs-on }} container: ${{ matrix.os.container[matrix.python.docker] }} strategy: @@ -177,7 +177,7 @@ jobs: matrix: x64 env: # Should match name above - JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} steps: - uses: actions/checkout@v2 with: @@ -193,7 +193,7 @@ jobs: tox -vv -e ${{ matrix.task.tox }} coverage: # Should match JOB_NAME below - name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + name: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} runs-on: ${{ matrix.os.runs-on }} needs: - test @@ -224,7 +224,7 @@ jobs: matrix: x64 env: # Should match name above - JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.qt_library.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} + JOB_NAME: ${{ matrix.task.name }} - ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.arch.name }} steps: - uses: actions/checkout@v2 with: From 4993a38371792cf4454d37c24f74cde19b1c593b Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 27 Jan 2021 10:22:50 -0500 Subject: [PATCH 31/34] Handle unspecified continue_on_error better --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0afe8025..f1b11405e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -188,7 +188,7 @@ jobs: pip install --upgrade tox - uses: twisted/python-info-action@v1.0.1 - name: Test - continue-on-error: ${{ matrix.task.continue_on_error }} + continue-on-error: ${{ matrix.task.continue_on_error == true }} run: | tox -vv -e ${{ matrix.task.tox }} coverage: From e5157c2dda8137a99a2708d1122c6810b3e374d9 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 27 Jan 2021 10:29:32 -0500 Subject: [PATCH 32/34] Handle unspecified continue_on_error better (again) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1b11405e..a0caa141e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -241,7 +241,7 @@ jobs: name: coverage path: coverage_reports - name: Test - continue-on-error: ${{ matrix.task.continue_on_error }} + continue-on-error: ${{ matrix.task.continue_on_error == true }} run: | tox -vv -e ${{ matrix.task.tox }} all: From 1f2c18e68811c8539622060e65293cb796e52fe3 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 9 Feb 2021 11:49:37 -0500 Subject: [PATCH 33/34] --fail-under=85 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9fc001bce..91a573e7a 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,7 @@ deps = -r requirements-coverage.txt commands = ls -la coverage_reports coverage combine coverage_reports - coverage report --fail-under=90 --ignore-errors + coverage report --fail-under=85 --ignore-errors [flake8] exclude = .tox From 1cae3315bbf905e56d87cb4404f8cb251394fdf4 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 9 Feb 2021 11:59:22 -0500 Subject: [PATCH 34/34] skip test_client_async_asyncio as well in py2 --- test/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/conftest.py b/test/conftest.py index 55e688160..932e8124c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -2,4 +2,7 @@ if PYTHON_VERSION < (3,): # These files use syntax introduced between Python 2 and our lowest # supported Python 3 version. We just won't run these tests in Python 2. - collect_ignore = ["test_server_asyncio.py"] + collect_ignore = [ + "test_client_async_asyncio.py", + "test_server_asyncio.py", + ]