コード例 #1
0
ファイル: test_files.py プロジェクト: gahjelle-eq/pyconfs
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)"}
コード例 #2
0
ファイル: test_files.py プロジェクト: gahjelle-eq/pyconfs
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)"}
コード例 #3
0
ファイル: test_files.py プロジェクト: gahjelle-eq/pyconfs
def test_read_yaml(sample_dir):
    """Test that reading a YAML file succeeds"""
    Configuration.from_file(sample_dir / "sample.yaml")
コード例 #4
0
ファイル: test_files.py プロジェクト: gahjelle-eq/pyconfs
def test_read_json(sample_dir):
    """Test that reading an JSON file succeeds"""
    Configuration.from_file(sample_dir / "sample.json")
コード例 #5
0
ファイル: test_files.py プロジェクト: gahjelle-eq/pyconfs
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)"}
コード例 #6
0
ファイル: test_files.py プロジェクト: gahjelle-eq/pyconfs
def test_read_ini(sample_dir):
    """Test that reading an INI file succeeds"""
    Configuration.from_file(sample_dir / "sample.ini")
コード例 #7
0
ファイル: __init__.py プロジェクト: gahjelle/pepdocs
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)
コード例 #8
0
ファイル: test_types.py プロジェクト: gahjelle-eq/pyconfs
def sample_cfg(sample_dir):
    """Sample configuration"""
    return Configuration.from_file(sample_dir / "sample.toml")