Skip to content

Commit

Permalink
More test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-intel committed Dec 2, 2024
1 parent d60963b commit b51f591
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion metaflow/user_configs/config_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def convert(self, value, param, ctx):
return value
if value.startswith(_DEFAULT_PREFIX):
is_default = True
value = value[len(_DEFAULT_PREFIX) :]

return self.convert_value(value, is_default)

Expand Down Expand Up @@ -233,7 +234,8 @@ def process_configs(self, ctx, param, value):
# would cause an issue -- we can ignore those as the kv. values should trump
# everything else.
all_keys = set(self._value_values).union(self._path_values)
has_all_kv = all(
# Make sure we have at least some keys (ie: some non default values)
has_all_kv = all_keys and all(
self._value_values.get(k, "").startswith(_CONVERT_PREFIX + "kv.")
for k in all_keys
)
Expand Down
1 change: 1 addition & 0 deletions test/core/metaflow_test/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, graphspec, test):
self.steps = self._index_steps(test)
self.flow_code = self._pretty_print(self._flow_lines())
self.check_code = self._pretty_print(self._check_lines())
self.copy_files = getattr(test, "REQUIRED_FILES", [])
self.valid = True

for step in self.steps:
Expand Down
4 changes: 4 additions & 0 deletions test/core/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ def construct_arg_dicts_from_click_api():
os.path.join(cwd, "metaflow_test"), os.path.join(tempdir, "metaflow_test")
)

# Copy files required by the test
for file in formatter.copy_files:
shutil.copy2(os.path.join(cwd, "tests", file), os.path.join(tempdir, file))

path = os.path.join(tempdir, "test_flow.py")

original_env = os.environ.copy()
Expand Down
1 change: 1 addition & 0 deletions test/core/tests/basic_config_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class BasicConfigTest(MetaflowTest):
PRIORITY = 1
REQUIRED_FILES = ["basic_config_silly.txt"]
PARAMETERS = {
"default_from_config": {
"default": "config_expr('config2').default_param",
Expand Down

0 comments on commit b51f591

Please sign in to comment.