mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Fix up pinout tests so they work with new structure
This commit is contained in:
@@ -9,27 +9,27 @@ str = type('')
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from gpiozero.cli import pinout
|
from gpiozero.cli.pinout import main
|
||||||
|
|
||||||
|
|
||||||
def test_args_incorrect():
|
def test_args_incorrect():
|
||||||
with pytest.raises(SystemExit) as ex:
|
with pytest.raises(SystemExit) as ex:
|
||||||
pinout.parse_args(['--nonexistentarg'])
|
main(['pinout', '--nonexistentarg'])
|
||||||
|
|
||||||
def test_args_color():
|
def test_args_color():
|
||||||
args = pinout.parse_args([])
|
args = main.parser.parse_args([])
|
||||||
assert args.color is None
|
assert args.color is None
|
||||||
args = pinout.parse_args(['--color'])
|
args = main.parser.parse_args(['--color'])
|
||||||
assert args.color is True
|
assert args.color is True
|
||||||
args = pinout.parse_args(['--monochrome'])
|
args = main.parser.parse_args(['--monochrome'])
|
||||||
assert args.color is False
|
assert args.color is False
|
||||||
|
|
||||||
def test_args_revision():
|
def test_args_revision():
|
||||||
args = pinout.parse_args(['--revision', '000d'])
|
args = main.parser.parse_args(['--revision', '000d'])
|
||||||
assert args.revision == '000d'
|
assert args.revision == '000d'
|
||||||
|
|
||||||
def test_help(capsys):
|
def test_help(capsys):
|
||||||
with pytest.raises(SystemExit) as ex:
|
with pytest.raises(SystemExit) as ex:
|
||||||
pinout.parse_args(['--help'])
|
main(['pinout', '--help'])
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
assert 'GPIO pinout' in out
|
assert 'GPIO pinout' in out
|
||||||
|
|||||||
Reference in New Issue
Block a user