Example #1
0
def test_read_yaml_sources(sample_dir):
    """Test that source is set correctly when reading a YAML file"""
    cfg_path = sample_dir / "sample.yaml"
    cfg = Configuration.from_file(cfg_path)

    assert cfg.sources == {f"{cfg_path} (YAML reader)"}
Example #2
0
def test_read_json_sources(sample_dir):
    """Test that source is set correctly when reading a JSON file"""
    cfg_path = sample_dir / "sample.json"
    cfg = Configuration.from_file(cfg_path)

    assert cfg.sources == {f"{cfg_path} (JSON reader)"}
Example #3
0
def test_read_yaml(sample_dir):
    """Test that reading a YAML file succeeds"""
    Configuration.from_file(sample_dir / "sample.yaml")
Example #4
0
def test_read_json(sample_dir):
    """Test that reading an JSON file succeeds"""
    Configuration.from_file(sample_dir / "sample.json")
Example #5
0
def test_read_ini_sources(sample_dir):
    """Test that source is set correctly when reading an INI file"""
    cfg_path = sample_dir / "sample.ini"
    cfg = Configuration.from_file(cfg_path)

    assert cfg.sources == {f"{cfg_path} (INI reader)"}
Example #6
0
def test_read_ini(sample_dir):
    """Test that reading an INI file succeeds"""
    Configuration.from_file(sample_dir / "sample.ini")
Example #7
0
def read_config(cfg_file: str) -> Configuration:
    """Read one configuration from file"""
    with resources.path(__package__, cfg_file) as cfg_path:
        return Configuration.from_file(cfg_path, name=cfg_path.stem)
Example #8
0
def sample_cfg(sample_dir):
    """Sample configuration"""
    return Configuration.from_file(sample_dir / "sample.toml")