Beispiel #1
0
def test_config_from_pyfile_no_file() -> None:
    config = Config(Path(__file__).parent)
    with pytest.raises(FileNotFoundError):
        config.from_pyfile('assets/no_file.cfg')
Beispiel #2
0
def test_config_from_pyfile_directory() -> None:
    config = Config(Path(__file__).parent)
    with pytest.raises(PermissionError if os.name ==
                       'nt' else IsADirectoryError):
        config.from_pyfile('assets')
Beispiel #3
0
def test_config_from_pyfile_this() -> None:
    config = Config(Path(__file__).parent)
    config.from_pyfile(__file__)
    _check_standard_config(config)
Beispiel #4
0
def test_config_from_pyfile_cfg() -> None:
    config = Config(Path(__file__).parent)
    config.from_pyfile('assets/config.cfg')
    _check_standard_config(config)
Beispiel #5
0
def test_config_from_pyfile_py() -> None:
    config = Config(Path(__file__).parent)
    config.from_pyfile("assets/config.py")
    _check_standard_config(config)
Beispiel #6
0
def test_config_from_pyfile_no_file() -> None:
    config = Config(os.path.dirname(__file__))
    with pytest.raises(FileNotFoundError):
        config.from_pyfile('assets/no_file.cfg')
Beispiel #7
0
def test_config_from_pyfile_cfg() -> None:
    config = Config(os.path.dirname(__file__))
    config.from_pyfile('assets/config.cfg')
    _check_standard_config(config)
Beispiel #8
0
def test_config_from_pyfile_this() -> None:
    config = Config(os.path.dirname(__file__))
    config.from_pyfile(__file__)
    _check_standard_config(config)
Beispiel #9
0
def test_config_from_pyfile_directory() -> None:
    config = Config(os.path.dirname(__file__))
    with pytest.raises(IsADirectoryError):
        config.from_pyfile('assets')