@@ -49,39 +49,61 @@ def test_core_search(run_command, httpserver):
49
49
result = run_command (f"core search retrokit --all --additional-urls={ url } " )
50
50
assert result .ok
51
51
lines = [l .strip ().split () for l in result .stdout .strip ().splitlines ()]
52
- assert 11 == len (lines )
53
52
assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines
54
53
assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines
55
54
assert ["Retrokits-RK002:arm" , "1.0.5" , "RK002" ] in lines
56
55
assert ["Retrokits-RK002:arm" , "1.0.6" , "RK002" ] in lines
56
+ header_index = lines .index (["ID" , "Version" , "Name" ])
57
+ # We use black to format and flake8 to lint .py files but they disagree on certain
58
+ # things like this one, thus we ignore this specific flake8 rule and stand by black
59
+ # opinion.
60
+ # We ignore this specific case because ignoring it globally would probably cause more
61
+ # issue. For more info about the rule see: https://www.flake8rules.com/rules/E203.html
62
+ assert 2 == len (lines [header_index + 1 :]) # noqa: E203
57
63
58
64
# Search using Retrokit Package Maintainer
59
65
result = run_command (f"core search Retrokits-RK002 --all --additional-urls={ url } " )
60
66
assert result .ok
61
67
lines = [l .strip ().split () for l in result .stdout .strip ().splitlines ()]
62
- assert 11 == len (lines )
63
68
assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines
64
69
assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines
65
70
assert ["Retrokits-RK002:arm" , "1.0.5" , "RK002" ] in lines
66
71
assert ["Retrokits-RK002:arm" , "1.0.6" , "RK002" ] in lines
72
+ # We use black to format and flake8 to lint .py files but they disagree on certain
73
+ # things like this one, thus we ignore this specific flake8 rule and stand by black
74
+ # opinion.
75
+ # We ignore this specific case because ignoring it globally would probably cause more
76
+ # issue. For more info about the rule see: https://www.flake8rules.com/rules/E203.html
77
+ assert 2 == len (lines [header_index + 1 :]) # noqa: E203
67
78
68
79
# Search using the Retrokit Platform name
69
80
result = run_command (f"core search rk002 --all --additional-urls={ url } " )
70
81
assert result .ok
71
- assert 11 == len ( lines )
82
+ lines = [ l . strip (). split () for l in result . stdout . strip (). splitlines ()]
72
83
assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines
73
84
assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines
74
85
assert ["Retrokits-RK002:arm" , "1.0.5" , "RK002" ] in lines
75
86
assert ["Retrokits-RK002:arm" , "1.0.6" , "RK002" ] in lines
87
+ # We use black to format and flake8 to lint .py files but they disagree on certain
88
+ # things like this one, thus we ignore this specific flake8 rule and stand by black
89
+ # opinion.
90
+ # We ignore this specific case because ignoring it globally would probably cause more
91
+ # issue. For more info about the rule see: https://www.flake8rules.com/rules/E203.html
92
+ assert 2 == len (lines [header_index + 1 :]) # noqa: E203
76
93
77
94
# Search using a board name
78
95
result = run_command (f"core search myboard --all --additional-urls={ url } " )
79
96
assert result .ok
80
- assert 10 == len (result .stdout .strip ().splitlines ())
81
97
lines = [l .strip ().split () for l in result .stdout .strip ().splitlines ()]
82
98
assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines
83
99
assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines
84
100
assert ["Package:x86" , "1.2.3" , "Platform" ] in lines
101
+ # We use black to format and flake8 to lint .py files but they disagree on certain
102
+ # things like this one, thus we ignore this specific flake8 rule and stand by black
103
+ # opinion.
104
+ # We ignore this specific case because ignoring it globally would probably cause more
105
+ # issue. For more info about the rule see: https://www.flake8rules.com/rules/E203.html
106
+ assert 1 == len (lines [header_index + 1 :]) # noqa: E203
85
107
86
108
87
109
def test_core_search_no_args (run_command , httpserver ):
@@ -104,11 +126,16 @@ def test_core_search_no_args(run_command, httpserver):
104
126
num_platforms = 0
105
127
lines = [l .strip ().split () for l in result .stdout .strip ().splitlines ()]
106
128
# Index update output and the header are printed on the first lines
107
- assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines [:6 ]
108
- assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines [:6 ]
109
- assert ["ID" , "Version" , "Name" ] == lines [5 ]
110
- assert ["test:x86" , "2.0.0" , "test_core" ] in lines [6 :]
111
- num_platforms = len (lines [6 :])
129
+ assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines
130
+ assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines
131
+ assert ["test:x86" , "2.0.0" , "test_core" ] in lines
132
+ header_index = lines .index (["ID" , "Version" , "Name" ])
133
+ # We use black to format and flake8 to lint .py files but they disagree on certain
134
+ # things like this one, thus we ignore this specific flake8 rule and stand by black
135
+ # opinion.
136
+ # We ignore this specific case because ignoring it globally would probably cause more
137
+ # issue. For more info about the rule see: https://www.flake8rules.com/rules/E203.html
138
+ num_platforms = len (lines [header_index + 1 :]) # noqa: E203
112
139
113
140
# same thing in JSON format, also check the number of platforms found is the same
114
141
result = run_command ("core search --format json" )
@@ -123,11 +150,16 @@ def test_core_search_no_args(run_command, httpserver):
123
150
num_platforms = 0
124
151
lines = [l .strip ().split () for l in result .stdout .strip ().splitlines ()]
125
152
# Index update output and the header are printed on the first lines
126
- assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines [:9 ]
127
- assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines [:9 ]
128
- assert ["ID" , "Version" , "Name" ] == lines [8 ]
129
- assert ["test:x86" , "2.0.0" , "test_core" ] in lines [9 :]
130
- num_platforms = len (lines [9 :])
153
+ assert ["Updating" , "index:" , "package_index.json" , "downloaded" ] in lines
154
+ assert ["Updating" , "index:" , "package_index.json.sig" , "downloaded" ] in lines
155
+ assert ["test:x86" , "2.0.0" , "test_core" ] in lines
156
+ header_index = lines .index (["ID" , "Version" , "Name" ])
157
+ # We use black to format and flake8 to lint .py files but they disagree on certain
158
+ # things like this one, thus we ignore this specific flake8 rule and stand by black
159
+ # opinion.
160
+ # We ignore this specific case because ignoring it globally would probably cause more
161
+ # issue. For more info about the rule see: https://www.flake8rules.com/rules/E203.html
162
+ num_platforms = len (lines [header_index + 1 :]) # noqa: E203
131
163
132
164
# same thing in JSON format, also check the number of platforms found is the same
133
165
result = run_command (f"core search --format json --additional-urls={ url } " )
0 commit comments