From 49fbed76ceff6aafcbeaa849cec832c21053e42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Tue, 21 Feb 2023 10:11:53 +0000 Subject: [PATCH] style(#3969): fit pep8 --- deps/wazuh_testing/wazuh_testing/tools/__init__.py | 10 ++++------ tests/integration/conftest.py | 2 +- .../test_agentd_parametrized_reconnections.py | 1 + .../test_agentd/test_agentd_reconnection.py | 1 + .../test_gcloud/test_functionality/test_interval.py | 2 +- .../test_functionality/test_max_messages.py | 2 +- .../test_gcloud/test_functionality/test_rules.py | 1 - tests/integration/test_wpk/test_wpk_agent.py | 2 +- tests/integration/test_wpk/test_wpk_manager.py | 2 -- .../test_wpk/test_wpk_manager_task_states.py | 7 +++---- tests/performance/test_api/conftest.py | 3 ++- 11 files changed, 15 insertions(+), 18 deletions(-) diff --git a/deps/wazuh_testing/wazuh_testing/tools/__init__.py b/deps/wazuh_testing/wazuh_testing/tools/__init__.py index 6e9b7156bc..f73e06f54a 100644 --- a/deps/wazuh_testing/wazuh_testing/tools/__init__.py +++ b/deps/wazuh_testing/wazuh_testing/tools/__init__.py @@ -98,9 +98,8 @@ def get_version(): return version[:version.rfind('\n')] else: # Linux, sunos5, darwin, aix... - return subprocess.check_output([ - f"{WAZUH_PATH}/bin/wazuh-control", "info", "-v" - ], stderr=subprocess.PIPE).decode('utf-8').rstrip() + return subprocess.check_output([f"{WAZUH_PATH}/bin/wazuh-control", "info", "-v"], + stderr=subprocess.PIPE).decode('utf-8').rstrip() except Exception: return 'N/A' @@ -110,9 +109,8 @@ def get_service(): service = 'wazuh-agent' else: # Linux, sunos5, darwin, aix... try: - output = subprocess.check_output([ - f"{WAZUH_PATH}/bin/wazuh-control", "info", "-t" - ], stderr=subprocess.PIPE).decode('utf-8').strip() + output = subprocess.check_output([f"{WAZUH_PATH}/bin/wazuh-control", "info", "-t"], + stderr=subprocess.PIPE).decode('utf-8').strip() service = 'wazuh-manager' if service == 'server' else 'wazuh-agent' except Exception: service = 'N/A' diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 6740fe9e4c..ccf9eb5559 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -345,6 +345,7 @@ def pytest_addoption(parser): help="Avoid tests deselection based on current environment" ) + def pytest_configure(config): # Register an additional marker config.addinivalue_line( @@ -417,7 +418,6 @@ def pytest_configure(config): global_parameters.avoid_platform_based_deselection = config.getoption("--avoid-platform-based-deselection") - def pytest_html_results_table_header(cells): cells.insert(4, html.th('Tier', class_='sortable tier', col='tier')) cells.insert(3, html.th('Markers')) diff --git a/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py b/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py index 12640d9ada..6b28efa1e0 100644 --- a/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py +++ b/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py @@ -258,6 +258,7 @@ def wait_unable_to_connect(line): return line return None + @pytest.fixture(scope="module") def change_timeout(): """Set agent.recv_timeout for agentd in local internal options file. diff --git a/tests/integration/test_agentd/test_agentd_reconnection.py b/tests/integration/test_agentd/test_agentd_reconnection.py index 3a1f655dd6..a52a8fdb7a 100644 --- a/tests/integration/test_agentd/test_agentd_reconnection.py +++ b/tests/integration/test_agentd/test_agentd_reconnection.py @@ -107,6 +107,7 @@ def teardown(): if remoted_server is not None: remoted_server.stop() + @pytest.fixture(scope="module", autouse=True) def set_debug_mode(): """Set debug2 for agentd in local internal options file.""" diff --git a/tests/integration/test_gcloud/test_functionality/test_interval.py b/tests/integration/test_gcloud/test_functionality/test_interval.py index 3d5365e953..555c3cd142 100644 --- a/tests/integration/test_gcloud/test_functionality/test_interval.py +++ b/tests/integration/test_gcloud/test_functionality/test_interval.py @@ -93,8 +93,8 @@ configurations = load_wazuh_configurations(configurations_path, __name__, params=p, metadata=m) -# Preparing +# Preparing @pytest.fixture(scope='module', autouse=True) def truncate_logs(): """Truncate the 'ossec.log' file.""" diff --git a/tests/integration/test_gcloud/test_functionality/test_max_messages.py b/tests/integration/test_gcloud/test_functionality/test_max_messages.py index cbfd4336e1..1770cd7869 100644 --- a/tests/integration/test_gcloud/test_functionality/test_max_messages.py +++ b/tests/integration/test_gcloud/test_functionality/test_max_messages.py @@ -100,8 +100,8 @@ configurations = load_wazuh_configurations(configurations_path, __name__, params=p, metadata=m) -# Preparing +# Preparing @pytest.fixture(scope='module', autouse=True) def truncate_logs(): """Truncate the 'ossec.log' file.""" diff --git a/tests/integration/test_gcloud/test_functionality/test_rules.py b/tests/integration/test_gcloud/test_functionality/test_rules.py index 081463ed77..0157b289c9 100644 --- a/tests/integration/test_gcloud/test_functionality/test_rules.py +++ b/tests/integration/test_gcloud/test_functionality/test_rules.py @@ -99,7 +99,6 @@ def truncate_logs(): # fixtures - @pytest.fixture(scope='module', params=configurations) def get_configuration(request): """Get configurations from the module.""" diff --git a/tests/integration/test_wpk/test_wpk_agent.py b/tests/integration/test_wpk/test_wpk_agent.py index e9c52fa795..b64e870c5a 100644 --- a/tests/integration/test_wpk/test_wpk_agent.py +++ b/tests/integration/test_wpk/test_wpk_agent.py @@ -508,7 +508,7 @@ def test_wpk_agent(get_configuration, prepare_agent_version, download_wpk, remoted_simulator.change_default_listener = True event = wazuh_log_monitor.start(timeout=timeout_ack_response, error_message='ACK event not received', - callback=callback_detect_upgrade_ack_event).result() + callback=callback_detect_upgrade_ack_event).result() result = event['parameters'] if result is not None: diff --git a/tests/integration/test_wpk/test_wpk_manager.py b/tests/integration/test_wpk/test_wpk_manager.py index bfcac57ba0..e311841d65 100644 --- a/tests/integration/test_wpk/test_wpk_manager.py +++ b/tests/integration/test_wpk/test_wpk_manager.py @@ -87,8 +87,6 @@ time_until_ask_upgrade_result = 30 max_upgrade_result_status_retries = 30 - - version_to_upgrade = global_parameters.wpk_version[0] if global_parameters.wpk_version else 'v4.4.0' MANAGER_VERSION = get_version() diff --git a/tests/integration/test_wpk/test_wpk_manager_task_states.py b/tests/integration/test_wpk/test_wpk_manager_task_states.py index a84e7a87de..f6874ce6cb 100644 --- a/tests/integration/test_wpk/test_wpk_manager_task_states.py +++ b/tests/integration/test_wpk/test_wpk_manager_task_states.py @@ -424,10 +424,9 @@ def test_wpk_manager_task_states(get_configuration, configure_environment, # Chech that result of first attempt is Success assert new_expected_response[agents_id.index(agent_id)] == \ - response['data'][0]['message'], \ - f'New upgrade response did not match expected! ' \ - f'Expected {new_expected_response} obtained ' \ - f'{response["data"][0]["message"]}' + response['data'][0]['message'], f'New upgrade response did not match expected! ' \ + f'Expected {new_expected_response} obtained ' \ + f'{response["data"][0]["message"]}' for injector in injectors: injector.stop_receive() diff --git a/tests/performance/test_api/conftest.py b/tests/performance/test_api/conftest.py index f745964c04..f3b11884b2 100755 --- a/tests/performance/test_api/conftest.py +++ b/tests/performance/test_api/conftest.py @@ -110,7 +110,8 @@ def pytest_html_results_table_row(report, cells): cells[2] = HTMLStyle.colored_td(report.user_properties[0][1]) cells[3] = HTMLStyle.colored_td(str(report.user_properties[2][1])) cells.append(HTMLStyle.colored_td(str(report.user_properties[3][1]))) - cells.append(HTMLStyle.colored_td(u'\u2713' if len(report.user_properties) > 4 and report.user_properties[4][1] else '')) + cells.append(HTMLStyle.colored_td(u'\u2713' if len(report.user_properties) > 4 and report.user_properties[4][1] + else '')) cells.append(HTMLStyle.colored_td(f'{report.duration:.3f} s')) except AttributeError: