File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88from __future__ import annotations
99
10- from typing import Any
11-
1210__all__ = ["cli_main" ]
1311
1412
15- def __getattr__ ( name : str ) -> Any :
16- """Load the Click entry point lazily .
13+ def cli_main ( ) -> None :
14+ """Run the Click entry point without importing it during package init .
1715
1816 Importing ``automax.cli.cli`` from this package initializer makes
1917 ``python -m automax.cli.cli`` emit a runpy RuntimeWarning because the target
2018 module is already present in ``sys.modules`` before runpy executes it. Keep
2119 the public ``automax.cli:cli_main`` entry point while avoiding the eager
2220 module import.
2321 """
24- if name == "cli_main" :
25- from automax .cli .cli import cli_main
22+ from automax .cli .cli import cli_main as _cli_main
2623
27- return cli_main
28- raise AttributeError (f"module { __name__ !r} has no attribute { name !r} " )
24+ _cli_main ()
Original file line number Diff line number Diff line change 1111import pytest
1212from click .testing import CliRunner
1313
14- from automax .cli .cli import cli
14+ import automax .cli .cli as cli_module
15+
16+ cli = cli_module .cli
1517from automax .core .engine import AutomaxEngine
1618from automax .core .models import ExecutionContext , Target
1719from automax .core .state import StateStore
@@ -4491,7 +4493,6 @@ def test_prepare_sudo_password_command_uses_askpass_without_embedding_password()
44914493
44924494def test_cli_run_sudo_password_env_feeds_sudo_enabled_remote_substeps (tmp_path : Path , monkeypatch ):
44934495 from contextlib import contextmanager
4494- import automax .cli .cli as cli_module
44954496
44964497 class FakeChannel :
44974498 def shutdown_write (self ):
You can’t perform that action at this time.
0 commit comments