generated from mononoki/pyproj
[+!] all but small
some small modifications, tests added
This commit is contained in:
@@ -11,7 +11,7 @@ import pytest
|
||||
@pytest.fixture(scope="session")
|
||||
def client_module():
|
||||
"""Загружает общий тестовый клиент без запуска его командного интерфейса."""
|
||||
path = Path(__file__).parents[1] / "src" / ".test" / "client_test.py"
|
||||
path = Path(__file__).parents[1] / "examples" / "client.py"
|
||||
spec = importlib.util.spec_from_file_location("artex_test_client", path)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
@@ -67,6 +67,7 @@ class Timing:
|
||||
def __init__(self):
|
||||
self.clock = Clock()
|
||||
self.tasks = []
|
||||
self.expected_errors = []
|
||||
self.queues = {}
|
||||
self.waiting = {}
|
||||
|
||||
@@ -84,6 +85,11 @@ class Timing:
|
||||
self.tasks.append(task)
|
||||
return task
|
||||
|
||||
def accept_task_error(self, task, error):
|
||||
assert task in self.tasks and task.done() and not task.cancelled()
|
||||
assert task.exception() is error
|
||||
self.expected_errors.append(error)
|
||||
|
||||
async def sleeping(self, label, task=None):
|
||||
async with asyncio.timeout(1):
|
||||
while True:
|
||||
@@ -106,7 +112,8 @@ class Timing:
|
||||
if exc_type is None:
|
||||
for result in results:
|
||||
if isinstance(result, BaseException) and not isinstance(result, asyncio.CancelledError):
|
||||
raise result
|
||||
if not any(result is expected for expected in self.expected_errors):
|
||||
raise result
|
||||
|
||||
|
||||
class ConnectionRecorder:
|
||||
|
||||
Reference in New Issue
Block a user