From 2a880b7d9b455fbdd7bf718af3de4a266ece06b0 Mon Sep 17 00:00:00 2001 From: Tiago Montes Date: Wed, 20 Mar 2019 18:42:08 +0000 Subject: [PATCH 1/2] Fix intermittently failing macOS test. --- tests/interface/test_editor.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/interface/test_editor.py b/tests/interface/test_editor.py index 8783e3c72..3543a5bbb 100644 --- a/tests/interface/test_editor.py +++ b/tests/interface/test_editor.py @@ -129,7 +129,7 @@ def test_Editor_connect_margin_ignores_margin_4(): ep.connect_margin(mock_fn) margin = 4 line = 0 - modifiers = Qt.KeyboardModifiers() + modifiers = Qt.NoModifier ep.marginClicked.emit(margin, line, modifiers) assert mock_fn.call_count == 0 @@ -143,9 +143,16 @@ def test_Editor_connect_margin_1_works(): ep.connect_margin(mock_fn) margin = 1 line = 0 - modifiers = Qt.KeyboardModifiers() + modifiers = Qt.NoModifier ep.marginClicked.emit(margin, line, modifiers) - mock_fn.assert_called_once_with(margin, line, modifiers) + + mock_fn.assert_called_once() + args, _kwargs = mock_fn.call_args + call_margin, call_line, _call_modifiers = args + assert margin == call_margin + assert line == call_line + # Don't assert _call_modifiers value: not used in implementation and seems + # to fail intermittently on macOS. def test_EditorPane_set_theme(): From 383aee9680f919762b6575264550cb391568562c Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Thu, 21 Mar 2019 13:54:21 +0000 Subject: [PATCH 2/2] Fix assert_called_once problem because of Python 3.5 --- tests/interface/test_editor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interface/test_editor.py b/tests/interface/test_editor.py index 3543a5bbb..be6cc638a 100644 --- a/tests/interface/test_editor.py +++ b/tests/interface/test_editor.py @@ -146,7 +146,7 @@ def test_Editor_connect_margin_1_works(): modifiers = Qt.NoModifier ep.marginClicked.emit(margin, line, modifiers) - mock_fn.assert_called_once() + assert mock_fn.call_count == 1 args, _kwargs = mock_fn.call_args call_margin, call_line, _call_modifiers = args assert margin == call_margin