From e63b707a64e94aad13a041307fc1e88997f26282 Mon Sep 17 00:00:00 2001 From: Christian Tremblay Date: Mon, 1 Oct 2018 11:13:26 -0400 Subject: [PATCH 1/4] Pytest may freeze sometime... trying to use BAC0.lite() instead of complete in test --- tests/test_WithFakeDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_WithFakeDevice.py b/tests/test_WithFakeDevice.py index 05174d1d..1ecd6c48 100644 --- a/tests/test_WithFakeDevice.py +++ b/tests/test_WithFakeDevice.py @@ -12,7 +12,7 @@ @pytest.fixture(scope='session') def network_and_devices(): - bacnet = BAC0.connect() + bacnet = BAC0.lite() device_app = BAC0.lite(port=47809) mv = create_MV(oid=1, name='mv', pv=1) From 7542189c4be77863bda87305c79ed28f4726fa54 Mon Sep 17 00:00:00 2001 From: Christian Tremblay Date: Mon, 1 Oct 2018 13:00:09 -0400 Subject: [PATCH 2/4] This is an attemp to fix a bug found while investigating for issue #107 where using device[point].lastValue created a network read operation. This should not. But when using device[point] the __repr__ should read the value to be up to date. --- BAC0/core/devices/Device.py | 2 +- BAC0/core/devices/Points.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BAC0/core/devices/Device.py b/BAC0/core/devices/Device.py index 4fdf0a2f..03b8d622 100644 --- a/BAC0/core/devices/Device.py +++ b/BAC0/core/devices/Device.py @@ -486,7 +486,7 @@ def __getitem__(self, point_name): if isinstance(point_name, list): return self.df(point_name, force_read=False) else: - return self._findPoint(point_name) + return self._findPoint(point_name, force_read=False) except ValueError as ve: self._log.error('{}'.format(ve)) diff --git a/BAC0/core/devices/Points.py b/BAC0/core/devices/Points.py index a0dd0c26..22a8ff9b 100644 --- a/BAC0/core/devices/Points.py +++ b/BAC0/core/devices/Points.py @@ -497,7 +497,7 @@ def _set(self, value): raise ValueError('Value must be numeric') def __repr__(self): - return '{}/{} : {:.2f} {}'.format(self.properties.device.properties.name, self.properties.name, self.lastValue, self.properties.units_state) + return '{}/{} : {:.2f} {}'.format(self.properties.device.properties.name, self.properties.name, self.value, self.properties.units_state) def __add__(self, other): return self.value + other From ffaa4693beb5ce2a42769f0238b248e01ec2ca76 Mon Sep 17 00:00:00 2001 From: Christian Tremblay Date: Mon, 1 Oct 2018 13:00:44 -0400 Subject: [PATCH 3/4] Bumping version --- BAC0/infos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BAC0/infos.py b/BAC0/infos.py index 6613a677..610a9d37 100644 --- a/BAC0/infos.py +++ b/BAC0/infos.py @@ -12,5 +12,5 @@ __email__ = 'christian.tremblay@servisys.com' __url__ = 'https://github.com/ChristianTremblay/BAC0' __download_url__ = 'https://github.com/ChristianTremblay/BAC0/archive/master.zip' -__version__ = '0.99.941' +__version__ = '0.99.942' __license__ = 'LGPLv3' From be59ea1ea171656af9a58636a040c05f4a87ff1f Mon Sep 17 00:00:00 2001 From: Christian Tremblay Date: Mon, 1 Oct 2018 13:59:29 -0400 Subject: [PATCH 4/4] Added disconnecting test_device to prevent pytest from failing randomly --- tests/test_WithFakeDevice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_WithFakeDevice.py b/tests/test_WithFakeDevice.py index 1ecd6c48..27c9dd11 100644 --- a/tests/test_WithFakeDevice.py +++ b/tests/test_WithFakeDevice.py @@ -32,9 +32,11 @@ def network_and_devices(): yield (bacnet, device_app, test_device) # Close when done + test_device.disconnect() bacnet.disconnect() device_app.disconnect() + def test_ReadAV(network_and_devices): bacnet, device_app, test_device = network_and_devices assert (test_device['av'] - 99.90) < 0.01