From 8dd59d894101ad717470291fb6ff6d874d1d97a7 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:27:46 +0200 Subject: [PATCH] minor --- tests/e2e-playwright/tests/conftest.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index fce86600400e..d1f325531e8b 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -11,6 +11,7 @@ import os import random import re +import textwrap import urllib.parse from collections.abc import Callable, Iterator from contextlib import ExitStack @@ -22,7 +23,6 @@ from playwright.sync_api import APIRequestContext, BrowserContext, Page, WebSocket from playwright.sync_api._generated import Playwright from pydantic import AnyUrl, TypeAdapter -from pytest import Item from pytest_simcore.helpers.logging_tools import log_context from pytest_simcore.helpers.playwright import ( MINUTE, @@ -121,7 +121,7 @@ def pytest_addoption(parser: pytest.Parser) -> None: # Dictionary to store start times of tests -_test_start_times = {} +_test_start_times: dict[str, datetime.datetime] = {} def pytest_runtest_setup(item): @@ -149,7 +149,7 @@ def _construct_graylog_url( return f"{monitoring_url}/graylog/search?{query}" -def pytest_runtest_makereport(item: Item, call): +def pytest_runtest_makereport(item: pytest.Item, call): """ Hook to add extra information when a test fails. """ @@ -176,9 +176,8 @@ def pytest_runtest_makereport(item: Item, call): ) diagnostics["duration"] = str(end_time - start_time) - # Print the diagnostics report - print(f"\nDiagnostics repoort for {test_name} ---") - print(json.dumps(diagnostics, indent=2)) + print(f"\nDiagnostics report for {test_name} ---") + print(textwrap.indent(json.dumps(diagnostics, indent=2), " ")) print("---")