mailr17785 - /trunk/devel_scripts/python_multiversion_test_suite.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on October 09, 2012 - 12:50:
Author: bugman
Date: Tue Oct  9 12:50:29 2012
New Revision: 17785

URL: http://svn.gna.org/viewcvs/relax?rev=17785&view=rev
Log:
Created a special script for testing out relax with Python versions 1.0 all 
the way to 3.3.

This builds the C modules for each Python version in ~/bin and then runs the 
test suite, outputting
everything to log files.


Added:
    trunk/devel_scripts/python_multiversion_test_suite.py   (with props)

Added: trunk/devel_scripts/python_multiversion_test_suite.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/devel_scripts/python_multiversion_test_suite.py?rev=17785&view=auto
==============================================================================
--- trunk/devel_scripts/python_multiversion_test_suite.py (added)
+++ trunk/devel_scripts/python_multiversion_test_suite.py Tue Oct  9 12:50:29 
2012
@@ -1,0 +1,78 @@
+#! /usr/bin/env python
+
+"""Script for blasting the relax test-suite through all possible python 
versions.
+
+This assumes that their is a directory called 'bin' in your home directory 
containing the Python
+versions to be tested.  This must be executed from the base relax directory.
+"""
+
+# Python module imports.
+from os import system
+from subprocess import PIPE, Popen
+import sys
+
+
+def execute_sh(cmd, log=sys.stdout, err=sys.stderr):
+    """Execute the shell command, sending the output to the given log and 
error files.
+
+    @param cmd:     The shell command to execute.
+    @type cmd:      str
+    @keyword log:   The name of the log file to redirect output to.
+    @type log:      file object
+    @keyword err:   The name of the error file to redirect output to.
+    @type err:      file object
+    """
+
+    # Execute the command.
+    pipe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, 
close_fds=False)
+
+    # Redirect STDOUT to the log file.
+    for line in pipe.stdout.readlines():
+        log.write(line)
+
+    # Redirect STDERR to the error file.
+    for line in pipe.stderr.readlines():
+        err.write(line)
+
+
+# The Python versions to be tested.
+PY_VER = [
+    '1.0',
+    '1.5',
+    '1.6',
+    '2.0',
+    '2.1',
+    '2.2',
+    '2.3',
+    '2.4',
+    '2.5',
+    '2.6',
+    '2.7',
+    '3.0',
+    '3.1',
+    '3.2',
+    '3.3'
+]
+
+# The log file.
+LOG = open('python_multiversion_test_suite.log', 'w')
+ERR = open('python_multiversion_test_suite.err', 'w')
+
+# Loop over the versions.
+for version in PY_VER:
+    # A header.
+    header = "\n\n\n\n\n"
+    header += "#################\n"
+    header += "### Python %s ###\n" % version
+    header += "#################\n\n\n\n"
+    LOG.write(header)
+    ERR.write(header)
+
+    # Clean up.
+    execute_sh('scons clean_all', log=ERR, err=ERR)
+
+    # Build the C modules for the current Python version.
+    execute_sh('devel_scripts/manual_c_module.py %s' % (version), log=LOG, 
err=LOG)
+
+    # Run the test suite.
+    execute_sh('~/bin/python%s relax -x' % (version), log=LOG, err=LOG)

Propchange: trunk/devel_scripts/python_multiversion_test_suite.py
------------------------------------------------------------------------------
    svn:executable = *




Related Messages


Powered by MHonArc, Updated Tue Oct 09 13:00:02 2012