diff --git a/tests/pytests/unit/modules/test_linux_sysctl.py b/tests/pytests/unit/modules/test_linux_sysctl.py index 0bdd24039d..22df70c58d 100644 --- a/tests/pytests/unit/modules/test_linux_sysctl.py +++ b/tests/pytests/unit/modules/test_linux_sysctl.py @@ -215,7 +215,7 @@ def test_persist_no_conf_failure(): ): with pytest.raises(CommandExecutionError): linux_sysctl.persist("net.ipv4.ip_forward", 42, config=None) - fopen_mock.called_once() + fopen_mock.assert_called_once() def test_persist_no_conf_success(): diff --git a/tests/pytests/unit/modules/test_win_ip.py b/tests/pytests/unit/modules/test_win_ip.py index 38eb6b1ac5..94a3fe7ca9 100644 --- a/tests/pytests/unit/modules/test_win_ip.py +++ b/tests/pytests/unit/modules/test_win_ip.py @@ -151,7 +151,7 @@ def test_enable(): ): assert win_ip.enable("Ethernet") - mock_cmd.called_once_with( + mock_cmd.assert_called_once_with( [ "netsh", "interface", @@ -180,7 +180,7 @@ def test_disable(): ): assert win_ip.disable("Ethernet") - mock_cmd.called_once_with( + mock_cmd.assert_called_once_with( [ "netsh", "interface", diff --git a/tests/pytests/unit/test_master.py b/tests/pytests/unit/test_master.py index cd11d217c7..502767d3e3 100644 --- a/tests/pytests/unit/test_master.py +++ b/tests/pytests/unit/test_master.py @@ -60,7 +60,7 @@ def test_fileserver_duration(): end = time.time() # Interval is equal to timeout so the _do_update method will be called # one time. - update.called_once() + update.assert_called_once() # Timeout is 1 second duration = end - start if duration > 2 and salt.utils.platform.spawning_platform(): diff --git a/tests/pytests/unit/utils/event/test_event.py b/tests/pytests/unit/utils/event/test_event.py index e289e72dad..2abd4066c4 100644 --- a/tests/pytests/unit/utils/event/test_event.py +++ b/tests/pytests/unit/utils/event/test_event.py @@ -300,7 +300,7 @@ def test_connect_pull_should_debug_log_on_StreamClosedError(): event = SaltEvent(node=None) with patch.object(event, "pusher") as mock_pusher: with patch.object( - salt.utils.event.log, "debug", auto_spec=True + salt.utils.event.log, "debug", auto_spec=True, unsafe=True ) as mock_log_debug: mock_pusher.connect.side_effect = ( salt.ext.tornado.iostream.StreamClosedError @@ -317,10 +317,10 @@ def test_connect_pull_should_error_log_on_other_errors(error): event = SaltEvent(node=None) with patch.object(event, "pusher") as mock_pusher: with patch.object( - salt.utils.event.log, "debug", auto_spec=True + salt.utils.event.log, "debug", auto_spec=True, unsafe=True ) as mock_log_debug: with patch.object( - salt.utils.event.log, "error", auto_spec=True + salt.utils.event.log, "error", auto_spec=True, unsafe=True ) as mock_log_error: mock_pusher.connect.side_effect = error event.connect_pull()