Skip to content

Commit

Permalink
Only emit path to daemon log path in pytest tmp folder (#6698)
Browse files Browse the repository at this point in the history
When working with daemon, fixture started_daemon_worker will start daemon through circus and writing logs to the log file stay in the pytest tmp folder.
It is not straightforward to find where the log file is to check the daemon log that related to the hang engine tests.
The PR write a log in debug level to print the location of the daemon log.
  • Loading branch information
unkcpz authored Jan 16, 2025
1 parent d71ef98 commit 7a460c0
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 175 deletions.
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ build:
# https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
pre_create_environment:
- asdf plugin add uv
- asdf install uv 0.5.17
- asdf global uv 0.5.17
- asdf install uv 0.5.20
- asdf global uv 0.5.20
create_environment:
- uv venv
install:
Expand Down
9 changes: 7 additions & 2 deletions src/aiida/tools/pytest_fixtures/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

from __future__ import annotations

import logging
import pathlib
import typing as t

import pytest

if t.TYPE_CHECKING:
from aiida.engine import Process, ProcessBuilder
from aiida.engine.daemon.client import DaemonClient
from aiida.orm import ProcessNode


Expand Down Expand Up @@ -47,7 +49,7 @@ def test(daemon_client):


@pytest.fixture
def started_daemon_client(daemon_client):
def started_daemon_client(daemon_client: 'DaemonClient'):
"""Ensure that the daemon is running for the test profile and return the associated client.
Usage::
Expand All @@ -60,11 +62,14 @@ def test(started_daemon_client):
daemon_client.start_daemon()
assert daemon_client.is_daemon_running

logger = logging.getLogger('tests.daemon:started_daemon_client')
logger.debug(f'Daemon log file is located at: {daemon_client.daemon_log_file}')

yield daemon_client


@pytest.fixture
def stopped_daemon_client(daemon_client):
def stopped_daemon_client(daemon_client: 'DaemonClient'):
"""Ensure that the daemon is not running for the test profile and return the associated client.
Usage::
Expand Down
Loading

0 comments on commit 7a460c0

Please sign in to comment.