Skip to content

Commit

Permalink
Merge pull request #7 from davidraker/updates
Browse files Browse the repository at this point in the history
Fixes remaining issues with integration tests, workflows, and regex.
  • Loading branch information
shwethanidd authored Mar 29, 2023
2 parents 843867a + ad3aadf commit 4616bba
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 9 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/auto-assign-project.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/<orgName>/projects/<projectNumber>
# github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
github-token: ${{ secrets.AUTO_PROJECT_PAT }}
# labeled: bug, needs-triage
# label-operator: OR
39 changes: 39 additions & 0 deletions .github/workflows/dispatch-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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"
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 6 additions & 8 deletions tests/test_driver_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import pytest
import socket
import time

from random import randint
from struct import pack, unpack
Expand Down Expand Up @@ -197,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)
Expand Down Expand Up @@ -233,7 +232,7 @@ def modbus_server():
unpack('<HHHH', pack('>q', 0)))

modbus_server.start()
time.sleep(1)
gevent.sleep(1)
yield modbus_server
modbus_server.stop()

Expand All @@ -253,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

0 comments on commit 4616bba

Please sign in to comment.