From 71d5bb1f128bbd7a6a1f4ac52240bd1d81419ad6 Mon Sep 17 00:00:00 2001 From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com> Date: Thu, 12 May 2022 02:02:17 +0300 Subject: [PATCH] test: arrange pytest logging 1. Print logs to the stderr so that they interleave with tarantool logs. 2. Fix `cluster.__repr__()`. --- test/int/conftest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/int/conftest.py b/test/int/conftest.py index 4377349b09..f4bea8e709 100644 --- a/test/int/conftest.py +++ b/test/int/conftest.py @@ -1,5 +1,6 @@ import os import re +import sys import funcy # type: ignore import pytest import signal @@ -22,6 +23,10 @@ from tarantool.error import ( # type: ignore INVALID_ID = 0 +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + re_xdist_worker_id = re.compile(r"^gw(\d+)$") @@ -205,7 +210,7 @@ class Instance: os.killpg(pid, signal.SIGKILL) with suppress(ChildProcessError): os.waitpid(pid, 0) - print(f"killed: {self}") + eprint(f"{self} killed") self.process = None def terminate(self, kill_after_seconds=10): @@ -293,7 +298,7 @@ class Cluster: instances: list[Instance] = field(default_factory=list) def __repr__(self): - return f'Cluster("127.7.{self.subnet}.1", n={self.instances.count()})' + return f'Cluster("127.7.{self.subnet}.1", n={len(self.instances)})' def __getitem__(self, item: int) -> Instance: return self.instances[item] @@ -319,6 +324,7 @@ class Cluster: for instance in self.instances: instance.wait_ready() + eprint(f" {self} deployed ".center(80, "=")) return self.instances def kill_all(self): -- GitLab