Author: bugman Date: Wed Sep 2 15:37:30 2009 New Revision: 9430 URL: http://svn.gna.org/viewcvs/relax?rev=9430&view=rev Log: Shifted the test___all__() method into the PackageTestCase base class. Added: 1.3/test_suite/unit_tests/package_checking.py - copied, changed from r9429, 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py Modified: 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py Modified: 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py?rev=9430&r1=9429&r2=9430&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py (original) +++ 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py Wed Sep 2 15:37:30 2009 @@ -21,43 +21,20 @@ ############################################################################### # Python module imports. -from os import listdir, sep -from re import search +from os import sep import sys -from unittest import TestCase # relax module imports. +from test_suite.unit_tests.package_checking import PackageTestCase from generic_fns import structure -class Test___init__(TestCase): +class Test___init__(PackageTestCase): """Unit tests for the generic_fns.structure package.""" - def test___all__(self): - """Check if the generic_fns.structure modules are located within the __all__ list.""" + def setUp(self): + """Set up for the package checking.""" - # Path to the files. - path = sys.path[0] + sep + 'generic_fns' + sep + 'structure' - - print("The generic_fns.structure.__all__ list: %s" % structure.__all__) - - # Loop over all modules. - files = listdir(path) - for file in files: - # Only look at the '*.py' files. - if not search('.py$', file): - continue - - # Skip __init__.py - if file == '__init__.py': - continue - - # Remove the '.py' part. - module = file[:-3] - - # Print out. - print("\nFile: %s" % file) - print("Module: %s" % module) - - # Check if the module is in __all__. - self.assert_(module in structure.__all__) + self.package = structure + self.package_name = 'generic_fns.structure' + self.package_path = sys.path[0] + sep + 'generic_fns' + sep + 'structure' Copied: 1.3/test_suite/unit_tests/package_checking.py (from r9429, 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py) URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/package_checking.py?p2=1.3/test_suite/unit_tests/package_checking.py&p1=1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py&r1=9429&r2=9430&rev=9430&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py (original) +++ 1.3/test_suite/unit_tests/package_checking.py Wed Sep 2 15:37:30 2009 @@ -21,34 +21,27 @@ ############################################################################### # Python module imports. -from os import listdir, sep +from os import listdir from re import search -import sys from unittest import TestCase -# relax module imports. -from generic_fns import structure - -class Test___init__(TestCase): - """Unit tests for the generic_fns.structure package.""" +class PackageTestCase(TestCase): + """Base class for the unit tests of the relax packages.""" def test___all__(self): - """Check if the generic_fns.structure modules are located within the __all__ list.""" + """Check if all modules are located within the __all__ list.""" - # Path to the files. - path = sys.path[0] + sep + 'generic_fns' + sep + 'structure' - - print("The generic_fns.structure.__all__ list: %s" % structure.__all__) + print("The %s.__all__ list: %s" % (self.package_name, self.package.__all__)) # Loop over all modules. - files = listdir(path) + files = listdir(self.package_path) for file in files: # Only look at the '*.py' files. if not search('.py$', file): continue - # Skip __init__.py + # Skip the __init__.py file. if file == '__init__.py': continue @@ -60,4 +53,4 @@ print("Module: %s" % module) # Check if the module is in __all__. - self.assert_(module in structure.__all__) + self.assert_(module in self.package.__all__)