def cli(): toplog = logging.getLogger(__name__.split(".")[0]) set_log(toplog) args = get_cli_parser().parse_args() if args.verbose: set_log_level(toplog, logging.DEBUG) command_class = all_commands[args.action] command = command_class({}, args) if args.action == "init": sys.exit(command.run()) with change_cwd(args.spec_repo_dir): command.config = Config.from_file(os.path.join(args.config_dir, constants.DEFAULT_CONFIG_FILE)) sys.exit(command.run())
def test_set_log_level_critical(caplog): set_log_level(log, "CRITICAL") for record in caplog.records: assert "CRITICAL" in record assert "INFO" not in record
def test_set_log_level(caplog): set_log_level(log, "INFO") for record in caplog.records: assert "INFO" in record assert "DEBUG" not in record