Browse Source

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

Fabian Peter Hammerle 3 years ago
parent
commit
fb8f266966
2 changed files with 3 additions and 1 deletions
  1. 1 0
      CHANGELOG.md
  2. 2 1
      tests/vdir_test.py

+ 1 - 0
CHANGELOG.md

@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   - `TypeError` in `_write_event` when renaming temporary file
   - `TypeError` in `_sync_event` when reading file
   - tests: `TypeError` when converting to `pathlib.Path`
+  - tests: `AttributeError` due to unavailable `MagicMock.assert_called_once`
 
 ## [0.1.1] - 2020-02-06
 ### Fixed

+ 2 - 1
tests/vdir_test.py

@@ -58,7 +58,8 @@ def test__write_event_cleanup(tmp_path: pathlib.Path):
     with unittest.mock.patch("os.unlink") as unlink_mock:
         with pytest.raises(IsADirectoryError):
             ical2vdir._write_event(event, tmp_path)
-    unlink_mock.assert_called_once()
+    # assert_called_once new in python3.6
+    assert unlink_mock.call_count == 1
     unlink_args, _ = unlink_mock.call_args
     os.unlink(unlink_args[0])