Allow tool tests to assert properties about command, standard output, and standard error.

See test/functional/tools/job_properties.xml for example. Provides full access to assertion based XML tags - tabular and XML based assertions probably not so interesting so these include - has_text, has_line, not_has_text, has_text_matching, has_line_matching.
This commit is contained in:
John Chilton
2014-12-17 12:34:39 -05:00
parent 01d984624f
commit 77ee2ace67
6 changed files with 117 additions and 14 deletions
+16
View File
@@ -1,6 +1,7 @@
import new
import sys
from base.twilltestcase import TwillTestCase
from base.asserts import verify_assertions
from base.interactor import build_interactor, stage_data_in_history, RunToolException
from base.instrument import register_job_data
from galaxy.tools import DataManagerTool
@@ -132,6 +133,21 @@ class ToolTestCase( TwillTestCase ):
if job_stdio is None:
job_stdio = galaxy_interactor.get_job_stdio( jobs[0][ 'id' ] )
other_checks = {
"command_line": "Command produced by the job",
"stdout": "Standard output of the job",
"stderr": "Standard error of the job",
}
for what, description in other_checks.items():
if getattr( testdef, what, None ) is not None:
try:
data = job_stdio[what]
verify_assertions( data, getattr( testdef, what ) )
except AssertionError, err:
errmsg = '%s different than expected\n' % description
errmsg += str( err )
found_exceptions.append( AssertionError( errmsg ) )
if found_exceptions:
raise JobOutputsError(found_exceptions, job_stdio)
else: