Exemplo n.º 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)"}
Exemplo n.º 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)"}
Exemplo n.º 3
0
def test_read_yaml(sample_dir):
    """Test that reading a YAML file succeeds"""
    Configuration.from_file(sample_dir / "sample.yaml")
Exemplo n.º 4
0
def test_read_json(sample_dir):
    """Test that reading an JSON file succeeds"""
    Configuration.from_file(sample_dir / "sample.json")
Exemplo n.º 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)"}
Exemplo n.º 6
0
def test_read_ini(sample_dir):
    """Test that reading an INI file succeeds"""
    Configuration.from_file(sample_dir / "sample.ini")
Exemplo n.º 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)
Exemplo n.º 8
0
def sample_cfg(sample_dir):
    """Sample configuration"""
    return Configuration.from_file(sample_dir / "sample.toml")