Beispiel #1
0
    def test_call_exception(self, mocker):
        mock = mocker.patch('subprocess.check_call')
        command = ['foo', 'bar']
        mock.side_effect = subprocess.CalledProcessError(2, command)

        spy = mocker.spy(autosuspend._logger, 'warning')

        autosuspend.execute_suspend(command, None)

        mock.assert_called_once_with(command, shell=True)
        assert spy.call_count == 1
    def test_call_exception(self, mocker) -> None:
        mock = mocker.patch("subprocess.check_call")
        command = ["foo", "bar"]
        mock.side_effect = subprocess.CalledProcessError(2, command)

        spy = mocker.spy(autosuspend._logger, "warning")

        autosuspend.execute_suspend(command, None)

        mock.assert_called_once_with(command, shell=True)
        assert spy.call_count == 1
Beispiel #3
0
 def test_smoke(self, mocker):
     mock = mocker.patch('subprocess.check_call')
     command = ['foo', 'bar']
     autosuspend.execute_suspend(command, None)
     mock.assert_called_once_with(command, shell=True)
 def test_smoke(self, mocker) -> None:
     mock = mocker.patch("subprocess.check_call")
     command = ["foo", "bar"]
     autosuspend.execute_suspend(command, None)
     mock.assert_called_once_with(command, shell=True)