pyotgw 2.2.0__tar.gz → 2.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {pyotgw-2.2.0 → pyotgw-2.2.2}/PKG-INFO +2 -1
  2. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/connection.py +9 -7
  3. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw.egg-info/PKG-INFO +2 -1
  4. {pyotgw-2.2.0 → pyotgw-2.2.2}/setup.py +1 -1
  5. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_connection.py +34 -0
  6. {pyotgw-2.2.0 → pyotgw-2.2.2}/LICENSE +0 -0
  7. {pyotgw-2.2.0 → pyotgw-2.2.2}/README.md +0 -0
  8. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/__init__.py +0 -0
  9. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/commandprocessor.py +0 -0
  10. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/messageprocessor.py +0 -0
  11. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/messages.py +0 -0
  12. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/protocol.py +0 -0
  13. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/pyotgw.py +0 -0
  14. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/status.py +0 -0
  15. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw/vars.py +0 -0
  16. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw.egg-info/SOURCES.txt +0 -0
  17. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw.egg-info/dependency_links.txt +0 -0
  18. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw.egg-info/requires.txt +0 -0
  19. {pyotgw-2.2.0 → pyotgw-2.2.2}/pyotgw.egg-info/top_level.txt +0 -0
  20. {pyotgw-2.2.0 → pyotgw-2.2.2}/setup.cfg +0 -0
  21. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_commandprocessor.py +0 -0
  22. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_messageprocessor.py +0 -0
  23. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_messages.py +0 -0
  24. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_protocol.py +0 -0
  25. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_pyotgw.py +0 -0
  26. {pyotgw-2.2.0 → pyotgw-2.2.2}/tests/test_status.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyotgw
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A library to interface with the opentherm gateway through serial or network connection.
5
5
  Home-page: https://github.com/mvn23/pyotgw
6
6
  Author: Milan van Nugteren
@@ -13,6 +13,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (G
13
13
  Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
+ Requires-Dist: pyserial-asyncio-fast
16
17
 
17
18
  [![Build Status](https://travis-ci.org/mvn23/pyotgw.svg?branch=master)](https://travis-ci.org/mvn23/pyotgw)
18
19
 
@@ -131,22 +131,24 @@ class ConnectionManager: # pylint: disable=too-many-instance-attributes
131
131
  )
132
132
  return transport, protocol
133
133
 
134
- except serial.SerialException as err:
134
+ except asyncio.TimeoutError as err:
135
135
  if not isinstance(err, type(self._error)):
136
136
  _LOGGER.error(
137
- "Could not connect to serial device on %s. "
138
- "Will keep trying. Reported error was: %s",
137
+ "The serial device on %s is not responding. "
138
+ "Will keep trying.",
139
139
  self._port,
140
- err,
141
140
  )
142
141
  self._error = err
142
+ if protocol:
143
+ await protocol.cleanup()
143
144
 
144
- except asyncio.TimeoutError as err:
145
+ except (serial.SerialException, OSError) as err:
145
146
  if not isinstance(err, type(self._error)):
146
147
  _LOGGER.error(
147
- "The serial device on %s is not responding. "
148
- "Will keep trying.",
148
+ "Could not connect to serial device on %s. "
149
+ "Will keep trying. Reported error was: %s",
149
150
  self._port,
151
+ err,
150
152
  )
151
153
  self._error = err
152
154
  if protocol:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyotgw
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A library to interface with the opentherm gateway through serial or network connection.
5
5
  Home-page: https://github.com/mvn23/pyotgw
6
6
  Author: Milan van Nugteren
@@ -13,6 +13,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (G
13
13
  Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
+ Requires-Dist: pyserial-asyncio-fast
16
17
 
17
18
  [![Build Status](https://travis-ci.org/mvn23/pyotgw.svg?branch=master)](https://travis-ci.org/mvn23/pyotgw)
18
19
 
@@ -13,7 +13,7 @@ def read(fname):
13
13
 
14
14
  setup(
15
15
  name="pyotgw",
16
- version="2.2.0",
16
+ version="2.2.2",
17
17
  author="Milan van Nugteren",
18
18
  author_email="milan@network23.nl",
19
19
  description=(
@@ -290,6 +290,40 @@ async def test_attempt_connect_success(pygw_conn, pygw_proto):
290
290
  init_and_wait.assert_called_once()
291
291
 
292
292
 
293
+ @pytest.mark.asyncio
294
+ async def test_attempt_connect_oserror(caplog, pygw_conn):
295
+ """Test ConnectionManager._attempt_connect() with OSError"""
296
+ loop = asyncio.get_running_loop()
297
+ pygw_conn._port = "loop://"
298
+
299
+ with patch(
300
+ "serial_asyncio_fast.create_serial_connection",
301
+ side_effect=OSError,
302
+ ) as create_serial_connection, patch.object(
303
+ pygw_conn,
304
+ "_get_retry_timeout",
305
+ return_value=0,
306
+ ) as retry_timeout, caplog.at_level(
307
+ logging.ERROR
308
+ ):
309
+ task = loop.create_task(pygw_conn._attempt_connect())
310
+ await called_x_times(retry_timeout, 2)
311
+
312
+ assert create_serial_connection.call_count >= 2
313
+ assert caplog.record_tuples == [
314
+ (
315
+ "pyotgw.connection",
316
+ logging.ERROR,
317
+ "Could not connect to serial device on loop://. "
318
+ "Will keep trying. Reported error was: ",
319
+ )
320
+ ]
321
+
322
+ task.cancel()
323
+ with pytest.raises(asyncio.CancelledError):
324
+ await task
325
+
326
+
293
327
  @pytest.mark.asyncio
294
328
  async def test_attempt_connect_serialexception(caplog, pygw_conn):
295
329
  """Test ConnectionManager._attempt_connect() with SerialException"""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes