Exemplo n.º 1
0
    def __init__(self):
        """Function for intializing the class.

        Args:
            None

        Returns:
            None

        """
        # Read configuration into dictionary
        self.directories = general.config_directories()
        self.config = general.read_yaml_files(self.directories)
Exemplo n.º 2
0
    def __init__(self):
        """Function for intializing the class.

        Args:
            None

        Returns:
            None

        """
        # Initialize key variables
        directories = general.config_directories()
        self.config_dict = general.read_yaml_files(directories)
Exemplo n.º 3
0
    def test_config_directories(self):
        """Test function config_directories."""
        # Initialize key variables
        save_directory = None

        if 'MDL_CONFIGDIR' in os.environ:
            save_directory = os.environ['MDL_CONFIGDIR']

            # Try with no MDL_CONFIGDIR
            os.environ.pop('MDL_CONFIGDIR', None)
            directory = '{}/etc'.format(general.root_directory())
            result = general.config_directories()
            self.assertEqual(result, [directory])

        # Test with MDL_CONFIGDIR set
        directory = tempfile.mkdtemp()
        os.environ['MDL_CONFIGDIR'] = directory
        result = general.config_directories()
        self.assertEqual(result, [directory])

        # Restore state
        if save_directory is not None:
            os.environ['MDL_CONFIGDIR'] = save_directory