Changes to allow all test outputs generated by twill to be saved to a folder pointed to by

an environment variable "GALAXY_TEST_SAVE" if defined before running functional tests
If the environment variable is empty, all tests procede as usual and test outputs are deleted
without saving
This commit is contained in:
Ross Lazarus
2011-04-14 08:09:48 -04:00
parent 2c81457e57
commit ee6bd2cf46
3 changed files with 20 additions and 2 deletions
+8 -2
View File
@@ -47,6 +47,8 @@ def main():
galaxy_test_host = os.environ.get( 'GALAXY_TEST_HOST', default_galaxy_test_host )
galaxy_test_port = os.environ.get( 'GALAXY_TEST_PORT', None )
galaxy_test_save = os.environ.get( 'GALAXY_TEST_SAVE', None)
if 'HTTP_ACCEPT_LANGUAGE' not in os.environ:
os.environ['HTTP_ACCEPT_LANGUAGE'] = default_galaxy_locales
galaxy_test_file_dir = os.environ.get( 'GALAXY_TEST_FILE_DIR', default_galaxy_test_file_dir )
@@ -126,10 +128,14 @@ def main():
print "Database connection:", database_connection
# What requires these?
# What requires these?
# handy for (eg) functional tests to save outputs?
if galaxy_test_save:
os.environ['GALAXY_TEST_SAVE'] = galaxy_test_save
# pass in through script setenv
# will leave a copy of ALL test validate files
os.environ['GALAXY_TEST_HOST'] = galaxy_test_host
os.environ['GALAXY_TEST_FILE_DIR'] = galaxy_test_file_dir
# ---- Build Application --------------------------------------------------
app = None
+11
View File
@@ -32,7 +32,14 @@ class TwillTestCase( unittest.TestCase ):
self.port = os.environ.get( 'GALAXY_TEST_PORT' )
self.url = "http://%s:%s" % ( self.host, self.port )
self.file_dir = os.environ.get( 'GALAXY_TEST_FILE_DIR' )
self.keepOutdir = os.environ.get( 'GALAXY_TEST_SAVE', '' )
if self.keepOutdir > '':
try:
os.makedirs(self.keepOutdir)
except:
pass
self.home()
#self.set_history()
# Functions associated with files
@@ -632,6 +639,10 @@ class TwillTestCase( unittest.TestCase ):
self.visit_page( "display?hid=" + hid )
data = self.last_page()
file( temp_name, 'wb' ).write(data)
if self.keepOutdir > '':
ofn = os.path.join(self.keepOutdir,os.path.basename(local_name))
shutil.copy(temp_name,ofn)
log.debug('## GALAXY_TEST_SAVE=%s. saved %s' % (self.keepOutdir,ofn))
try:
# have to nest try-except in try-finally to handle 2.4
try:
+1
View File
@@ -28,6 +28,7 @@
</param>
<param name='title' value='rgQCtest1' />
<output name='html_file' file='rgtestouts/rgQC/rgQCtest1.html' ftype='html' lines_diff='300'>
<param name="dbkey" value="hg18" />
<extra_files type="file" name='tinywga_All_Paged.pdf' value="rgtestouts/rgQC/tinywga_All_Paged.pdf" compare="sim_size" delta = "100000"/>
<extra_files type="file" name='tinywga.log' value="rgtestouts/rgQC/tinywga.log" compare="diff" lines_diff="15"/>
<extra_files type="file" name='tinywga.frq' value="rgtestouts/rgQC/tinywga.frq" compare="diff" />