Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Internal
* Upgrade `llm` dependency and set a minimum `pydantic_core` version.
* Refactor suggestion logic into declarative rules.
* Factor the `--batch` execution modes out of `main.py`.
* Move `--checkup` logic to the new `main_modes` with `--batch`.
* Sort coverage report in tox suite.
* Skip more tests when a database connection is not present.

Expand Down
4 changes: 2 additions & 2 deletions mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
main_batch_with_progress_bar,
main_batch_without_progress_bar,
)
from mycli.main_modes.checkup import main_checkup
from mycli.packages import special
from mycli.packages.checkup import do_checkup
from mycli.packages.filepaths import dir_path_exists, guess_socket_location
from mycli.packages.hybrid_redirection import get_redirect_components, is_redirect_command
from mycli.packages.parseutils import is_dropping_database, is_valid_connection_scheme
Expand Down Expand Up @@ -2263,7 +2263,7 @@ def get_password_from_file(password_file: str | None) -> str | None:
)

if cli_args.checkup:
do_checkup(mycli)
main_checkup(mycli)
sys.exit(0)

if cli_args.csv and cli_args.format not in [None, 'csv']:
Expand Down
2 changes: 1 addition & 1 deletion mycli/packages/checkup.py → mycli/main_modes/checkup.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _configuration_checkup(mycli) -> None:
print('User configuration all up to date!\n')


def do_checkup(mycli) -> None:
def main_checkup(mycli) -> None:
_dependencies_checkup()
_executables_checkup()
_environment_checkup()
Expand Down
6 changes: 3 additions & 3 deletions test/pytests/test_checkup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from types import SimpleNamespace
import urllib.error

from mycli.packages import checkup
from mycli.main_modes import checkup


class FakeUrlResponse:
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_configuration_checkup_up_to_date(capsys) -> None:
assert 'User configuration all up to date!' in output


def test_do_checkup_calls_all_sections(monkeypatch) -> None:
def test_main_checkup_calls_all_sections(monkeypatch) -> None:
calls: list[tuple[str, object]] = []
mycli = SimpleNamespace(name='mycli')

Expand All @@ -236,7 +236,7 @@ def test_do_checkup_calls_all_sections(monkeypatch) -> None:
monkeypatch.setattr(checkup, '_environment_checkup', lambda: calls.append(('environment', None)))
monkeypatch.setattr(checkup, '_configuration_checkup', lambda arg: calls.append(('configuration', arg)))

checkup.do_checkup(mycli)
checkup.main_checkup(mycli)

assert calls == [
('dependencies', None),
Expand Down
2 changes: 1 addition & 1 deletion test/pytests/test_main_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ def test_click_entrypoint_branches_with_dummy_mycli(monkeypatch: pytest.MonkeyPa
monkeypatch.setattr(main.sys.stderr, 'isatty', lambda: True)

checkup_calls: list[Any] = []
monkeypatch.setattr(main, 'do_checkup', lambda mycli: checkup_calls.append(mycli))
monkeypatch.setattr(main, 'main_checkup', lambda mycli: checkup_calls.append(mycli))
result = runner.invoke(main.click_entrypoint, ['--checkup'])
assert result.exit_code == 0
assert len(checkup_calls) == 1
Expand Down
Loading