test_helpers: Move patch_queue_publish to test_service_bot_system.

This prepares us to tighten the type annotations for this helper.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li
2022-08-22 13:50:23 -04:00
committed by Tim Abbott
parent 30536caa68
commit 32a77fc0bf
2 changed files with 15 additions and 16 deletions

View File

@@ -4,7 +4,6 @@ import re
import sys
import time
from contextlib import contextmanager
from functools import wraps
from typing import (
IO,
TYPE_CHECKING,
@@ -722,17 +721,3 @@ def mock_queue_publish(
with mock.patch(method_to_patch, side_effect=verify_serialize):
yield inner
def patch_queue_publish(
method_to_patch: str,
) -> Callable[[Callable[..., None]], Callable[..., None]]:
def inner(func: Callable[..., None]) -> Callable[..., None]:
@wraps(func)
def _wrapped(*args: object, **kwargs: object) -> None:
with mock_queue_publish(method_to_patch) as m:
func(*args, m, **kwargs)
return _wrapped
return inner