Browse Source

tests / python3.5: fix AttributeError due to unavailable MagicMock.assert_called_once

https://github.com/fphammerle/ical2vdir/pull/10/commits/fb8f266966868557aa14f76e7c60d455d72a526f#diff-dc1bd1b45943f5e3371302d3b7b22823R62
Fabian Peter Hammerle 3 years ago
parent
commit
38e23ba811
2 changed files with 6 additions and 2 deletions
  1. 4 1
      CHANGELOG.md
  2. 2 1
      tests/test_mqtt.py

+ 4 - 1
CHANGELOG.md

@@ -6,7 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### Fixed
-- Replaced variable type hint incompatible with python3.5
+- Compatibility with python3.5:
+  - Replaced [PEP526](https://www.python.org/dev/peps/pep-0526/#abstract)-style variable type hint
+    with [PEP484](https://www.python.org/dev/peps/pep-0484/)-compatible
+  - Tests: Fixed `AttributeError` due to unavailable `MagicMock.assert_called_once`
 
 ## [0.4.0] - 2020-06-14
 ### Added

+ 2 - 1
tests/test_mqtt.py

@@ -32,7 +32,8 @@ def test__run(mqtt_host, mqtt_port):
         "homeassistant/switch/switchbot/+/set"
     )
     mqtt_client_mock().on_message(mqtt_client_mock(), None, "message")
-    message_handler_mock.assert_called_once()
+    # assert_called_once new in python3.6
+    assert message_handler_mock.call_count == 1
     mqtt_client_mock().loop_forever.assert_called_once_with()