Skip to content

Commit e38cf85

Browse files
terrikopdxjohnny
authored andcommitted
Make test more robust to output changes
1 parent 079dfd0 commit e38cf85

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/test_cli.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ def test_skips(self):
109109
"""Tests the skips option"""
110110

111111
logger = logging.getLogger()
112-
test_path = os.path.join(
113-
os.path.abspath(os.path.dirname(__file__)),
114-
"binaries",
115-
"test-sqlite-3.12.2.out",
116-
)
112+
test_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "csv")
117113

118114
skip_checkers = ["systemd", "xerces", "xml2", "kerberos"]
119115
include_checkers = ["expat", "libgcrypt", "openssl", "sqlite"]
@@ -122,7 +118,9 @@ def test_skips(self):
122118
main(["cve-bin-tool", test_path, "-s", ",".join(skip_checkers)])
123119

124120
# The final log has all the checkers detected
125-
final_log = cm.output[1]
121+
final_log = [i for i in cm.output if "Checkers:" in i]
122+
self.assertTrue(len(final_log) > 0, "Could not find checkers line in log")
123+
final_log = final_log[0]
126124
for checker in skip_checkers:
127125
self.assertTrue(
128126
checker not in final_log, "found skipped checker {}".format(checker)
@@ -139,7 +137,9 @@ def test_skips(self):
139137
with self.assertLogs(logger, logging.INFO) as cm:
140138
main(["cve-bin-tool", test_path, "-s", ",".join(skip_checkers)])
141139

142-
final_log = cm.output[1]
140+
final_log = [i for i in cm.output if "Checkers:" in i]
141+
self.assertTrue(len(final_log) > 0, "Could not find checkers line in log")
142+
final_log = final_log[0]
143143
for checker in skip_checkers:
144144
self.assertTrue(
145145
checker not in final_log, "found skipped checker {}".format(checker)

0 commit comments

Comments
 (0)