File tree Expand file tree Collapse file tree 3 files changed +30
-19
lines changed
src/azure-cli-core/azure/cli/core Expand file tree Collapse file tree 3 files changed +30
-19
lines changed Original file line number Diff line number Diff line change 33 "configurations" : [
44 {
55 "name" : " Azure CLI Debug (Integrated Console)" ,
6- "type" : " python " ,
6+ "type" : " debugpy " ,
77 "request" : " launch" ,
88 "python" : " ${command:python.interpreterPath}" ,
99 "program" : " ${workspaceRoot}/src/azure-cli/azure/cli/__main__.py" ,
1212 " --help"
1313 ],
1414 "console" : " integratedTerminal" ,
15- "debugOptions" : [
16- " WaitOnAbnormalExit" ,
17- " WaitOnNormalExit" ,
18- " RedirectOutput"
19- ],
2015 "justMyCode" : false
2116 },
2217 {
2318 "name" : " Azure CLI Debug (External Console)" ,
24- "type" : " python " ,
19+ "type" : " debugpy " ,
2520 "request" : " launch" ,
2621 "stopOnEntry" : true ,
2722 "python" : " ${command:python.interpreterPath}" ,
2823 "program" : " ${workspaceRoot}/src/azure-cli/azure/cli/__main__.py" ,
2924 "cwd" : " ${workspaceRoot}" ,
3025 "args" : [
31- " --help "
26+ " --version "
3227 ],
3328 "console" : " externalTerminal" ,
34- "debugOptions" : [
35- " WaitOnAbnormalExit" ,
36- " WaitOnNormalExit"
37- ]
3829 },
3930 {
4031 "name" : " Azdev Scripts" ,
41- "type" : " python " ,
32+ "type" : " debugpy " ,
4233 "request" : " launch" ,
4334 "python" : " ${command:python.interpreterPath}" ,
4435 "program" : " ${workspaceRoot}/tools/automation/__main__.py" ,
4738 " --help"
4839 ],
4940 "console" : " integratedTerminal" ,
50- "debugOptions" : [
51- " WaitOnAbnormalExit" ,
52- " WaitOnNormalExit" ,
53- " RedirectOutput"
54- ]
5541 }
5642 ]
57- }
43+ }
Original file line number Diff line number Diff line change @@ -120,6 +120,9 @@ def get_cli_version(self):
120120
121121 def show_version (self ):
122122 from azure .cli .core .util import get_az_version_string , show_updates
123+ from azure .cli .core import telemetry
124+
125+ telemetry .set_command_details (command = "" , parameters = ["--version" ])
123126
124127 ver_string , updates_available_components = get_az_version_string ()
125128 print (ver_string )
Original file line number Diff line number Diff line change 44# --------------------------------------------------------------------------------------------
55
66import unittest
7+ from unittest import mock
78
89
910class TestCoreTelemetry (unittest .TestCase ):
@@ -57,3 +58,24 @@ def test_cloud_forbid_telemetry(self):
5758 # mock to add current cloud name in CLOUDS_FORBIDDING_TELEMETRY
5859 with mock .patch ('azure.cli.core.cloud.CLOUDS_FORBIDDING_TELEMETRY' , [az_cli .cloud .name ]):
5960 self .assertFalse (telemetry .is_telemetry_enabled ())
61+
62+ @mock .patch ('azure.cli.core.util.get_az_version_string' )
63+ def test_show_version_sets_telemetry_params (self , mock_get_version ):
64+ """Test show_version telemetry state is same regardless of available updates."""
65+ from azure .cli .core .mock import DummyCli
66+ from azure .cli .core import telemetry
67+ from knack .completion import ARGCOMPLETE_ENV_NAME
68+
69+ mock_get_version .return_value = ("azure-cli 2.80.0" , ["core" , "extension1" ])
70+
71+ telemetry .start ()
72+
73+ cli = DummyCli ()
74+ telemetry .set_application (cli , ARGCOMPLETE_ENV_NAME )
75+
76+ cli .show_version ()
77+
78+ session = telemetry ._session
79+ self .assertEqual (session .command , "" )
80+ self .assertEqual (session .parameters , ["--version" ])
81+ self .assertIsNone (session .raw_command )
You can’t perform that action at this time.
0 commit comments