Skip to content

Commit fc54667

Browse files
committed
More small tidyups
- switch to using sys.exit instead of exit - always exit with error-code 1 - don't bother testing error-codes - documentation wording tweak
1 parent 117e4f5 commit fc54667

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

docs/cli_tools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Pinout
77

88
The gpiozero package contains a database of information about the various
99
revisions of Raspberry Pi. This is queried by the ``pinout`` command-line
10-
tool to write details of the GPIO pins available.
10+
tool to output details of the GPIO pins available.
1111

1212
Unless specified, the revision of the current device will be detected. A
1313
particular revision may be selected with the --revision command-line

gpiozero/cli/pinout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def parse_args(args):
4545
except argparse.ArgumentError as ex:
4646
print('Error parsing arguments.')
4747
parser.error(str(ex.message))
48-
exit(-1)
48+
sys.exit(1)
4949
return args
5050

5151

@@ -57,7 +57,7 @@ def main():
5757
pi_info().pprint(color=args.color)
5858
except IOError:
5959
print('This device is not a Raspberry Pi')
60-
exit(2)
60+
sys.exit(1)
6161
else:
6262
pi_info(args.revision).pprint(color=args.color)
6363

tests/cli/test_pinout.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
def test_args_incorrect():
1616
with pytest.raises(SystemExit) as ex:
1717
pinout.parse_args(['--nonexistentarg'])
18-
assert ex.value.code == 2
19-
2018

2119
def test_args_color():
2220
args = pinout.parse_args([])
@@ -26,15 +24,12 @@ def test_args_color():
2624
args = pinout.parse_args(['--monochrome'])
2725
assert args.color is False
2826

29-
3027
def test_args_revision():
3128
args = pinout.parse_args(['--revision', '000d'])
3229
assert args.revision == '000d'
3330

34-
3531
def test_help(capsys):
3632
with pytest.raises(SystemExit) as ex:
3733
pinout.parse_args(['--help'])
3834
out, err = capsys.readouterr()
3935
assert 'GPIO pinout' in out
40-
assert ex.value.code == 0

0 commit comments

Comments
 (0)