Skip to content

Commit

Permalink
would only be used in API context, so drop cli/api switch
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacpherson committed Jan 31, 2025
1 parent c72c320 commit ed0efe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 3 additions & 11 deletions test/core/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,8 @@ def construct_arg_dicts_from_click_api():

return top_level_dict, run_level_dict

def get_test_runtime_parameters(test, executor_type):
"""Get any runtime parameters defined by the test for a specific executor type.
Args:
test: MetaflowTest instance
executor_type: "api" or "cli"
"""
# Allow tests to specify runtime params specific to each executor
runtime_params = getattr(test, "RUNTIME_PARAMETERS", {})
return runtime_params.get(executor_type, {})
def get_test_runtime_parameters(test):
return getattr(test, "RUNTIME_PARAMETERS", {})

cwd = os.getcwd()
tempdir = tempfile.mkdtemp("_metaflow_test")
Expand Down Expand Up @@ -260,7 +252,7 @@ def get_test_runtime_parameters(test, executor_type):
)
elif executor == "api":
top_level_dict, run_level_dict = construct_arg_dicts_from_click_api()
run_level_dict |= get_test_runtime_parameters(formatter.test, "api")
run_level_dict |= get_test_runtime_parameters(formatter.test)
runner = Runner(
"test_flow.py", show_output=False, env=env, **top_level_dict
)
Expand Down
3 changes: 1 addition & 2 deletions test/core/tests/basic_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ class BasicParameterTest(MetaflowTest):
"list_param": {"separator": "','", "default": '"a,b,c"'},
"json_param": {"default": """'{"a": [1,2,3]}'""", "type": "JSONType"},
}
RUNTIME_PARAMETERS = {"api": {"json_param": {"a": [1, 2, 3]}}}
RUNTIME_PARAMETERS = {"json_param": {"a": [1, 2, 3]}}
HEADER = """
import os
os.environ['METAFLOW_RUN_NO_DEFAULT_PARAM'] = 'test_str'
os.environ['METAFLOW_RUN_BOOL_PARAM'] = 'False'
os.environ['METAFLOW_RUN_JSON_PARAM'] = '{"a": [1,2,3]}'
"""

@steps(0, ["all"])
Expand Down

0 comments on commit ed0efe2

Please sign in to comment.