Compare commits
4 Commits
84aea8d273
...
807d4251f6
| Author | SHA1 | Date |
|---|---|---|
|
|
807d4251f6 | |
|
|
21f05f707f | |
|
|
d801e7a150 | |
|
|
f5c03f3413 |
|
|
@ -1020,6 +1020,9 @@ def test_peer_spawns_and_cancels_service_subactor(
|
|||
raise_client_error: str,
|
||||
reg_addr: tuple[str, int],
|
||||
raise_sub_spawn_error_after: float|None,
|
||||
loglevel: str,
|
||||
# ^XXX, set to 'warning' to see masked-exc warnings
|
||||
# that may transpire during actor-nursery teardown.
|
||||
):
|
||||
# NOTE: this tests for the modden `mod wks open piker` bug
|
||||
# discovered as part of implementing workspace ctx
|
||||
|
|
@ -1049,6 +1052,7 @@ def test_peer_spawns_and_cancels_service_subactor(
|
|||
# NOTE: to halt the peer tasks on ctxc, uncomment this.
|
||||
debug_mode=debug_mode,
|
||||
registry_addrs=[reg_addr],
|
||||
loglevel=loglevel,
|
||||
) as an:
|
||||
server: Portal = await an.start_actor(
|
||||
(server_name := 'spawn_server'),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ import shutil
|
|||
|
||||
import pytest
|
||||
import tractor
|
||||
from tractor import _code_load
|
||||
from tractor import (
|
||||
_code_load,
|
||||
log,
|
||||
)
|
||||
|
||||
|
||||
def test_root_pkg_not_duplicated_in_logger_name():
|
||||
|
|
@ -20,12 +23,15 @@ def test_root_pkg_not_duplicated_in_logger_name():
|
|||
project_name: str = 'pylib'
|
||||
pkg_path: str = 'pylib.subpkg.mod'
|
||||
|
||||
proj_log = tractor.log.get_logger(
|
||||
assert not tractor.current_actor(
|
||||
err_on_no_runtime=False,
|
||||
)
|
||||
proj_log = log.get_logger(
|
||||
pkg_name=project_name,
|
||||
mk_sublog=False,
|
||||
)
|
||||
|
||||
sublog = tractor.log.get_logger(
|
||||
sublog = log.get_logger(
|
||||
pkg_name=project_name,
|
||||
name=pkg_path,
|
||||
)
|
||||
|
|
@ -51,6 +57,7 @@ def test_implicit_mod_name_applied_for_child(
|
|||
mod_code: str = (
|
||||
f'import tractor\n'
|
||||
f'\n'
|
||||
# f'breakpoint()\n' # if you want to trace it all
|
||||
f'log = tractor.log.get_logger(pkg_name="{proj_name}")\n'
|
||||
)
|
||||
|
||||
|
|
@ -78,6 +85,8 @@ def test_implicit_mod_name_applied_for_child(
|
|||
pkg_subpkg_submod,
|
||||
)
|
||||
testdir.chdir()
|
||||
# NOTE, to introspect the py-file-module-layout use (in .xsh
|
||||
# syntax): `ranger @str(testdir)`
|
||||
|
||||
# XXX NOTE, once the "top level" pkg mod has been
|
||||
# imported, we can then use `import` syntax to
|
||||
|
|
@ -86,13 +95,20 @@ def test_implicit_mod_name_applied_for_child(
|
|||
Path(pkg / '__init__.py'),
|
||||
module_name=proj_name,
|
||||
)
|
||||
pkg_root_log = tractor.log.get_logger(
|
||||
pkg_root_log = log.get_logger(
|
||||
pkg_name=proj_name,
|
||||
mk_sublog=False,
|
||||
)
|
||||
# the top level pkg-mod, created just now,
|
||||
# by above API call.
|
||||
assert pkg_root_log.name == proj_name
|
||||
assert not pkg_root_log.logger.getChildren()
|
||||
#
|
||||
# ^TODO! test this same output but created via a `get_logger()`
|
||||
# call in the `snakelib.__init__py`!!
|
||||
|
||||
# a first-pkg-level module should only
|
||||
# use
|
||||
from snakelib import mod
|
||||
assert mod.log.name == proj_name
|
||||
|
||||
|
|
|
|||
|
|
@ -897,9 +897,9 @@ async def _invoke(
|
|||
)
|
||||
|
||||
logmeth(
|
||||
f'{message}\n'
|
||||
f'{message}'
|
||||
f'\n'
|
||||
f'{descr_str}\n'
|
||||
f'{descr_str}'
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ from types import ModuleType
|
|||
import warnings
|
||||
|
||||
import colorlog # type: ignore
|
||||
# ?TODO, some other (modern) alt libs?
|
||||
# import coloredlogs
|
||||
# import colored_traceback.auto # ?TODO, need better config?
|
||||
import trio
|
||||
|
||||
from ._state import current_actor
|
||||
|
|
|
|||
Loading…
Reference in New Issue