From a391d4f50880e928fd7221e81c6f75a8f5cd7f13 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Sun, 23 Jan 2022 12:03:01 +0300 Subject: [PATCH] Update conftest.py --- conftest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/conftest.py b/conftest.py index 32518a95..e5513d8f 100644 --- a/conftest.py +++ b/conftest.py @@ -108,12 +108,16 @@ class TrackedContainer: return logs @staticmethod - def get_warnings(logs: str) -> list[str]: - return [line for line in logs.split("\n") if line.startswith("WARNING")] + def get_errors(logs: str) -> list[str]: + return _lines_starting_with(logs, "ERROR") @staticmethod - def get_errors(logs: str) -> list[str]: - return [line for line in logs.split("\n") if line.startswith("ERROR")] + def get_warnings(logs: str) -> list[str]: + return _lines_starting_with(logs, "WARNING") + + @staticmethod + def _lines_starting_with(logs: str, pattern: str) -> list[str]: + return [line for line in logs.splitlines() if line.startswith(pattern)] def remove(self): """Kills and removes the tracked docker container."""