Skip to content

Commit

Permalink
fix: fix enum handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Zane Clark authored and Zane Clark committed Aug 15, 2024
1 parent 0a31ee7 commit ee104d3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions schemachange/config/get_merged_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import sys
from argparse import Namespace
from enum import Enum
from pathlib import Path
from typing import Union, Optional

Expand Down Expand Up @@ -63,6 +64,13 @@ def get_yaml_config(

def get_merged_config() -> Union[DeployConfig, RenderConfig]:
args = parse_cli_args(sys.argv[1:])
if (
"log_level" in args
and args.log_level is not None
and isinstance(args.log_level, Enum)
):
args.log_level = args.log_level.value

cli_config = config_factory(args=args)
yaml_config = get_yaml_config(
subcommand=cli_config.subcommand,
Expand Down
16 changes: 16 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@
},
None,
),
(
"schemachange.cli.deploy",
[
"schemachange",
"deploy",
*required_args,
"--log-level",
"INFO",
],
{
**default_deploy_config,
**required_config,
"log_level": 20,
},
None,
),
(
"schemachange.cli.render",
[
Expand Down

0 comments on commit ee104d3

Please sign in to comment.