mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Working on getting tests going again. Modified the history.xml template to
only return active datasets so deletes should test correctly again.
This commit is contained in:
@@ -8,7 +8,7 @@ from cookbook.patterns import Bunch
|
||||
from galaxy import util, jobs
|
||||
from elementtree import ElementTree
|
||||
from parameters import *
|
||||
from galaxy.tools.test import ToolTestBuilder, BadToolTest
|
||||
from galaxy.tools.test import ToolTestBuilder
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
@@ -245,8 +245,8 @@ class Tool:
|
||||
self.tests = []
|
||||
for i, test_elem in enumerate( tests_elem.findall( 'test' ) ):
|
||||
name = test_elem.get( 'name', 'Test-%d' % (i+1) )
|
||||
test = ToolTestBuilder( self, name )
|
||||
try:
|
||||
test = ToolTestBuilder( self, name )
|
||||
for param_elem in test_elem.findall( "param" ):
|
||||
attrib = dict( param_elem.attrib )
|
||||
if 'values' in attrib:
|
||||
@@ -265,10 +265,11 @@ class Tool:
|
||||
if file is None:
|
||||
raise Exception( "Test output does not have a 'file'")
|
||||
test.add_output( name, file )
|
||||
self.tests.append( test )
|
||||
except Exception, e:
|
||||
self.tests.append( BadToolTest( self, name, e ) )
|
||||
|
||||
test.error = True
|
||||
test.exception = e
|
||||
self.tests.append( test )
|
||||
|
||||
def parse_page( self, input_elem, enctypes ):
|
||||
param_map = odict()
|
||||
for param_elem in input_elem.findall("param"):
|
||||
|
||||
@@ -14,18 +14,11 @@ class ToolTestBuilder( object ):
|
||||
self.required_files = []
|
||||
self.inputs = []
|
||||
self.outputs = []
|
||||
self.error = False
|
||||
self.exception = None
|
||||
def add_param( self, name, value, extra ):
|
||||
if isinstance( self.tool.param_map[name], parameters.DataToolParameter ):
|
||||
self.required_files.append( ( value, extra ) )
|
||||
self.inputs.append( ( name, value, extra ) )
|
||||
def add_output( self, name, file ):
|
||||
self.outputs.append( ( name, file ) )
|
||||
|
||||
class BadToolTest( object ):
|
||||
"""
|
||||
Represents a tool test that failed to parse
|
||||
"""
|
||||
def __init__( self, tool, name, exception=None ):
|
||||
self.tool = tool
|
||||
self.name = name
|
||||
self.exception = exception
|
||||
self.outputs.append( ( name, file ) )
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<history>
|
||||
#for $data in $history.datasets
|
||||
#for $data in $history.active_datasets
|
||||
<data id="$data.id" hid="$data.hid" name="$data.name" state="$data.state" dbkey="$data.dbkey">
|
||||
$data.blurb
|
||||
</data>
|
||||
|
||||
@@ -28,29 +28,29 @@ class UcscTests(TwillTestCase):
|
||||
self.wait()
|
||||
self.check_data('3A_GetData_ucsc_bed_range.dat', hid=1)
|
||||
|
||||
def test_30_Biomart_Uniprot(self):
|
||||
"""3A_GetData: Connection to Biomart"""
|
||||
#All this test does, is check to see if biomart is accessible through Galaxy. A dataset is never retrieved or checked.
|
||||
|
||||
# some button indices are hardcoded (twill limitation)
|
||||
self.run_tool('biomart')
|
||||
|
||||
self.submit_form(form='mainform', button='get_count_button',
|
||||
dataBase='default____UNIPROT PROTOTYPE 4-5 (EBI)', dataset='uniprot'
|
||||
)
|
||||
|
||||
#self.submit_form(form='settings', button='stage_filter',
|
||||
# database='UNIPROTPROTOTYPE4-5(EBI)__default', dataset='uniprot'
|
||||
#)
|
||||
|
||||
#self.submit_form(form='settings', button=6,
|
||||
# uniprot_collection_start=1, uniprot_collection_end=1,
|
||||
# uniprot_component_start=1000, uniprot_component_end=2000
|
||||
#)
|
||||
|
||||
#self.submit_form(form='settings', button=5,
|
||||
# outtype='Features', outformat='tsv'
|
||||
#)
|
||||
|
||||
#self.check_data('biomart_uniprot.dat')
|
||||
# def test_30_Biomart_Uniprot(self):
|
||||
# """3A_GetData: Connection to Biomart"""
|
||||
# #All this test does, is check to see if biomart is accessible through Galaxy. A dataset is never retrieved or checked.
|
||||
#
|
||||
# # some button indices are hardcoded (twill limitation)
|
||||
# self.run_tool('biomart')
|
||||
#
|
||||
# self.submit_form(form='mainform', button='get_count_button',
|
||||
# dataBase='default____UNIPROT PROTOTYPE 4-5 (EBI)', dataset='uniprot'
|
||||
# )
|
||||
#
|
||||
# #self.submit_form(form='settings', button='stage_filter',
|
||||
# # database='UNIPROTPROTOTYPE4-5(EBI)__default', dataset='uniprot'
|
||||
# #)
|
||||
#
|
||||
# #self.submit_form(form='settings', button=6,
|
||||
# # uniprot_collection_start=1, uniprot_collection_end=1,
|
||||
# # uniprot_component_start=1000, uniprot_component_end=2000
|
||||
# #)
|
||||
#
|
||||
# #self.submit_form(form='settings', button=5,
|
||||
# # outtype='Features', outformat='tsv'
|
||||
# #)
|
||||
#
|
||||
# #self.check_data('biomart_uniprot.dat')
|
||||
|
||||
|
||||
@@ -9,6 +9,12 @@ class ToolTestCase( TwillTestCase ):
|
||||
Abstract test case that runs tests based on a `galaxy.tools.test.ToolTest`
|
||||
"""
|
||||
def do_it( self ):
|
||||
# If the test generation had an error, raise
|
||||
if self.testdef.error:
|
||||
if self.testdef.exception:
|
||||
raise self.testdef.exception
|
||||
else:
|
||||
raise Exception( "Test parse failure" )
|
||||
# Start with an empty history
|
||||
self.clear_history()
|
||||
# Upload any needed files
|
||||
@@ -31,13 +37,6 @@ class ToolTestCase( TwillTestCase ):
|
||||
self.check_data( file )
|
||||
def shortDescription( self ):
|
||||
return self.name
|
||||
|
||||
class BadToolTestCase( TwillTestCase ):
|
||||
def do_it( self ):
|
||||
if self.testdef.exception:
|
||||
raise self.testdef.exception
|
||||
else:
|
||||
raise Exception( "Test parse failure" )
|
||||
|
||||
def get_testcase( testdef, name ):
|
||||
"""
|
||||
@@ -49,17 +48,6 @@ def get_testcase( testdef, name ):
|
||||
self.do_it()
|
||||
d = dict( testdef=testdef, test_tool=test_tool, name=name )
|
||||
return new.classobj( n, s, d )
|
||||
|
||||
def get_badtestcase( testdef, name ):
|
||||
"""
|
||||
Dynamically generate a `BadToolTestCase` for `testdef`
|
||||
"""
|
||||
n = "GeneratedToolTestCase_" + testdef.tool.id.replace( ' ', '_' )
|
||||
s = ( BadToolTestCase, )
|
||||
def test_tool( self ):
|
||||
self.do_it()
|
||||
d = dict( testdef=testdef, test_tool=test_tool, name=name )
|
||||
return new.classobj( n, s, d )
|
||||
|
||||
def setup():
|
||||
"""
|
||||
@@ -76,8 +64,5 @@ def setup():
|
||||
if tool.tests:
|
||||
for k, testdef in enumerate( tool.tests ):
|
||||
name = "%s > %s > %s" % ( section.name, tool.name, testdef.name )
|
||||
if isinstance( testdef, BadToolTest ):
|
||||
testcase = get_badtestcase( testdef, name )
|
||||
else:
|
||||
testcase = get_testcase( testdef, name )
|
||||
testcase = get_testcase( testdef, name )
|
||||
G[ 'testcase_%d_%d_%d' % ( i, j, k ) ] = testcase
|
||||
Reference in New Issue
Block a user