aiida.common.additions.migration_tests package

Submodules

class aiida.common.additions.migration_tests.test_migration_05dj_to_06dj.MigrationTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

This class tests that migration script for the transition to the new configuration files works correctly.

__module__ = 'aiida.common.additions.migration_tests.test_migration_05dj_to_06dj'
_aiida_conf_dir_replace_str = '{AIIDA_CONF_DIR}'
_aiida_dir_replace_str = '{AIIDA_DIR}'
_aiida_linux_user = '{AIIDA_LINUX_USR}'
_aiida_main_config_dir_rel_path = '.aiida'
_conf_files_rel_path = 'test_migration_files'
_final_files_rel_path = 'final'
_original_files_rel_path = 'original'
_temp_dir_path_name = None
check_miration_res(aiida_folder_full_path, correct_files_dir)[source]

This method checks that the migration result is correct. More specifically it checks that the generated config.json & aiida_daemon.conf are the expected ones. :param aiida_folder_full_path: :param correct_files_dir: :return:

config_text_files_equal(generated_conf_path, original_conf_path, aiida_conf_dir)[source]

This method checks two text configuration files (line by line) if they are equal. It also performs the necessary string replacements before the checks. :param generated_conf_path: The path to the generated configuration file. :param original_conf_path: The path to the original configuration file. :param aiida_conf_dir: The path to AiiDA configuration folder created for the test. :param linux_user: The user under whose account the AiiDA runs.. :return: True or False with the corresponding message (if needed).

perform_migration(aiida_folder_abs_path)[source]

This method performs the migration to the new configuration format. :param aiida_folder_abs_path: The absolute path to the AiiDA configuration folder.

prepare_the_temp_aiida_folder(given_conf_dir)[source]

This method creates an .aiida folder in a temporary directory and returns the absolute path to that folder. :param given_conf_dir: The directory that the needed configuration files can be found. :return: The created temp folder with the needed files.

test_migration()[source]

This method tests creates a temporary .aiida folder with the needed configuration files, performs the migration and then checks the migration final result if it is correct. It does this for all the available test configurations.

aiida.common.additions.migration_tests.test_migration_05dj_to_06dj.json_files_equivalent(input_file1_filename, input_file2_filename)[source]

Checks that two json files are equivalent (contain the same key/value pairs irrespective of their order. :param input_file1_filename: The first json file. :param input_file2_filename: The second json file. :return: True or False with the corresponding message (if needed).

aiida.common.additions.migration_tests.test_migration_05dj_to_06dj.ordered(obj)[source]

Sorts recursively a (JSON) object. :param obj: The object to be sorted. :return: A sorted version of the object.