Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2009-2013 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program is free software: you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation, either version 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 # Python module imports. 23 from os import F_OK, access, listdir, sep 24 from os.path import isdir 25 from re import search 26 27 # relax module imports. 28 from test_suite.unit_tests.base_classes import UnitTestCase 29 3032 """Base class for the unit tests of the relax packages.""" 339035 """Check if all modules are located within the __all__ list.""" 36 37 # Initial printout. 38 print("The %s.__all__ list: %s" % (self.package_name, self.package.__all__)) 39 40 # Check for modules/packages missing from the __all__ list. 41 print("\nChecking for modules/packages missing from the __all__ list.") 42 files = listdir(self.package_path) 43 skip = ['__init__.py'] 44 for file in files: 45 # Files and directories to skip. 46 if file in skip: 47 continue 48 49 # Skip hidden files and directories. 50 if search("^\.", file): 51 continue 52 53 # Only check Python files and directories. 54 if not search("\.py$", file) and not isdir(file): 55 continue 56 57 # Skip blacklisted files. 58 if hasattr(self, 'blacklist') and file in self.blacklist: 59 continue 60 61 # Remove the extension if needed. 62 module = file 63 if search('.py$', module): 64 module = module[:-3] 65 if search('.so$', module): 66 module = module[:-3] 67 68 # Printout. 69 print(" Module/package: %s" % module) 70 71 # Check if the module is in __all__. 72 self.assert_(module in self.package.__all__) 73 74 # Check for modules/packages in the __all__ list which do not exist. 75 print("\nChecking for modules/packages in the __all__ list which do not exist.") 76 for module in self.package.__all__: 77 # Printout. 78 print(" Module/package: %s" % module) 79 80 # Check for the module. 81 if access(self.package_path+sep+module+'.py', F_OK): 82 continue 83 84 # Check for the package. 85 if access(self.package_path+sep+module, F_OK): 86 continue 87 88 # Doesn't exist, so fail. 89 self.fail()
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 15:07:03 2013 | http://epydoc.sourceforge.net |