|
21 | 21 |
|
22 | 22 | import pytest
|
23 | 23 | from lightning.fabric.cli import _get_supported_strategies, _run_model
|
24 |
| -from lightning_utilities.core.imports import ModuleAvailableCache |
25 | 24 |
|
26 | 25 | from tests_fabric.helpers.runif import RunIf
|
27 | 26 |
|
@@ -176,13 +175,20 @@ def test_cli_torchrun_num_processes_launched(_, devices, expected, monkeypatch,
|
176 | 175 | )
|
177 | 176 |
|
178 | 177 |
|
| 178 | +def test_cli_through_fabric_entry_point(): |
| 179 | + result = subprocess.run("fabric run model --help", capture_output=True, text=True, shell=True) |
| 180 | + |
| 181 | + message = "Usage: fabric run model [OPTIONS] SCRIPT [SCRIPT_ARGS]" |
| 182 | + assert message in result.stdout or message in result.stderr |
| 183 | + |
179 | 184 | @pytest.mark.skipif("lightning.fabric" == "lightning_fabric", reason="standalone package")
|
180 | 185 | def test_cli_through_lightning_entry_point():
|
181 | 186 | result = subprocess.run("lightning run model --help", capture_output=True, text=True, shell=True)
|
182 |
| - if not ModuleAvailableCache("lightning.app"): |
183 |
| - message = "The `lightning` command requires additional dependencies" |
184 |
| - assert message in result.stdout or message in result.stderr |
185 |
| - assert result.returncode != 0 |
186 |
| - else: |
187 |
| - message = "Usage: lightning run model [OPTIONS] SCRIPT [SCRIPT_ARGS]" |
188 |
| - assert message in result.stdout or message in result.stderr |
| 187 | + |
| 188 | + deprecation_message = ( |
| 189 | + "`lightning run model` is deprecated and will be removed in future versions. " |
| 190 | + "Please call `fabric run model` instead" |
| 191 | + ) |
| 192 | + message = "Usage: lightning run model [OPTIONS] SCRIPT [SCRIPT_ARGS]" |
| 193 | + assert deprecation_message in result.stdout |
| 194 | + assert message in result.stdout or message in result.stderr |
0 commit comments