Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
import json
import logging
import logging.config
import os
import sys
import textwrap
import jsonschema
import pytest
from dockerflow.logging import JsonLogFormatter
logger_name = "tests"
formatter = JsonLogFormatter(logger_name=logger_name)
def assert_records(records):
assert len(records) == 1
details = json.loads(formatter.format(records[0]))
jsonschema.validate(details, JSON_LOGGING_SCHEMA)
return details
def test_initialization_from_ini(caplog, tmpdir):
ini_content = textwrap.dedent(
"""
[loggers]
keys = root
[handlers]