def __init__(self, *args, **kwargs): from aiida.backends.tests import get_db_test_names from aiida.backends import settings db_test_list = get_db_test_names() super(Devel, self).__init__(*args, **kwargs) self.valid_subcommands = { 'tests': (self.run_tests, self.complete_tests), 'query': (self.run_query, self.complete_none), # For the moment, no completion 'setproperty': (self.run_setproperty, self.complete_properties), 'getproperty': (self.run_getproperty, self.complete_properties), 'delproperty': (self.run_delproperty, self.complete_properties), 'describeproperties': (self.run_describeproperties, self.complete_none), 'listproperties': (self.run_listproperties, self.complete_none), 'listislands': (self.run_listislands, self.complete_none), 'play': (self.run_play, self.complete_none), 'getresults': (self.calculation_getresults, self.complete_none), 'tickd': (self.tick_daemon, self.complete_none) } # The content of the dict is: # None for a simple folder test # a list of strings for db tests, one for each test to run self.allowed_test_folders = {} for k in self.base_allowed_test_folders: self.allowed_test_folders[k] = None for dbtest in db_test_list: self.allowed_test_folders["{}{}".format(self._dbprefix, dbtest)] = [dbtest] self.allowed_test_folders[self._dbrawprefix] = db_test_list
def get_valid_test_paths(): """ Return a dictionary with the available test folders The content of the dict is: None for a simple folder test A list of strings for db tests, one for each test to run """ from aiida.backends.tests import get_db_test_names db_prefix_raw = 'db' db_prefix = db_prefix_raw + '.' base_test_modules = [ 'aiida.cmdline.utils', 'aiida.cmdline.params.types', 'aiida.cmdline.params.options', 'aiida.common', 'aiida.schedulers', 'aiida.transports', 'aiida.tools.dbimporters.plugins' ] valid_test_paths = {} db_test_list = get_db_test_names() for module in base_test_modules: valid_test_paths[module] = None for db_test in db_test_list: valid_test_paths['{}{}'.format(db_prefix, db_test)] = [db_test] valid_test_paths[db_prefix_raw] = db_test_list return valid_test_paths
def get_test_modules(): """Returns a list of known test modules.""" from aiida.backends.tests import get_db_test_names prefix_db = 'db' modules_db = get_db_test_names() modules_base = [ 'aiida.cmdline', 'aiida.common', 'aiida.schedulers', 'aiida.transports' ] test_modules = {} for module in modules_base: test_modules[module] = None for module in modules_db: test_modules['{}.{}'.format(prefix_db, module)] = [module] test_modules[prefix_db] = modules_db return test_modules