Ejemplo n.º 1
0
def test_exists():
    """Test the functionality for whether the file exists."""
    conf = seamm_installer.Configuration()
    assert not conf.file_exists()
    conf.path = "./does_not_exist.ini"
    assert not conf.file_exists()

    path = Path(__file__).resolve().parent
    conf.path = path / "data" / "seamm.ini"
    assert conf.file_exists()
Ejemplo n.º 2
0
def conf():
    """Create a simple configuration for scratch."""
    text = """\
This is a simple prolog.

[TEST]
# This is a test section.

value1 = 53
value2 = 54
"""
    conf = seamm_installer.Configuration()
    conf.from_string(text)
    return conf
Ejemplo n.º 3
0
    def __init__(self, ini_file="~/SEAMM/seamm.ini", logger=logger):
        # Create the ini file if it does not exist.
        self._check_ini_file(ini_file)

        self.logger = logger

        # and make the configuration, conda and pip objects
        self._configuration = seamm_installer.Configuration(ini_file)
        self._conda = seamm_installer.Conda()
        self._pip = seamm_installer.Pip()

        # Setup the parseer for the command-line
        self.options = None
        self.subparser = {}
        self.parser = self.setup_parser()
Ejemplo n.º 4
0
def test_create_configuration(conf):
    """Test creating a configuration from scratch."""

    prolog = """\
This is a simple prolog.

"""
    section_data = """\
# This is a test section.

value1 = 53
value2 = 54
"""
    conf2 = seamm_installer.Configuration()
    conf2.add_prolog(prolog)
    conf2.add_section("TEST", section_data)

    assert str(conf2) == str(conf)
    assert conf2 == conf
Ejemplo n.º 5
0
def test_empty_prolog():
    """Test what happens when ther is no prolog."""
    conf = seamm_installer.Configuration()
    assert conf.get_prolog() == ""
Ejemplo n.º 6
0
def test_construction():
    """Just create an object and test its type."""
    result = seamm_installer.Configuration()
    assert str(type(result)) == (
        "<class 'seamm_installer.configuration.Configuration'>"  # noqa: E501
    )
Ejemplo n.º 7
0
def seamm_conf():
    """Create a configuration initialized with seamm.ini."""
    return seamm_installer.Configuration(data_path / "seamm.ini")