Skip to content

Commit b9c6b9c

Browse files
committed
[skip changelog] Fix core search tests
1 parent 4079684 commit b9c6b9c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Diff for: .flake8

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[flake8]
44
max-line-length = 120
55
ignore =
6+
E203,
67
E741,
78
# W503 and W504 are mutually exclusive, so one or the other must be ignored.
89
# PEP 8 recommends line break before, so we keep W504.

Diff for: test/test_core.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ def test_core_search_no_args(run_command, httpserver):
104104
num_platforms = 0
105105
lines = [l.strip().split() for l in result.stdout.strip().splitlines()]
106106
# 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:])
107+
assert ["Updating", "index:", "package_index.json", "downloaded"] in lines
108+
assert ["Updating", "index:", "package_index.json.sig", "downloaded"] in lines
109+
assert ["test:x86", "2.0.0", "test_core"] in lines
110+
header_index = lines.index(["ID", "Version", "Name"])
111+
num_platforms = len(lines[header_index + 1 :])
112112

113113
# same thing in JSON format, also check the number of platforms found is the same
114114
result = run_command("core search --format json")
@@ -123,11 +123,11 @@ def test_core_search_no_args(run_command, httpserver):
123123
num_platforms = 0
124124
lines = [l.strip().split() for l in result.stdout.strip().splitlines()]
125125
# 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:])
126+
assert ["Updating", "index:", "package_index.json", "downloaded"] in lines
127+
assert ["Updating", "index:", "package_index.json.sig", "downloaded"] in lines
128+
assert ["test:x86", "2.0.0", "test_core"] in lines
129+
header_index = lines.index(["ID", "Version", "Name"])
130+
num_platforms = len(lines[header_index + 1 :])
131131

132132
# same thing in JSON format, also check the number of platforms found is the same
133133
result = run_command(f"core search --format json --additional-urls={url}")

0 commit comments

Comments
 (0)