From d299bee684eac3ce28cab59fe9301fe0d1b88bb2 Mon Sep 17 00:00:00 2001 From: wwakabobik Date: Fri, 30 Aug 2024 16:07:29 +0200 Subject: [PATCH] Linter fixes --- tests/conftest.py | 1 - ...st_engines_plotly_reporter_draw_automation_state_report.py | 2 +- .../test_engines_plotly_reporter_draw_history_state_chart.py | 2 +- .../test_engines_plotly_reporter_draw_test_case_by_area.py | 2 +- ...test_engines_plotly_reporter_draw_test_case_by_priority.py | 2 +- tests/utils/test_reporter_utils_logger_config.py | 4 ++-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ab11da1..a081f9d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -136,7 +136,6 @@ def compare(actual: str, expected: str, threshold: int = 10) -> bool: diff_pixels = sum(abs(r - g) + abs(g - b) + abs(b - a) + abs(a - r) > 20 for r, g, b, a in diff.getdata()) # Check that the number of different pixels is below the threshold - print(diff_pixels) return diff_pixels < threshold return compare diff --git a/tests/engines/test_engines_plotly_reporter_draw_automation_state_report.py b/tests/engines/test_engines_plotly_reporter_draw_automation_state_report.py index 1134792..90a9221 100644 --- a/tests/engines/test_engines_plotly_reporter_draw_automation_state_report.py +++ b/tests/engines/test_engines_plotly_reporter_draw_automation_state_report.py @@ -74,7 +74,7 @@ def test_draw_automation_state_report_creates_file(case_stat, case_stat_random, remove(filename) -@pytest.mark.xfail("Image may differ on GA env") +@pytest.mark.xfail(reason="Image may differ on GA env") def test_draw_automation_state_report_creates_correct_image( random_expected_image, compare_image # pylint: disable=W0621 ): diff --git a/tests/engines/test_engines_plotly_reporter_draw_history_state_chart.py b/tests/engines/test_engines_plotly_reporter_draw_history_state_chart.py index 80ced3e..f5f036f 100644 --- a/tests/engines/test_engines_plotly_reporter_draw_history_state_chart.py +++ b/tests/engines/test_engines_plotly_reporter_draw_history_state_chart.py @@ -55,7 +55,7 @@ def test_draw_history_state_chart_trace1_decor(): return # not implemented yet -def test_draw_history_state_chart_trace2_decor(random_plotly_reporter, compare_image): +def test_draw_history_state_chart_trace2_decor(): """Init PlotlyReporter and call draw_history_state_chart with custom trace2 decor""" return # not implemented yet diff --git a/tests/engines/test_engines_plotly_reporter_draw_test_case_by_area.py b/tests/engines/test_engines_plotly_reporter_draw_test_case_by_area.py index 26f4b82..a70f8c6 100644 --- a/tests/engines/test_engines_plotly_reporter_draw_test_case_by_area.py +++ b/tests/engines/test_engines_plotly_reporter_draw_test_case_by_area.py @@ -83,7 +83,7 @@ def test_draw_test_case_by_area_creates_file(case_stat, case_stat_random, random remove(filename) -@pytest.mark.xfail("Image may differ on GA env") +@pytest.mark.xfail(reason="Image may differ on GA env") def test_draw_test_case_by_area_creates_correct_image(random_expected_image, compare_image): # pylint: disable=W0621 """ Init PlotlyReporter and call draw_test_case_by_area with valid parameters should create correct image diff --git a/tests/engines/test_engines_plotly_reporter_draw_test_case_by_priority.py b/tests/engines/test_engines_plotly_reporter_draw_test_case_by_priority.py index df53cd3..cde648c 100644 --- a/tests/engines/test_engines_plotly_reporter_draw_test_case_by_priority.py +++ b/tests/engines/test_engines_plotly_reporter_draw_test_case_by_priority.py @@ -51,7 +51,7 @@ def test_draw_test_case_by_priority_creates_file(random_plotly_reporter): remove(filename) -@pytest.mark.xfail("Image may differ on GA env") +@pytest.mark.xfail(reason="Image may differ on GA env") def test_draw_test_case_by_priority_creates_correct_image(compare_image, random_plotly_reporter): """ Init PlotlyReporter and call draw_test_case_by_priority with valid parameters should create correct image diff --git a/tests/utils/test_reporter_utils_logger_config.py b/tests/utils/test_reporter_utils_logger_config.py index 59caa19..4e176c0 100644 --- a/tests/utils/test_reporter_utils_logger_config.py +++ b/tests/utils/test_reporter_utils_logger_config.py @@ -3,7 +3,7 @@ from logging import DEBUG, INFO, WARNING, ERROR, FATAL, FileHandler, StreamHandler from os import path, remove -from random import choice, randint +from random import choice from faker import Faker @@ -28,7 +28,7 @@ def test_setup_logger_default_level(caplog): assert isinstance(logger.handlers[0], FileHandler) assert isinstance(logger.handlers[1], StreamHandler) - message = str(fake.random_letters(randint(1, 10))) * randint(1, 10) + message = fake.name() logger.debug(message) with open(log_file, "r", encoding="utf-8") as readable_file: assert message in readable_file.read()