Add `log` fixture for easy test plugin
parent
7cc9911565
commit
9a00c45923
|
@ -1,5 +1,6 @@
|
||||||
from contextlib import asynccontextmanager as acm
|
from contextlib import asynccontextmanager as acm
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ from piker import (
|
||||||
from piker.service import (
|
from piker.service import (
|
||||||
Services,
|
Services,
|
||||||
)
|
)
|
||||||
|
from piker.log import get_console_log
|
||||||
from piker.clearing._client import open_ems
|
from piker.clearing._client import open_ems
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +69,21 @@ def ci_env() -> bool:
|
||||||
return _ci_env
|
return _ci_env
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def log(
|
||||||
|
request: pytest.FixtureRequest,
|
||||||
|
loglevel: str,
|
||||||
|
) -> logging.Logger:
|
||||||
|
'''
|
||||||
|
Deliver a per-test-named ``piker.log`` instance.
|
||||||
|
|
||||||
|
'''
|
||||||
|
return get_console_log(
|
||||||
|
level=loglevel,
|
||||||
|
name=request.node.name,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@acm
|
@acm
|
||||||
async def _open_test_pikerd(
|
async def _open_test_pikerd(
|
||||||
tmpconfdir: str,
|
tmpconfdir: str,
|
||||||
|
|
Loading…
Reference in New Issue