def test_unlink_ENOENT(self): with mock.patch.object(os, "unlink") as unlink_mock: unlink_mock.side_effect = OSError(errno.ENOENT) utils.unlink_without_raise("/fake/path") unlink_mock.assert_called_once_with("/fake/path")
def test_unlink(self): with mock.patch.object(os, "unlink") as unlink_mock: unlink_mock.return_value = None utils.unlink_without_raise("/fake/path") unlink_mock.assert_called_once_with("/fake/path")