mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix allow tool to just test discovered datasets.
Previously some sort of test on the base file the primary datasets were keyed on was required.
This commit is contained in:
@@ -391,15 +391,7 @@ def __parse_output_elem( output_elem ):
|
||||
if name is None:
|
||||
raise Exception( "Test output does not have a 'name'" )
|
||||
|
||||
file, attributes = __parse_test_attributes( output_elem, attrib )
|
||||
primary_datasets = {}
|
||||
for primary_elem in ( output_elem.findall( "discovered_dataset" ) or [] ):
|
||||
primary_attrib = dict( primary_elem.attrib )
|
||||
designation = primary_attrib.pop( 'designation', None )
|
||||
if designation is None:
|
||||
raise Exception( "Test primary dataset does not have a 'designation'" )
|
||||
primary_datasets[ designation ] = __parse_test_attributes( primary_elem, primary_attrib )
|
||||
attributes[ "primary_datasets" ] = primary_datasets
|
||||
file, attributes = __parse_test_attributes( output_elem, attrib, parse_discovered_datasets=True )
|
||||
return name, file, attributes
|
||||
|
||||
|
||||
@@ -436,7 +428,7 @@ def __parse_element_tests( parent_element ):
|
||||
return element_tests
|
||||
|
||||
|
||||
def __parse_test_attributes( output_elem, attrib, parse_elements=False ):
|
||||
def __parse_test_attributes( output_elem, attrib, parse_elements=False, parse_discovered_datasets=False ):
|
||||
assert_list = __parse_assert_list( output_elem )
|
||||
|
||||
# Allow either file or value to specify a target file to compare result with
|
||||
@@ -466,8 +458,18 @@ def __parse_test_attributes( output_elem, attrib, parse_elements=False ):
|
||||
if parse_elements:
|
||||
element_tests = __parse_element_tests( output_elem )
|
||||
|
||||
primary_datasets = {}
|
||||
if parse_discovered_datasets:
|
||||
for primary_elem in ( output_elem.findall( "discovered_dataset" ) or [] ):
|
||||
primary_attrib = dict( primary_elem.attrib )
|
||||
designation = primary_attrib.pop( 'designation', None )
|
||||
if designation is None:
|
||||
raise Exception( "Test primary dataset does not have a 'designation'" )
|
||||
primary_datasets[ designation ] = __parse_test_attributes( primary_elem, primary_attrib )
|
||||
|
||||
has_checksum = md5sum or checksum
|
||||
if not (assert_list or file or extra_files or metadata or has_checksum or element_tests):
|
||||
has_nested_tests = extra_files or element_tests or primary_datasets
|
||||
if not (assert_list or file or metadata or has_checksum or has_nested_tests):
|
||||
raise Exception( "Test output defines nothing to check (e.g. must have a 'file' check against, assertions to check, metadata or checksum tests, etc...)")
|
||||
attributes['assert_list'] = assert_list
|
||||
attributes['extra_files'] = extra_files
|
||||
@@ -475,6 +477,7 @@ def __parse_test_attributes( output_elem, attrib, parse_elements=False ):
|
||||
attributes['md5'] = md5sum
|
||||
attributes['checksum'] = checksum
|
||||
attributes['elements'] = element_tests
|
||||
attributes['primary_datasets'] = primary_datasets
|
||||
return file, attributes
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<tool id="tool_provided_metadata_2" name="tool_provided_metadata_2">
|
||||
<command>
|
||||
echo "Log" > $sample;
|
||||
echo "1" > sample1.report.tsv;
|
||||
echo "2" > sample2.report.tsv;
|
||||
cp $c1 galaxy.json;
|
||||
@@ -22,7 +21,6 @@
|
||||
<test>
|
||||
<param name="input" ftype="txt" value="simple_line.txt"/>
|
||||
<output name="sample">
|
||||
<assert_contents><has_text text="Log" /></assert_contents>
|
||||
<discovered_dataset designation="sample1" ftype="txt">
|
||||
<assert_contents><has_line line="1" /></assert_contents>
|
||||
<metadata name="name" value="cool name 1" />
|
||||
|
||||
Reference in New Issue
Block a user