Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit 83b6ccc

Browse files
James CrosbyJames Crosby
James Crosby
authored and
James Crosby
committed
set status code of search command based on whether results have failed; more instrumentation in search tests
1 parent b76d918 commit 83b6ccc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

yotta/search.py

+5
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ def execCommand(args, following_args):
5353
if args.type == 'both' or args.type == result['type']:
5454
description = result['description'] if 'description' in result else '<no description>'
5555
print('%s %s: %s' % (result['name'], result['version'], lengthLimit(description, 160)))
56+
# exit status: success if we found something, otherwise fail
57+
if count:
58+
return 0
59+
else:
60+
return 1
5661

yotta/test/cli/search.py

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def test_limit(self):
4343

4444
def runCheckCommand(self, args):
4545
stdout, stderr, statuscode = cli.run(args)
46+
if statuscode != 0:
47+
print('command failed with status %s' % statuscode)
48+
print(stdout)
49+
print(strerr)
4650
self.assertEqual(statuscode, 0)
4751
return stdout or stderr
4852

0 commit comments

Comments
 (0)