accli 2.1.1__tar.gz → 2.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {accli-2.1.1 → accli-2.1.2}/PKG-INFO +2 -2
- {accli-2.1.1 → accli-2.1.2}/README.md +1 -1
- {accli-2.1.1 → accli-2.1.2}/accli/_version.py +1 -1
- {accli-2.1.1 → accli-2.1.2}/accli/cli.py +51 -21
- {accli-2.1.1 → accli-2.1.2}/accli/gui.py +3 -3
- {accli-2.1.1 → accli-2.1.2}/accli/setup-nfs.ps1 +12 -1
- {accli-2.1.1 → accli-2.1.2}/accli.egg-info/PKG-INFO +2 -2
- {accli-2.1.1 → accli-2.1.2}/accli.egg-info/SOURCES.txt +2 -1
- accli-2.1.2/tests/test_update_check.py +151 -0
- {accli-2.1.1 → accli-2.1.2}/LICENSE +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/AcceleratorJobProjectService.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/AcceleratorTaskDispatcher.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/AcceleratorTerminalCliProjectService.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/CsvRegionalTimeseriesValidator.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/__init__.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/__main__.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/cleanup-nfs.ps1 +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/common.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/job_views.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/log_timeline.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/mount_downloader.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/nfs_watcher.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/refresh_explorer.ps1 +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/token.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli/version_checker.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli.egg-info/dependency_links.txt +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli.egg-info/entry_points.txt +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli.egg-info/requires.txt +0 -0
- {accli-2.1.1 → accli-2.1.2}/accli.egg-info/top_level.txt +0 -0
- {accli-2.1.1 → accli-2.1.2}/pyproject.toml +0 -0
- {accli-2.1.1 → accli-2.1.2}/setup.cfg +0 -0
- {accli-2.1.1 → accli-2.1.2}/tests/test_jobs_commands.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/tests/test_log_timeline.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/tests/test_logs_command.py +0 -0
- {accli-2.1.1 → accli-2.1.2}/tests/test_mount_lifecycle.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: accli
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: IIASA Accelerator Client
|
|
5
5
|
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -70,7 +70,7 @@ This client uses **device authentication** via Auth0.
|
|
|
70
70
|
|
|
71
71
|
### ✅ Requirements
|
|
72
72
|
|
|
73
|
-
- Python >= 3.
|
|
73
|
+
- Python >= 3.8
|
|
74
74
|
|
|
75
75
|
### 📦 Installation
|
|
76
76
|
|
|
@@ -36,27 +36,20 @@ ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
|
|
|
36
36
|
app = typer.Typer(
|
|
37
37
|
add_completion=False,
|
|
38
38
|
pretty_exceptions_show_locals=False,
|
|
39
|
-
no_args_is_help=True,
|
|
40
39
|
context_settings={"help_option_names": ["-h", "--help"]}
|
|
41
40
|
)
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
if value:
|
|
46
|
-
print(f"[bold cyan]accli version: {VERSION}[/bold cyan]")
|
|
47
|
-
update_avail, latest = check_for_updates()
|
|
48
|
-
if update_avail:
|
|
49
|
-
instruction = get_upgrade_instruction()
|
|
50
|
-
print(f"[bold yellow]🔔 A new version of accli is available: {latest} (Current: {VERSION})[/bold yellow]")
|
|
51
|
-
print(f"[yellow]{instruction}[/yellow]\n")
|
|
52
|
-
raise typer.Exit()
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@app.callback()
|
|
43
|
+
@app.callback(invoke_without_command=True)
|
|
56
44
|
def main_callback(
|
|
45
|
+
ctx: typer.Context,
|
|
57
46
|
version: Annotated[
|
|
58
47
|
bool,
|
|
59
|
-
typer.Option("--version", "-v",
|
|
48
|
+
typer.Option("--version", "-v", help="Show the version and exit.")
|
|
49
|
+
] = False,
|
|
50
|
+
help: Annotated[
|
|
51
|
+
bool,
|
|
52
|
+
typer.Option("--help", "-h", help="Show this message and exit.")
|
|
60
53
|
] = False,
|
|
61
54
|
):
|
|
62
55
|
update_avail, latest = check_for_updates()
|
|
@@ -65,6 +58,14 @@ def main_callback(
|
|
|
65
58
|
print(f"[bold yellow]🔔 Update available: accli {latest} (current: {VERSION})[/bold yellow]")
|
|
66
59
|
print(f"[yellow]{instruction}[/yellow]\n")
|
|
67
60
|
|
|
61
|
+
if version:
|
|
62
|
+
print(f"[bold cyan]accli version: {VERSION}[/bold cyan]")
|
|
63
|
+
raise typer.Exit()
|
|
64
|
+
|
|
65
|
+
if help or ctx.invoked_subcommand is None:
|
|
66
|
+
typer.echo(ctx.get_help())
|
|
67
|
+
raise typer.Exit()
|
|
68
|
+
|
|
68
69
|
|
|
69
70
|
def get_size(path):
|
|
70
71
|
size = 0
|
|
@@ -93,11 +94,6 @@ def about():
|
|
|
93
94
|
print("[bold cyan]Feature requests & suggestions: https://github.com/iiasa/accli/issues[/bold cyan]")
|
|
94
95
|
print("[bold cyan]License: The MIT License (MIT)[/bold cyan]")
|
|
95
96
|
print(f"[bold cyan]Version: {VERSION}[/bold cyan]")
|
|
96
|
-
update_avail, latest = check_for_updates()
|
|
97
|
-
if update_avail:
|
|
98
|
-
instruction = get_upgrade_instruction()
|
|
99
|
-
print(f"[bold yellow]🔔 A new version of accli is available: {latest} (Current: {VERSION})[/bold yellow]")
|
|
100
|
-
print(f"[yellow]{instruction}[/yellow]\n")
|
|
101
97
|
|
|
102
98
|
|
|
103
99
|
@app.command()
|
|
@@ -1107,7 +1103,7 @@ def map_windows_network_drive(mount_point_abs, max_attempts: int) -> tuple[bool,
|
|
|
1107
1103
|
if res.returncode == 0:
|
|
1108
1104
|
# Confirm drive is actually mounted and directory listing is populated and queryable
|
|
1109
1105
|
drive_ready = False
|
|
1110
|
-
for _ in range(
|
|
1106
|
+
for _ in range(10):
|
|
1111
1107
|
try:
|
|
1112
1108
|
if os.path.exists(drive_root):
|
|
1113
1109
|
entries = os.listdir(drive_root)
|
|
@@ -1119,8 +1115,15 @@ def map_windows_network_drive(mount_point_abs, max_attempts: int) -> tuple[bool,
|
|
|
1119
1115
|
time.sleep(0.5)
|
|
1120
1116
|
if not drive_ready:
|
|
1121
1117
|
last_err = f"mount.exe reported success but drive {drive_root} was empty or not accessible"
|
|
1122
|
-
# Clean up the stale mount connection so next attempt can remount fresh
|
|
1118
|
+
# Clean up the stale mount connection and reset NfsRdr kernel cache so next attempt can remount fresh
|
|
1123
1119
|
subprocess.run(["net", "use", target_str, "/delete", "/y"], capture_output=True)
|
|
1120
|
+
subprocess.run(["schtasks", "/run", "/tn", "accli-umount-nfs"], capture_output=True)
|
|
1121
|
+
for _ in range(16):
|
|
1122
|
+
time.sleep(0.5)
|
|
1123
|
+
umount_check = subprocess.run(["schtasks", "/query", "/tn", "accli-umount-nfs"], capture_output=True, text=True, errors="replace")
|
|
1124
|
+
clnt_check = subprocess.run(["sc.exe", "query", "NfsClnt"], capture_output=True, text=True, errors="replace")
|
|
1125
|
+
if (not umount_check.stdout or "Running" not in umount_check.stdout) and (clnt_check.stdout and "RUNNING" in clnt_check.stdout):
|
|
1126
|
+
break
|
|
1124
1127
|
else:
|
|
1125
1128
|
last_err = (res.stderr or res.stdout or "").strip()
|
|
1126
1129
|
if "85" in last_err or "already in use" in last_err.lower():
|
|
@@ -1231,6 +1234,25 @@ def enable_windows_nfs_features():
|
|
|
1231
1234
|
reg_ok = reg_ok and anon_ok and cache_ok
|
|
1232
1235
|
|
|
1233
1236
|
if nfs_ok and reg_ok and task_ok:
|
|
1237
|
+
# Ensure run-umount-helper.ps1 includes the NfsRdr/NfsClnt kernel cache flush
|
|
1238
|
+
try:
|
|
1239
|
+
umount_helper = Path("C:/ProgramData/accli/run-umount-helper.ps1")
|
|
1240
|
+
if umount_helper.is_file():
|
|
1241
|
+
content = umount_helper.read_text(encoding="utf-8", errors="ignore")
|
|
1242
|
+
if "Stop-Service -Name \"NfsRdr\"" not in content:
|
|
1243
|
+
umount_helper.write_text(
|
|
1244
|
+
content.rstrip()
|
|
1245
|
+
+ "\n\n# Synchronously stop NfsClnt & NfsRdr, then start NfsRdr & NfsClnt to flush stale kernel V_NET_ROOT cache\n"
|
|
1246
|
+
+ "try {\n"
|
|
1247
|
+
+ " Stop-Service -Name \"NfsClnt\" -Force -ErrorAction SilentlyContinue\n"
|
|
1248
|
+
+ " Stop-Service -Name \"NfsRdr\" -Force -ErrorAction SilentlyContinue\n"
|
|
1249
|
+
+ " Start-Service -Name \"NfsRdr\" -ErrorAction SilentlyContinue\n"
|
|
1250
|
+
+ " Start-Service -Name \"NfsClnt\" -ErrorAction SilentlyContinue\n"
|
|
1251
|
+
+ "} catch {}\n",
|
|
1252
|
+
encoding="utf-8",
|
|
1253
|
+
)
|
|
1254
|
+
except Exception:
|
|
1255
|
+
pass
|
|
1234
1256
|
print("[bold green][OK] Windows NFS client features, registry policies, and Task Scheduler gateway are already configured.[/bold green]")
|
|
1235
1257
|
return
|
|
1236
1258
|
|
|
@@ -1846,6 +1868,14 @@ def mount_stop(
|
|
|
1846
1868
|
break
|
|
1847
1869
|
time.sleep(0.5)
|
|
1848
1870
|
|
|
1871
|
+
# Wait for accli-umount-nfs to finish restarting NfsRdr/NfsClnt
|
|
1872
|
+
for _ in range(16):
|
|
1873
|
+
umount_check = subprocess.run(["schtasks", "/query", "/tn", "accli-umount-nfs"], capture_output=True, text=True, errors="replace")
|
|
1874
|
+
clnt_check = subprocess.run(["sc.exe", "query", "NfsClnt"], capture_output=True, text=True, errors="replace")
|
|
1875
|
+
if (not umount_check.stdout or "Running" not in umount_check.stdout) and (clnt_check.stdout and "RUNNING" in clnt_check.stdout):
|
|
1876
|
+
break
|
|
1877
|
+
time.sleep(0.5)
|
|
1878
|
+
|
|
1849
1879
|
# Wait until drive letter is released from Windows namespace
|
|
1850
1880
|
for _ in range(10):
|
|
1851
1881
|
if not is_windows_drive_mapped(target_str):
|
|
@@ -126,12 +126,12 @@ class AccliGuiApp(tk.Tk):
|
|
|
126
126
|
if update_avail:
|
|
127
127
|
instruction = get_upgrade_instruction()
|
|
128
128
|
def show_notice():
|
|
129
|
-
self.status_bar_val.set(f"Update available: {latest} (current: {VERSION})")
|
|
130
|
-
self.append_log(f"\n🔔
|
|
129
|
+
self.status_bar_val.set(f"Update available: accli {latest} (current: {VERSION})")
|
|
130
|
+
self.append_log(f"\n🔔 Update available: accli {latest} (current: {VERSION})\n{instruction}\n\n")
|
|
131
131
|
# Also show subtle info notification
|
|
132
132
|
messagebox.showinfo(
|
|
133
133
|
"Update Available",
|
|
134
|
-
f"
|
|
134
|
+
f"Update available: accli {latest} (current: {VERSION})\n\n{instruction}"
|
|
135
135
|
)
|
|
136
136
|
self.after(0, show_notice)
|
|
137
137
|
threading.Thread(target=worker, daemon=True).start()
|
|
@@ -152,8 +152,11 @@ if ($cfg.skip_auto_mount) {
|
|
|
152
152
|
$env:HF_MOUNT_SKIP_AUTO_MOUNT = "1"
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
# Ensure NfsClnt
|
|
155
|
+
# Ensure NfsRdr and NfsClnt services are started before attempting mount
|
|
156
156
|
try {
|
|
157
|
+
if ((Get-Service -Name "NfsRdr" -ErrorAction SilentlyContinue).Status -ne 'Running') {
|
|
158
|
+
Start-Service -Name "NfsRdr" -ErrorAction SilentlyContinue
|
|
159
|
+
}
|
|
157
160
|
if ((Get-Service -Name "NfsClnt" -ErrorAction SilentlyContinue).Status -ne 'Running') {
|
|
158
161
|
Start-Service -Name "NfsClnt" -ErrorAction SilentlyContinue
|
|
159
162
|
}
|
|
@@ -218,6 +221,14 @@ try {
|
|
|
218
221
|
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue | Out-Null
|
|
219
222
|
}
|
|
220
223
|
} catch {}
|
|
224
|
+
|
|
225
|
+
# Synchronously stop NfsClnt & NfsRdr, then start NfsRdr & NfsClnt to flush stale kernel V_NET_ROOT cache
|
|
226
|
+
try {
|
|
227
|
+
Stop-Service -Name "NfsClnt" -Force -ErrorAction SilentlyContinue
|
|
228
|
+
Stop-Service -Name "NfsRdr" -Force -ErrorAction SilentlyContinue
|
|
229
|
+
Start-Service -Name "NfsRdr" -ErrorAction SilentlyContinue
|
|
230
|
+
Start-Service -Name "NfsClnt" -ErrorAction SilentlyContinue
|
|
231
|
+
} catch {}
|
|
221
232
|
'@
|
|
222
233
|
|
|
223
234
|
$helperUmountScriptPath = "C:\ProgramData\accli\run-umount-helper.ps1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: accli
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: IIASA Accelerator Client
|
|
5
5
|
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -70,7 +70,7 @@ This client uses **device authentication** via Auth0.
|
|
|
70
70
|
|
|
71
71
|
### ✅ Requirements
|
|
72
72
|
|
|
73
|
-
- Python >= 3.
|
|
73
|
+
- Python >= 3.8
|
|
74
74
|
|
|
75
75
|
### 📦 Installation
|
|
76
76
|
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""Verify that `check_for_updates` runs via the root callback for all CLI commands with a unified design."""
|
|
2
|
+
import unittest
|
|
3
|
+
from unittest.mock import patch
|
|
4
|
+
|
|
5
|
+
from typer.testing import CliRunner
|
|
6
|
+
|
|
7
|
+
from accli import cli
|
|
8
|
+
from accli._version import VERSION
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class _FakeService:
|
|
12
|
+
def get_job_logs(self, *args, **kwargs):
|
|
13
|
+
return dict(chunks=[], events=[], after=None, before=None, has_more_before=False, job_completed=True)
|
|
14
|
+
|
|
15
|
+
def list_root_jobs(self, *args, **kwargs):
|
|
16
|
+
return dict(results=[], count=0)
|
|
17
|
+
|
|
18
|
+
def get_job_graph(self, *args, **kwargs):
|
|
19
|
+
return dict(
|
|
20
|
+
root_job_id=1,
|
|
21
|
+
graph_status="DONE",
|
|
22
|
+
jobs=[
|
|
23
|
+
dict(
|
|
24
|
+
id=1,
|
|
25
|
+
name="root",
|
|
26
|
+
job_executor_id="WKUBE",
|
|
27
|
+
job_entry_location="main.py",
|
|
28
|
+
status="DONE",
|
|
29
|
+
parent_job_id=None,
|
|
30
|
+
predecessor_job_id=None,
|
|
31
|
+
status_at=None,
|
|
32
|
+
created_at=None,
|
|
33
|
+
)
|
|
34
|
+
],
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
ALL_COMMAND_INVOCATIONS = [
|
|
39
|
+
[],
|
|
40
|
+
["-h"],
|
|
41
|
+
["--help"],
|
|
42
|
+
["--version"],
|
|
43
|
+
["-v"],
|
|
44
|
+
["about"],
|
|
45
|
+
["gui"],
|
|
46
|
+
["login"],
|
|
47
|
+
["validate", "demo", "tmpl", "file.csv"],
|
|
48
|
+
["dispatch", "demo", "root_task", "-f", "nonexistent_wkube.py"],
|
|
49
|
+
["logs", "demo", "1"],
|
|
50
|
+
["jobs", "demo"],
|
|
51
|
+
["job", "demo", "1"],
|
|
52
|
+
["copy", "local_a", "local_b"],
|
|
53
|
+
["mount", "start", "demo", "--mode", "invalid"],
|
|
54
|
+
["mount", "stop", "invalid_drive"],
|
|
55
|
+
["mount", "status"],
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class TestUpdateCheckAllCommands(unittest.TestCase):
|
|
60
|
+
def setUp(self):
|
|
61
|
+
import accli.gui
|
|
62
|
+
|
|
63
|
+
class _FakeResp:
|
|
64
|
+
status_code = 200
|
|
65
|
+
|
|
66
|
+
@staticmethod
|
|
67
|
+
def json():
|
|
68
|
+
return {"access_token": "tok", "refresh_token": "ref"}
|
|
69
|
+
|
|
70
|
+
self.patches = [
|
|
71
|
+
patch.object(accli.gui, "main", lambda: None),
|
|
72
|
+
patch.object(cli.typer, "prompt", lambda *a, **kw: "fake-code"),
|
|
73
|
+
patch.object(cli.requests, "post", lambda *a, **kw: _FakeResp()),
|
|
74
|
+
patch.object(cli, "save_token_details", lambda *a, **kw: None),
|
|
75
|
+
patch.object(cli, "AcceleratorTerminalCliProjectService", lambda **kw: _FakeService()),
|
|
76
|
+
patch.object(cli, "CsvRegionalTimeseriesValidator", lambda **kw: (lambda: None)),
|
|
77
|
+
patch.object(cli, "_cli_service_for", lambda slug: _FakeService()),
|
|
78
|
+
patch.object(cli, "get_token", lambda: ""),
|
|
79
|
+
patch.object(cli, "get_server_url", lambda: "https://acc.example"),
|
|
80
|
+
patch.object(cli, "set_project_slug", lambda slug: None),
|
|
81
|
+
patch.object(cli, "exchange_refresh_token", lambda slug: ("", "token", 0)),
|
|
82
|
+
patch("platform.system", lambda: "Windows"),
|
|
83
|
+
patch.object(cli, "is_nfs_daemon_running", lambda: False),
|
|
84
|
+
patch.object(cli, "stop_nfs_watcher", lambda *a, **kw: None),
|
|
85
|
+
patch.object(cli, "is_windows_drive_mapped", lambda *a, **kw: False),
|
|
86
|
+
patch.object(cli, "cleanup_stuck_windows_mount_processes", lambda: None),
|
|
87
|
+
]
|
|
88
|
+
for p in self.patches:
|
|
89
|
+
p.start()
|
|
90
|
+
|
|
91
|
+
def tearDown(self):
|
|
92
|
+
for p in reversed(self.patches):
|
|
93
|
+
p.stop()
|
|
94
|
+
|
|
95
|
+
def test_all_registered_commands_are_covered(self):
|
|
96
|
+
"""Ensure every command registered on `app` and `mount_app` is included in ALL_COMMAND_INVOCATIONS."""
|
|
97
|
+
root_commands = {cmd.name or cmd.callback.__name__ for cmd in cli.app.registered_commands}
|
|
98
|
+
mount_commands = {cmd.name or cmd.callback.__name__ for cmd in cli.mount_app.registered_commands}
|
|
99
|
+
|
|
100
|
+
tested_root = {args[0] for args in ALL_COMMAND_INVOCATIONS if args and not args[0].startswith("-")}
|
|
101
|
+
tested_mount = {args[1] for args in ALL_COMMAND_INVOCATIONS if args[:1] == ["mount"] and len(args) > 1}
|
|
102
|
+
|
|
103
|
+
self.assertTrue(root_commands <= tested_root, f"Missing root commands: {root_commands - tested_root}")
|
|
104
|
+
self.assertTrue(mount_commands <= tested_mount, f"Missing mount commands: {mount_commands - tested_mount}")
|
|
105
|
+
|
|
106
|
+
def test_update_notice_shown_once_on_every_command(self):
|
|
107
|
+
runner = CliRunner()
|
|
108
|
+
expected_banner = f"🔔 Update available: accli 99.0.0 (current: {VERSION})"
|
|
109
|
+
expected_instruction = "To update, run: pip install -U accli"
|
|
110
|
+
|
|
111
|
+
for args in ALL_COMMAND_INVOCATIONS:
|
|
112
|
+
with self.subTest(command=" ".join(args)):
|
|
113
|
+
calls = []
|
|
114
|
+
|
|
115
|
+
def fake_check():
|
|
116
|
+
calls.append(1)
|
|
117
|
+
return True, "99.0.0"
|
|
118
|
+
|
|
119
|
+
with patch.object(cli, "check_for_updates", fake_check), patch.object(
|
|
120
|
+
cli, "get_upgrade_instruction", lambda: expected_instruction
|
|
121
|
+
):
|
|
122
|
+
result = runner.invoke(cli.app, args, env={"COLUMNS": "200"})
|
|
123
|
+
|
|
124
|
+
self.assertEqual(
|
|
125
|
+
len(calls),
|
|
126
|
+
1,
|
|
127
|
+
f"Expected check_for_updates to be called once for {args}, got {len(calls)}",
|
|
128
|
+
)
|
|
129
|
+
self.assertEqual(result.output.count(expected_banner), 1, result.output)
|
|
130
|
+
self.assertEqual(result.output.count(expected_instruction), 1, result.output)
|
|
131
|
+
|
|
132
|
+
def test_no_update_notice_when_up_to_date_on_every_command(self):
|
|
133
|
+
runner = CliRunner()
|
|
134
|
+
|
|
135
|
+
for args in ALL_COMMAND_INVOCATIONS:
|
|
136
|
+
with self.subTest(command=" ".join(args)):
|
|
137
|
+
calls = []
|
|
138
|
+
|
|
139
|
+
def fake_check():
|
|
140
|
+
calls.append(1)
|
|
141
|
+
return False, None
|
|
142
|
+
|
|
143
|
+
with patch.object(cli, "check_for_updates", fake_check):
|
|
144
|
+
result = runner.invoke(cli.app, args, env={"COLUMNS": "200"})
|
|
145
|
+
|
|
146
|
+
self.assertEqual(len(calls), 1, f"Expected check_for_updates to be called once for {args}")
|
|
147
|
+
self.assertNotIn("Update available:", result.output)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
if __name__ == "__main__":
|
|
151
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|