fix: resolve CI failures from _ensure_ready removal

- connection.py: move skills_cmd import to module level (fixes ruff I001)
- setup_cmd.py: remove dead _ensure_ready import and call (fixes mypy attr-defined)
- tests/conftest.py: remove _ensure_ready monkeypatch (function no longer exists)
- tests/test_commands/test_setup.py: remove _ensure_ready patch
This commit is contained in:
MinaSaad1 2026-04-05 22:27:40 +02:00
parent 5819c41ddd
commit 8b7bef9e6d
4 changed files with 2 additions and 16 deletions

View file

@ -19,6 +19,7 @@ from pbi_cli.core.output import (
print_success,
print_table,
)
from pbi_cli.commands.skills_cmd import _get_bundled_skills, _is_installed
from pbi_cli.main import PbiContext, pass_context
@ -74,8 +75,6 @@ def connect(
)
else:
print_success(f"Connected: {effective_name} ({data_source})")
from pbi_cli.commands.skills_cmd import _is_installed, _get_bundled_skills
bundled = _get_bundled_skills()
any_missing = any(not _is_installed(name) for name in bundled)
if any_missing:

View file

@ -88,14 +88,6 @@ def _verify(json_output: bool) -> None:
print_json({"status": "error", "errors": errors})
raise SystemExit(1)
# Install skills
try:
from pbi_cli.commands.connection import _ensure_ready
_ensure_ready()
except Exception:
pass
if json_output:
print_json({"status": "ready"})
else:

View file

@ -281,8 +281,6 @@ def patch_session(monkeypatch: pytest.MonkeyPatch, mock_session: Any) -> Any:
"pbi_cli.core.session.connect",
lambda data_source, catalog="": mock_session,
)
# Skip skill install in connect
monkeypatch.setattr("pbi_cli.commands.connection._ensure_ready", lambda: None)
return mock_session

View file

@ -34,10 +34,7 @@ def test_setup_verify_success(cli_runner: CliRunner, tmp_config: Path) -> None:
(dll_dir / "Microsoft.AnalysisServices.Tabular.dll").write_text("fake")
(dll_dir / "Microsoft.AnalysisServices.AdomdClient.dll").write_text("fake")
with (
patch("pbi_cli.core.dotnet_loader._dll_dir", return_value=dll_dir),
patch("pbi_cli.commands.connection._ensure_ready", lambda: None),
):
with patch("pbi_cli.core.dotnet_loader._dll_dir", return_value=dll_dir):
result = cli_runner.invoke(cli, ["--json", "setup"])
assert result.exit_code == 0
assert "ready" in result.output