Removed duplicate logging messages

This commit is contained in:
Qubasa
2024-01-11 22:46:29 +01:00
parent 2c6c4bacce
commit f087f527cc
3 changed files with 15 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ def run(
check: bool = True, check: bool = True,
error_msg: str | None = None, error_msg: str | None = None,
) -> CmdOut: ) -> CmdOut:
glog.debug(f"running command: {shlex.join(cmd)}. Caller: {get_caller()}") glog.debug(f"$: {shlex.join(cmd)} \nCaller: {get_caller()}")
# Start the subprocess # Start the subprocess
process = subprocess.Popen( process = subprocess.Popen(
cmd, cmd,

View File

@@ -5,6 +5,7 @@ from pathlib import Path
import pytest import pytest
from clan_cli.custom_logger import setup_logging
from clan_cli.nix import nix_shell from clan_cli.nix import nix_shell
sys.path.append(os.path.join(os.path.dirname(__file__), "helpers")) sys.path.append(os.path.join(os.path.dirname(__file__), "helpers"))
@@ -21,6 +22,16 @@ pytest_plugins = [
] ]
# Executed on pytest session start
def pytest_sessionstart(session: pytest.Session) -> None:
# This function will be called once at the beginning of the test session
print("Starting pytest session")
# You can access the session config, items, testsfailed, etc.
print(f"Session config: {session.config}")
setup_logging(level="DEBUG")
# fixture for git_repo # fixture for git_repo
@pytest.fixture @pytest.fixture
def git_repo(tmp_path: Path) -> Path: def git_repo(tmp_path: Path) -> Path:

View File

@@ -3,7 +3,7 @@ import logging
import shlex import shlex
from clan_cli import create_parser from clan_cli import create_parser
from clan_cli.custom_logger import get_caller, setup_logging from clan_cli.custom_logger import get_caller
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -12,10 +12,8 @@ class Cli:
def run(self, args: list[str]) -> argparse.Namespace: def run(self, args: list[str]) -> argparse.Namespace:
parser = create_parser(prog="clan") parser = create_parser(prog="clan")
parsed = parser.parse_args(args) parsed = parser.parse_args(args)
setup_logging(logging.DEBUG) cmd = shlex.join(["clan", *args])
cmd = shlex.join(["clan", "--debug", *args]) log.debug(f"$ {cmd} \nCaller: {get_caller()}")
log.debug(f"$ {cmd}")
log.debug(f"Caller {get_caller()}")
if hasattr(parsed, "func"): if hasattr(parsed, "func"):
parsed.func(parsed) parsed.func(parsed)
return parsed return parsed