- Split transaction logger (kanta.changes) and migration logger (kanta.migrations). - Migrations.apply() now returns MigrationResult instead of logging. - Kanta.open() emits one info summary per DB and debug transaction per migration. - Add open(log=...) to suppress/redirect default migration logging. - Add @kanta.logmigr callback for custom migration logging/summaries. - Add transaction(log=...) to suppress/redirect transaction logging. - Update tests for the new MigrationResult API and logging behaviour.
17 lines
387 B
Python
17 lines
387 B
Python
import logging
|
|
|
|
from kanta.logging import changes_logger, configure_logging, log_change
|
|
|
|
|
|
def test_configure_logging():
|
|
configure_logging()
|
|
assert changes_logger.level == logging.INFO
|
|
|
|
|
|
def test_log_change_no_diff(capsys):
|
|
changes_logger.handlers.clear()
|
|
configure_logging()
|
|
log_change("test", {})
|
|
captured = capsys.readouterr()
|
|
assert "test" in captured.err
|