|
12 | 12 | # otherwise use the software for commercial activities involving the Arduino |
13 | 13 | # software without disclosing the source code of your own applications. To purchase |
14 | 14 | # a commercial license, send an email to license@arduino.cc. |
15 | | -import pytest |
16 | 15 | import simplejson as json |
17 | 16 |
|
18 | 17 |
|
@@ -40,7 +39,7 @@ def test_list(run_command): |
40 | 39 | assert "" == result.stderr |
41 | 40 | lines = result.stdout.strip().splitlines() |
42 | 41 | assert 2 == len(lines) |
43 | | - toks = lines[1].split("\t") |
| 42 | + toks = [t.strip() for t in lines[1].split()] |
44 | 43 | # be sure line contain the current version AND the available version |
45 | 44 | assert "" != toks[1] |
46 | 45 | assert "" != toks[2] |
@@ -79,22 +78,22 @@ def test_remove(run_command): |
79 | 78 | assert result.ok |
80 | 79 |
|
81 | 80 |
|
82 | | -@pytest.mark.slow |
83 | 81 | def test_search(run_command): |
84 | | - result = run_command("lib search") |
| 82 | + assert run_command("lib update-index") |
| 83 | + |
| 84 | + result = run_command("lib search --names") |
85 | 85 | assert result.ok |
86 | 86 | out_lines = result.stdout.splitlines() |
87 | 87 | # Create an array with just the name of the vars |
88 | 88 | libs = [] |
89 | 89 | for line in out_lines: |
90 | | - if line.startswith("Name: "): |
91 | | - start = line.find('"') + 1 |
92 | | - libs.append(line[start:-1]) |
| 90 | + start = line.find('"') + 1 |
| 91 | + libs.append(line[start:-1]) |
93 | 92 |
|
94 | 93 | expected = {"WiFi101", "WiFi101OTA", "Firebase Arduino based on WiFi101"} |
95 | 94 | assert expected == {lib for lib in libs if "WiFi101" in lib} |
96 | 95 |
|
97 | | - result = run_command("lib search --format json") |
| 96 | + result = run_command("lib search --names --format json") |
98 | 97 | assert result.ok |
99 | 98 | libs_json = json.loads(result.stdout) |
100 | 99 | assert len(libs) == len(libs_json.get("libraries")) |
|
0 commit comments