def get_dbs_list(database): if database == "SUMMARY": return [get_active_results_db()] elif database == "ALL_ITERATION": return pu.get_db_files(get_active_results_db(), True) elif database == "LAST_ITERATION": return [pu.get_db_files(get_active_results_db(), False)[0]] else: raise RuntimeError('Invalid database selected: ' + str(database))
def test_get_db_files_single_true(): result_file = os.path.join(os.getcwd(), TEST_DB_FILE) fail_message = '' try: utils.get_db_files(result_file, True) except: exc_info = sys.exc_info() fail_list = traceback.format_exception_only(exc_info[0], exc_info[1]) if len(fail_list) == 1: fail_message = fail_list[0] else: fail_message = '\n'.join(fail_list) if 'ValueError' not in fail_message: raise AssertionError('Command failed with unexpected error: "' + fail_message + '"')
def get_dbs(UseMultipleResultsDatabases, UseSummary): if UseSummary and not UseMultipleResultsDatabases: return [get_active_results_db()] return pu.get_db_files(get_active_results_db(), UseMultipleResultsDatabases)
def test_get_db_files_multiple_true(): result_file = os.path.join(os.getcwd(), TEST_MULTIPLE_DB_FILE) db_list = utils.get_db_files(result_file, True) assert len(db_list) == 2 assert db_list[0] == os.path.join(os.getcwd(), os.path.normpath(TEST_MULTIPLE_DB_FILE_1)) assert db_list[1] == os.path.join(os.getcwd(), os.path.normpath(TEST_MULTIPLE_DB_FILE_2))
def test_get_db_files_single_false(): result_file = os.path.join(os.getcwd(), TEST_DB_FILE) db_list = utils.get_db_files(result_file, False) assert len(db_list) == 1 assert db_list[0] == os.path.join(os.getcwd(), os.path.normpath(TEST_DB_FILE))