def test_null_handler(caplog, capsys): log.set_null_handler() log.warn("warn") log.debug("debug") out, err = capsys.readouterr() assert "warn" not in err and "warn" not in out assert "debug" not in err and "debug" not in out log.clear_null_handler() print_diagram() log.warn("warn") log.debug("debug") out, err = capsys.readouterr() assert "warn" in err and "warn" not in out assert "debug" not in err and "debug" in out
from_csv, from_xls, from_xlsx, csv_column_names, first_n_lines, detect_enc, detect_string_enc, smart_open, dicts_from_rows, ) from .uuids import deterministic_uuid # noqa from .resources import resource_path, resource_stream, resource_data # noqa from .itercsv import fast_csv_it # noqa from .cleaning import standardize_key, standardized_key_mapping # noqa from .sqlutil import create_table_statement # noqa from .typeguess import ( # noqa guess_value_type, guess_column_type, guess_sql_column_type, ) from sqlbag import create_database # noqa from sqlbag.pg import use_pendulum_for_time_types # noqa from logx import log log.set_null_handler() use_pendulum_for_time_types()
import io import os import yaml from logx import log log.set_null_handler("logxutil") ENV_YAML = ".env.yaml" def load_env_yaml(path=None): path = path or ENV_YAML try: with io.open(path) as r: log.info(f"loading env vars from yaml: {path}") env_vars = yaml.load(r, Loader=yaml.FullLoader) os.environ.update(env_vars) except FileNotFoundError: log.info(f"local env file not found at {path}, not loading") def env(name): return os.environ[name]