From 4e0f265462b0d1cd2b762cbde329ef8e2718d205 Mon Sep 17 00:00:00 2001 From: noopur Date: Tue, 12 Nov 2024 10:55:15 +0000 Subject: [PATCH] Use logging directly after conftest initialisation Signed-off-by: noopur --- .github/workflows/task_runner_e2e.yml | 3 +++ tests/end_to_end/models/participants.py | 4 +++- tests/end_to_end/test_suites/sample_tests.py | 3 ++- tests/end_to_end/test_suites/task_runner_tests.py | 4 +++- tests/end_to_end/utils/conftest_helper.py | 3 ++- tests/end_to_end/utils/federation_helper.py | 4 +++- tests/end_to_end/utils/subprocess_helper.py | 3 ++- tests/end_to_end/utils/xml_helper.py | 3 --- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/task_runner_e2e.yml b/.github/workflows/task_runner_e2e.yml index a1e52df6a3..e3d8573fad 100644 --- a/.github/workflows/task_runner_e2e.yml +++ b/.github/workflows/task_runner_e2e.yml @@ -5,6 +5,9 @@ name: Task Runner E2E on: + pull_request: + branches: [ develop ] + types: [opened, synchronize, reopened, ready_for_review] schedule: - cron: '0 0 * * *' # Run every day at midnight workflow_dispatch: diff --git a/tests/end_to_end/models/participants.py b/tests/end_to_end/models/participants.py index 4881816f0e..0469868ea8 100644 --- a/tests/end_to_end/models/participants.py +++ b/tests/end_to_end/models/participants.py @@ -4,11 +4,13 @@ import os from datetime import datetime import yaml +import logging import tests.end_to_end.utils.constants as constants -from tests.end_to_end.utils.logger import logger as log import tests.end_to_end.utils.subprocess_helper as sh +log = logging.getLogger(__name__) + # Define the ModelOwner class class ModelOwner: diff --git a/tests/end_to_end/test_suites/sample_tests.py b/tests/end_to_end/test_suites/sample_tests.py index 3009eb8324..7c528277e8 100644 --- a/tests/end_to_end/test_suites/sample_tests.py +++ b/tests/end_to_end/test_suites/sample_tests.py @@ -2,10 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 import pytest +import logging -from tests.end_to_end.utils.logger import logger as log from tests.end_to_end.utils import federation_helper as fed_helper +log = logging.getLogger(__name__) # ** IMPORTANT **: This is just an example on how to add a test with below pre-requisites. # Task Runner API Test function for federation run using sample_model diff --git a/tests/end_to_end/test_suites/task_runner_tests.py b/tests/end_to_end/test_suites/task_runner_tests.py index 8fa05d3611..a80c583acf 100644 --- a/tests/end_to_end/test_suites/task_runner_tests.py +++ b/tests/end_to_end/test_suites/task_runner_tests.py @@ -2,10 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 import pytest +import logging -from tests.end_to_end.utils.logger import logger as log from tests.end_to_end.utils import federation_helper as fed_helper +log = logging.getLogger(__name__) + @pytest.mark.torch_cnn_mnist def test_torch_cnn_mnist(fx_federation): diff --git a/tests/end_to_end/utils/conftest_helper.py b/tests/end_to_end/utils/conftest_helper.py index 352e25ba4b..490a3316db 100644 --- a/tests/end_to_end/utils/conftest_helper.py +++ b/tests/end_to_end/utils/conftest_helper.py @@ -3,8 +3,9 @@ import argparse import sys +import logging -from tests.end_to_end.utils.logger import logger as log +log = logging.getLogger(__name__) def parse_arguments(): diff --git a/tests/end_to_end/utils/federation_helper.py b/tests/end_to_end/utils/federation_helper.py index 1b9d62ac6c..a4addbc49f 100644 --- a/tests/end_to_end/utils/federation_helper.py +++ b/tests/end_to_end/utils/federation_helper.py @@ -3,9 +3,11 @@ import time import concurrent.futures +import logging from tests.end_to_end.utils.constants import SUCCESS_MARKER -from tests.end_to_end.utils.logger import logger as log + +log = logging.getLogger(__name__) def setup_pki(fed_obj): diff --git a/tests/end_to_end/utils/subprocess_helper.py b/tests/end_to_end/utils/subprocess_helper.py index d11abc2f2c..ec09412762 100644 --- a/tests/end_to_end/utils/subprocess_helper.py +++ b/tests/end_to_end/utils/subprocess_helper.py @@ -4,8 +4,9 @@ import subprocess import time import traceback +import logging -from tests.end_to_end.utils.logger import logger as log +log = logging.getLogger(__name__) def run_command_background( diff --git a/tests/end_to_end/utils/xml_helper.py b/tests/end_to_end/utils/xml_helper.py index 489641dd46..b3812acc3c 100644 --- a/tests/end_to_end/utils/xml_helper.py +++ b/tests/end_to_end/utils/xml_helper.py @@ -5,8 +5,6 @@ from lxml import etree import os -from tests.end_to_end.utils.logger import logger as log - # Initialize the XML parser parser = etree.XMLParser(recover=True, encoding='utf-8') tree = ET.parse("results/results.xml", parser=parser) @@ -63,7 +61,6 @@ def get_testcase_result(): database_list.append(database_dict) status = None - log.info(f"Database list = {database_list}") return database_list