Skip to content

Commit

Permalink
fix(plc4py): Used Union for type hints, remove manual tests from build
Browse files Browse the repository at this point in the history
  • Loading branch information
hutcheb committed Nov 11, 2022
1 parent a1a7746 commit 1e4e1d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion sandbox/plc4py/plc4py/spi/Plc4xBaseProtocol.py
Expand Up @@ -19,6 +19,7 @@

from asyncio import Protocol, Future
from dataclasses import dataclass
from typing import Union


@dataclass
Expand All @@ -32,6 +33,6 @@ def data_received(self, data) -> None:
def connection_made(self):
self.connected = True

def connection_lost(self, exc: Exception | None) -> None:
def connection_lost(self, exc: Union[Exception, None]) -> None:
self.connected = False
raise ConnectionError
6 changes: 3 additions & 3 deletions sandbox/plc4py/tests/test_plc4py.py
Expand Up @@ -34,13 +34,13 @@ def test_version():

async def test_plc_driver_manager_init():
driver_manager = PlcDriverManager()
async with driver_manager.connection("modbus:tcp://127.0.0.1:502") as connection:
async with driver_manager.connection("mock:tcp://127.0.0.1:502") as connection:
assert isinstance(connection, PlcConnection)


async def test_plc_driver_manager_init_modbus():
async def manual_test_plc_driver_manager_init_modbus():
driver_manager = PlcDriverManager()
async with driver_manager.connection("modbus:tcp://127.0.0.1:502") as connection:
async with driver_manager.connection("nodbus:tcp://127.0.0.1:502") as connection:
assert isinstance(connection, ModbusConnection)


Expand Down
Expand Up @@ -21,7 +21,7 @@
from plc4py.PlcDriverManager import PlcDriverManager


async def test_plc_driver_modbus_connect():
async def manual_test_plc_driver_modbus_connect():
driver_manager = PlcDriverManager()
async with driver_manager.connection("modbus://127.0.0.1:502") as connection:
assert connection.is_connected()
Expand Down

0 comments on commit 1e4e1d3

Please sign in to comment.