Skip to content

Commit

Permalink
Reorganize test code
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Spelchak committed Feb 12, 2018
1 parent 87d23cf commit 62945e7
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -778,14 +778,6 @@ def test_tool_default_destination_without_priority_not_in_job_conf(self, l):
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Finished config validation.')
)

@log_capture()
def test_default_dest_is_string_no_priorities_used(self, l):
dt.parse_yaml(path=yt.ivYMLTest160, job_conf_path=job_conf_path, test=True)
l.check(
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Running config validation...'),
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Finished config validation.')
)

@log_capture()
def test_default_dest_is_string_but_priorities_used_in_rule(self, l):
dt.parse_yaml(path=yt.ivYMLTest161, job_conf_path=job_conf_path, test=True)
Expand Down Expand Up @@ -817,6 +809,8 @@ def test_parse_valid_yml(self, l):
self.assertTrue(dt.parse_yaml(yt.vYMLTest6, job_conf_path=job_conf_path, test=True, return_bool=True))
self.assertEqual(dt.parse_yaml(yt.vYMLTest6, job_conf_path=job_conf_path, test=True), yt.vdictTest6_yml)
self.assertTrue(dt.parse_yaml(yt.vYMLTest7, job_conf_path=job_conf_path, test=True, return_bool=True))
self.assertTrue(dt.parse_yaml(yt.vYMLTest160, job_conf_path=job_conf_path, test=True, return_bool=True))
self.assertTrue(dt.parse_yaml(yt.vYMLTest164, job_conf_path=job_conf_path, test=True, return_bool=True))
self.assertEqual(dt.parse_yaml(yt.vYMLTest7, job_conf_path=job_conf_path, test=True), yt.vdictTest7_yml)
l.check(
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Running config validation...'),
Expand Down
109 changes: 93 additions & 16 deletions test/unit/jobs/dynamic_tool_destination/ymltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,99 @@
}
}
}

# No valid priorities but the tool doesn't require one
vYMLTest160 = '''
default_destination: waffles_low
default_priority: med
tools:
blah:
rules:
- rule_type: num_input_datasets
nice_value: 0
lower_bound: 0
upper_bound: Infinity
destination: waffles_default
default_destination: waffles_high
verbose: True
'''

vdictTest160_yml = {
"tools": {
"blah": {
"rules": [
{
"rule_type": "num_input_datasets",
"nice_value": 0,
"lower_bound": 0,
"upper_bound": "Infinity",
"destination": "waffles_default"
}
],
"default_destination": "waffles_high"
}
},
'default_destination': 'waffles_low',
'default_priority': 'med'
}

# No valid priorities but the tool doesn't require one
vYMLTest164 = '''
default_destination:
priority:
good: waffles_low
fast: waffles_high
default_priority: good
tools:
blah:
rules:
- rule_type: num_input_datasets
nice_value: 0
lower_bound: 0
upper_bound: Infinity
destination:
priority:
fast: lame_cluster
default_destination:
priority:
good: cluster_med_4
fast: waffles_high
verbose: True
'''

vdictTest164_yml = {
"tools": {
"blah": {
"rules": [
{
"rule_type": "num_input_datasets",
"nice_value": 0,
"lower_bound": 0,
"upper_bound": "Infinity",
"destination": {
"priority": {
"fast": "lame_cluster"
}
}
}
],
"default_destination": {
"priority": {
"good": "cluster_med_4",
"fast": "waffles_high"
}
}
}
},
'default_destination': {
"priority": {
"good": "cluster_med_4",
"fast": "waffles_high"
}
},
'default_priority': 'med'
}

# =====================================================Invalid XML tests==========================================================

# Empty file
Expand Down Expand Up @@ -1111,22 +1204,6 @@
verbose: True
'''

# No valid priorities but the tool doesn't require one
ivYMLTest160 = '''
default_destination: waffles_low
default_priority: med
tools:
blah:
rules:
- rule_type: num_input_datasets
nice_value: 0
lower_bound: 0
upper_bound: Infinity
destination: waffles_default
default_destination: waffles_high
verbose: True
'''

# No valid priorities and the tool rule requires them
ivYMLTest161 = '''
default_destination: waffles_low
Expand Down

0 comments on commit 62945e7

Please sign in to comment.