From 59837974ab27b379b7b6a00b7782574c0909fcf0 Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Mon, 13 Feb 2023 15:49:15 -0800 Subject: [PATCH 1/5] Corrected likely typo in regex. --- src/volttron/driver/interfaces/modbus_tk/utils/maps/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/volttron/driver/interfaces/modbus_tk/utils/maps/__init__.py b/src/volttron/driver/interfaces/modbus_tk/utils/maps/__init__.py index 7943886..7bf852d 100644 --- a/src/volttron/driver/interfaces/modbus_tk/utils/maps/__init__.py +++ b/src/volttron/driver/interfaces/modbus_tk/utils/maps/__init__.py @@ -165,7 +165,7 @@ def _transform(self): try: if csv_transform: - match = re.match(r'(\w+)\(([a-zA-z0-9.]*)\)', csv_transform) + match = re.match(r'(\w+)\(([a-zA-Z0-9.]*)\)', csv_transform) func = match.group(1) arg = match.group(2) From 99c00726a60c06388ab7c01a420d0ec6678ddb44 Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Mon, 13 Feb 2023 15:53:34 -0800 Subject: [PATCH 2/5] Changed time.sleep to gevent.sleep in test_driver_local.py. --- tests/test_driver_local.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_driver_local.py b/tests/test_driver_local.py index 263e447..71ba469 100644 --- a/tests/test_driver_local.py +++ b/tests/test_driver_local.py @@ -3,7 +3,6 @@ import logging import pytest import socket -import time from random import randint from struct import pack, unpack @@ -233,7 +232,7 @@ def modbus_server(): unpack('q', 0))) modbus_server.start() - time.sleep(1) + gevent.sleep(10) yield modbus_server modbus_server.stop() From 07abadbce4b9be30a375b582a68190feceade19c Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Mon, 13 Feb 2023 17:46:10 -0800 Subject: [PATCH 3/5] Changed modbus_server fixture to module-scope to fix issue with second test timing out. --- tests/test_driver_local.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_driver_local.py b/tests/test_driver_local.py index 71ba469..d6beac5 100644 --- a/tests/test_driver_local.py +++ b/tests/test_driver_local.py @@ -196,7 +196,7 @@ def __init__(self, *args, **kwargs): helpers.REGISTER_READ_WRITE, helpers.OP_MODE_READ_WRITE) -@pytest.fixture +@pytest.fixture(scope="module") # TODO: Why does second test fail with this as a function-scoped fixture? def modbus_server(): modbus_server = Server(address=IP, port=PORT) modbus_server.define_slave(1, PPSPi32Client, unsigned=True) @@ -232,7 +232,7 @@ def modbus_server(): unpack('q', 0))) modbus_server.start() - gevent.sleep(10) + gevent.sleep(1) yield modbus_server modbus_server.stop() @@ -252,11 +252,10 @@ def test_default_values(modbus_server, publish_agent): def test_set_point(modbus_server, publish_agent): for key in REGISTERS_DICT.keys(): publish_agent.vip.rpc.call(PLATFORM_DRIVER, 'set_point', 'modbus', key, - REGISTERS_DICT[key]).get(timeout=20) - gevent.sleep(5) + REGISTERS_DICT[key]).get(timeout=10) + assert publish_agent.vip.rpc.call(PLATFORM_DRIVER, 'get_point', 'modbus', - key).get(timeout=20) == REGISTERS_DICT[key] - gevent.sleep(5) + key).get(timeout=10) == REGISTERS_DICT[key] assert publish_agent.vip.rpc.call(PLATFORM_DRIVER, 'scrape_all', - 'modbus').get(timeout=20) == REGISTERS_DICT + 'modbus').get(timeout=10) == REGISTERS_DICT From 4b3e6596ed43e689566a7c45121a1f1ea59bea1b Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Mon, 13 Feb 2023 17:58:35 -0800 Subject: [PATCH 4/5] Added auto-assign-project.yml to workflows. --- .github/workflows/auto-assign-project.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/auto-assign-project.yml diff --git a/.github/workflows/auto-assign-project.yml b/.github/workflows/auto-assign-project.yml new file mode 100644 index 0000000..00c5cad --- /dev/null +++ b/.github/workflows/auto-assign-project.yml @@ -0,0 +1,22 @@ +name: Add bugs to bugs project + +on: + issues: + types: + - opened + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v0.3.0 + with: + # You can target a repository in a different organization + # to the issue + project-url: https://github.com/orgs/eclipse-volttron/projects/3 + # project-url: https://github.com/orgs//projects/ + # github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} + github-token: ${{ secrets.AUTO_PROJECT_PAT }} + # labeled: bug, needs-triage + # label-operator: OR From ad3aadf2bbf4ab5f9b7dd35aee4cedfce3caa5cb Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Wed, 15 Feb 2023 14:03:40 -0800 Subject: [PATCH 5/5] Added dispatch-to-pypi.yml to workflows. --- .github/workflows/dispatch-to-pypi.yml | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/dispatch-to-pypi.yml diff --git a/.github/workflows/dispatch-to-pypi.yml b/.github/workflows/dispatch-to-pypi.yml new file mode 100644 index 0000000..b10d281 --- /dev/null +++ b/.github/workflows/dispatch-to-pypi.yml @@ -0,0 +1,39 @@ +--- +# Documentation located +# https://github.com/marketplace/actions/publish-python-poetry-package +name: Dispatch to PyPi + +on: + workflow_dispatch: + +defaults: + run: + shell: bash + +env: + LANG: en_US.utf-8 + LC_ALL: en_US.utf-8 + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + +jobs: + + publish_to_pypi: + + runs-on: ubuntu-22.04 + + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build and publish to pypi + uses: JRubics/poetry-publish@v1.7 + with: + # These are only needed when using test.pypi + #repository_name: testpypi + #repository_url: https://test.pypi.org/legacy/ + pypi_token: ${{ secrets.PYPI_TOKEN }} + ignore_dev_requirements: "yes"