Skip to content

Commit 9a3503d

Browse files
Migrated TestLibCompletion from test_completion.py to completion_test.go
1 parent 61f9eb4 commit 9a3503d

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

Diff for: internal/integrationtest/completion/completion_test.go

+29
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,32 @@ func TestConfigCompletion(t *testing.T) {
213213
stdout, _, _ = cli.Run("__complete", "config", "set", "")
214214
require.Contains(t, string(stdout), "board_manager.additional_urls")
215215
}
216+
217+
// here we test if the completions coming from the libs are working
218+
func TestLibCompletion(t *testing.T) {
219+
env := testsuite.NewEnvironment(t)
220+
defer env.CleanUp()
221+
222+
cli := integrationtest.NewArduinoCliWithinEnvironment(env, &integrationtest.ArduinoCLIConfig{
223+
ArduinoCLIPath: paths.New("..", "..", "..", "arduino-cli"),
224+
UseSharedStagingFolder: true,
225+
})
226+
227+
_, _, err := cli.Run("lib", "update-index")
228+
require.NoError(t, err)
229+
stdout, _, _ := cli.Run("__complete", "lib", "install", "")
230+
require.Contains(t, string(stdout), "WiFi101")
231+
stdout, _, _ = cli.Run("__complete", "lib", "download", "")
232+
require.Contains(t, string(stdout), "WiFi101")
233+
stdout, _, _ = cli.Run("__complete", "lib", "uninstall", "")
234+
require.NotContains(t, string(stdout), "WiFi101") // not yet installed
235+
236+
_, _, err = cli.Run("lib", "install", "Wifi101")
237+
require.NoError(t, err)
238+
stdout, _, _ = cli.Run("__complete", "lib", "uninstall", "")
239+
require.Contains(t, string(stdout), "WiFi101")
240+
stdout, _, _ = cli.Run("__complete", "lib", "examples", "")
241+
require.Contains(t, string(stdout), "WiFi101")
242+
stdout, _, _ = cli.Run("__complete", "lib", "deps", "")
243+
require.Contains(t, string(stdout), "WiFi101")
244+
}

Diff for: test/test_completion.py

-19
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,6 @@
1414
# a commercial license, send an email to [email protected].
1515

1616

17-
# here we test if the completions coming from the libs are working
18-
def test_lib_completion(run_command):
19-
assert run_command(["lib", "update-index"])
20-
result = run_command(["__complete", "lib", "install", ""], hide=True)
21-
assert "WiFi101" in result.stdout
22-
result = run_command(["__complete", "lib", "download", ""], hide=True)
23-
assert "WiFi101" in result.stdout
24-
result = run_command(["__complete", "lib", "uninstall", ""], hide=True)
25-
assert "WiFi101" not in result.stdout # not yet installed
26-
27-
assert run_command(["lib", "install", "WiFi101"])
28-
result = run_command(["__complete", "lib", "uninstall", ""])
29-
assert "WiFi101" in result.stdout
30-
result = run_command(["__complete", "lib", "examples", ""])
31-
assert "WiFi101" in result.stdout
32-
result = run_command(["__complete", "lib", "deps", ""])
33-
assert "WiFi101" in result.stdout
34-
35-
3617
# here we test if the completions coming from the core are working
3718
def test_core_completion(run_command):
3819
assert run_command(["core", "update-index"])

0 commit comments

Comments
 (0)