Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasjacobsen committed Apr 3, 2024
1 parent fee069a commit 7439dc3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/ramble/ramble/test/experiment_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ def test_chained_invalid_order_errors(mutable_mock_workspace_path, capsys):
assert "Invalid experiment chain defined:" in captured


def test_modifiers_set_correctly(mutable_mock_workspace_path, capsys):
def test_modifiers_set_correctly(mutable_mock_workspace_path, mock_modifiers, capsys):
workspace('create', 'test')

assert 'test' in workspace('list')
Expand All @@ -1287,8 +1287,8 @@ def test_modifiers_set_correctly(mutable_mock_workspace_path, capsys):
}
application_context.modifiers = [
{
'name': 'test_app_mod',
'mode': 'test_app',
'name': 'test-mod',
'mode': 'app-scope',
'on_executable': [
'builtin::env_vars'
]
Expand All @@ -1303,8 +1303,8 @@ def test_modifiers_set_correctly(mutable_mock_workspace_path, capsys):
}
workload_context.modifiers = [
{
'name': 'test_wl_mod',
'mode': 'test_wl',
'name': 'test-mod',
'mode': 'wl-scope',
'on_executable': [
'builtin::env_vars'
]
Expand All @@ -1318,8 +1318,8 @@ def test_modifiers_set_correctly(mutable_mock_workspace_path, capsys):
}
experiment_context.modifiers = [
{
'name': 'test_exp1_mod',
'mode': 'test_exp1',
'name': 'test-mod',
'mode': 'exp-scope',
'on_executable': [
'builtin::env_vars'
]
Expand All @@ -1334,11 +1334,11 @@ def test_modifiers_set_correctly(mutable_mock_workspace_path, capsys):
app_inst = exp_set.experiments['basic.test_wl.test1']
assert app_inst.modifiers is not None

expected_modifiers = set(['test_app_mod', 'test_wl_mod', 'test_exp1_mod'])
expected_modifier_modes = set(['app-scope', 'wl-scope', 'exp-scope'])
for mod_def in app_inst.modifiers:
assert mod_def['name'] in expected_modifiers
expected_modifiers.remove(mod_def['name'])
assert len(expected_modifiers) == 0
assert mod_def['mode'] in expected_modifier_modes
expected_modifier_modes.remove(mod_def['mode'])
assert len(expected_modifier_modes) == 0


def test_explicit_zips_work(mutable_mock_workspace_path):
Expand Down
6 changes: 6 additions & 0 deletions var/ramble/repos/builtin.mock/modifiers/test-mod/modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class TestMod(BasicModifier):

mode('test', description='This is a test mode')

mode('app-scope', description='This is a test mode at the application scope')

mode('wl-scope', description='This is a test mode at the workload scope')

mode('exp-scope', description='This is a test mode at the experiment scope')

variable_modification('mpi_command', 'echo "prefix_mpi_command" >> {log_file}; ', method='prepend', modes=['test'])

variable_modification('analysis_log', '{experiment_run_dir}/test_analysis.log', method='set', modes=['test'])
Expand Down

0 comments on commit 7439dc3

Please sign in to comment.