Example #1
0
def test_get_lean_config_path_returns_closest_config_file() -> None:
    lean_config_path = Path.cwd() / "lean.json"
    cwd_path = Path.cwd() / "sub1" / "sub2" / "sub3"

    lean_config_path.touch()
    cwd_path.mkdir(parents=True)
    os.chdir(cwd_path)

    manager = LeanConfigManager(mock.Mock(), ProjectConfigManager())

    assert manager.get_lean_config_path() == lean_config_path
Example #2
0
def test_get_lean_config_path_returns_default_path_when_set() -> None:
    manager = LeanConfigManager(mock.Mock(), ProjectConfigManager())
    manager.set_default_lean_config_path(Path.cwd() / "custom-lean.json")

    assert manager.get_lean_config_path() == Path.cwd() / "custom-lean.json"
Example #3
0
def test_get_lean_config_path_raises_error_when_no_config_file_exists(
) -> None:
    manager = LeanConfigManager(mock.Mock(), ProjectConfigManager())

    with pytest.raises(Exception):
        manager.get_lean_config_path()