twister: Cleanup twister loggers
Removed logger.setLevel(...) from all twister modules, becasue there should be only one place where twister loggers are configured, and the log level should be set in that place. This should be done in twister_main.py in setup_logging function. Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
This commit is contained in:
parent
9946c358fc
commit
d45396a6bb
17 changed files with 9 additions and 15 deletions
|
@ -15,7 +15,6 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
supported_coverage_formats = {
|
supported_coverage_formats = {
|
||||||
"gcovr": ["html", "xml", "csv", "txt", "coveralls", "sonarqube"],
|
"gcovr": ["html", "xml", "csv", "txt", "coveralls", "sonarqube"],
|
||||||
|
|
|
@ -27,7 +27,6 @@ from twisterlib.error import TwisterRuntimeError
|
||||||
from twisterlib.log_helper import log_command
|
from twisterlib.log_helper import log_command
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
||||||
if not ZEPHYR_BASE:
|
if not ZEPHYR_BASE:
|
||||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
class TwisterException(Exception):
|
class TwisterException(Exception):
|
||||||
def __init__(self, message="TwisterException"):
|
def __init__(self, message="TwisterException"):
|
||||||
|
|
|
@ -47,7 +47,6 @@ except ImportError as capture_error:
|
||||||
raise capture_error
|
raise capture_error
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
def terminate_process(proc):
|
def terminate_process(proc):
|
||||||
|
|
|
@ -30,7 +30,6 @@ except ImportError:
|
||||||
print("Install tabulate python module with pip to use --device-testing option.")
|
print("Install tabulate python module with pip to use --device-testing option.")
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
class DUT:
|
class DUT:
|
||||||
|
|
|
@ -28,7 +28,6 @@ from twisterlib.statuses import TwisterStatus
|
||||||
from twisterlib.testinstance import TestInstance
|
from twisterlib.testinstance import TestInstance
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
_WINDOWS = platform.system() == 'Windows'
|
_WINDOWS = platform.system() == 'Windows'
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
class JobHandle:
|
class JobHandle:
|
||||||
"""Small object to handle claim of a job."""
|
"""Small object to handle claim of a job."""
|
||||||
|
|
|
@ -12,6 +12,7 @@ import shlex
|
||||||
|
|
||||||
_WINDOWS = platform.system() == 'Windows'
|
_WINDOWS = platform.system() == 'Windows'
|
||||||
|
|
||||||
|
|
||||||
def log_command(logger, msg, args):
|
def log_command(logger, msg, args):
|
||||||
'''Platform-independent helper for logging subprocess invocations.
|
'''Platform-independent helper for logging subprocess invocations.
|
||||||
Will log a command string that can be copy/pasted into a POSIX
|
Will log a command string that can be copy/pasted into a POSIX
|
||||||
|
|
|
@ -18,7 +18,6 @@ from twisterlib.constants import SUPPORTED_SIMS
|
||||||
from twisterlib.environment import ZEPHYR_BASE
|
from twisterlib.environment import ZEPHYR_BASE
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
class Simulator:
|
class Simulator:
|
||||||
|
|
|
@ -17,7 +17,6 @@ from colorama import Fore
|
||||||
from twisterlib.statuses import TwisterStatus
|
from twisterlib.statuses import TwisterStatus
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
class ReportStatus(str, Enum):
|
class ReportStatus(str, Enum):
|
||||||
|
|
|
@ -61,7 +61,6 @@ import expr_parser
|
||||||
from anytree import Node, RenderTree
|
from anytree import Node, RenderTree
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
class ExecutionCounter:
|
class ExecutionCounter:
|
||||||
|
|
|
@ -13,7 +13,7 @@ import sys
|
||||||
from twisterlib.error import TwisterRuntimeError
|
from twisterlib.error import TwisterRuntimeError
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
class SizeCalculator:
|
class SizeCalculator:
|
||||||
alloc_sections = [
|
alloc_sections = [
|
||||||
|
|
|
@ -36,7 +36,7 @@ from twisterlib.statuses import TwisterStatus
|
||||||
from twisterlib.testsuite import TestCase, TestSuite
|
from twisterlib.testsuite import TestCase, TestSuite
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
class TestInstance:
|
class TestInstance:
|
||||||
"""Class representing the execution of a particular TestSuite on a platform
|
"""Class representing the execution of a particular TestSuite on a platform
|
||||||
|
|
|
@ -38,7 +38,6 @@ from twisterlib.testsuite import TestSuite, scan_testsuite_path
|
||||||
from zephyr_module import parse_modules
|
from zephyr_module import parse_modules
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
||||||
if not ZEPHYR_BASE:
|
if not ZEPHYR_BASE:
|
||||||
|
|
|
@ -18,7 +18,6 @@ from twisterlib.mixins import DisablePyTestCollectionMixin
|
||||||
from twisterlib.statuses import TwisterStatus
|
from twisterlib.statuses import TwisterStatus
|
||||||
|
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
class ScanPathResult:
|
class ScanPathResult:
|
||||||
"""Result of the scan_tesuite_path function call.
|
"""Result of the scan_tesuite_path function call.
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
'''Common fixtures for use in testing the twister tool.'''
|
'''Common fixtures for use in testing the twister tool.'''
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
pytest_plugins = ["pytester"]
|
pytest_plugins = ["pytester"]
|
||||||
|
logging.getLogger("twister").setLevel(logging.DEBUG) # requires for testing twister
|
||||||
|
|
||||||
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
||||||
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister"))
|
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister"))
|
||||||
|
|
|
@ -12,6 +12,8 @@ import os
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
logging.getLogger("twister").setLevel("DEBUG") # requires for testing twister
|
||||||
|
|
||||||
ZEPHYR_BASE = os.getenv('ZEPHYR_BASE')
|
ZEPHYR_BASE = os.getenv('ZEPHYR_BASE')
|
||||||
TEST_DATA = os.path.join(ZEPHYR_BASE, 'scripts', 'tests',
|
TEST_DATA = os.path.join(ZEPHYR_BASE, 'scripts', 'tests',
|
||||||
'twister_blackbox', 'test_data')
|
'twister_blackbox', 'test_data')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue