Author: bugman Date: Tue Apr 15 20:31:34 2014 New Revision: 22778 URL: http://svn.gna.org/viewcvs/relax?rev=22778&view=rev Log: Added a script for testing the independence of the relax library. Added: trunk/devel_scripts/test_library_independence.py (with props) Added: trunk/devel_scripts/test_library_independence.py URL: http://svn.gna.org/viewcvs/relax/trunk/devel_scripts/test_library_independence.py?rev=22778&view=auto ============================================================================== --- trunk/devel_scripts/test_library_independence.py (added) +++ trunk/devel_scripts/test_library_independence.py Tue Apr 15 20:31:34 2014 @@ -0,0 +1,39 @@ +#! /usr/bin/env python + +# Python module imports. +from os import sep +from shutil import copytree, rmtree +import sys +from tempfile import mkdtemp + + +def test_library(tmpdir=None): + """Test the independence of the relax library by importing it from a non-relax directory. + + @keyword tmpdir: The name of the temporary directory to perform the testing in. + @type tmpdir: str + """ + + # Copy the entire library to the temporary directory. + tmplib = tmpdir+sep+'lib' + copytree('lib', tmplib) + + # Modify the system path. + sys.path.append(tmpdir) + + # Import the temporary library. + from lib import * + + +# Initialise a temporary directory. +tmpdir = mkdtemp() +print("Testing in the temporary directory %s." % tmpdir) + +# Failsafe execution of the testing. +try: + test_library(tmpdir) + +# Delete the temporary directory. +finally: + print("Deleting the directory %s." % tmpdir) + rmtree(tmpdir) Propchange: trunk/devel_scripts/test_library_independence.py ------------------------------------------------------------------------------ svn:executable = *