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
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"
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()