-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
dee8ca8
commit b47a462
Showing
10 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,8 @@ | |
"xlabel", | ||
"xunit", | ||
"yepkit", | ||
"ykush", | ||
"ykushcmd", | ||
"ylabel" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# This is needed for read-the-docs. Please use tox -e local to install developer dependencies. | ||
|
||
pyserial | ||
pytest | ||
pytest-asyncio | ||
sphinx | ||
sphinx-argparse | ||
sphinx_rtd_theme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# | ||
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# This software is distributed under the terms of the MIT License. | ||
# | ||
# (@@@@%%%%%%%%%&@@&. | ||
# /%&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&@@( | ||
# *@&%%%%%%%%%&&%%%%%%%%%%%%%%%%%%&&&%%%%%%% | ||
# @ @@@(@@@@%%%%%%%%%%%%%%%%&@@&* @@@ . | ||
# , . . .@@@& / | ||
# . . * | ||
# @@ . @ | ||
# @&&&&&&@. . . *@%&@ | ||
# &&&&&&&&&&&&&&&&@@ *@@############@ | ||
# *&/ @@ #&&&&&&&&&&&&&&&&&&&&@ ###################* | ||
# @&&&&&&&&&&&&&&&&&&##################@ | ||
# %@&&&&&&&&&&&&&&################@ | ||
# @&&&&&&&&&&%#######&@% | ||
# nanaimo (@&&&&####@@* | ||
# | ||
""" | ||
TODO: See https://www.learn.yepkit.com/reference/ykushcmd-reference-ykush/1/2 for the command | ||
strings. | ||
""" | ||
|
||
import typing | ||
|
||
import pytest | ||
|
||
import nanaimo | ||
import nanaimo.fixtures | ||
import nanaimo.pytest.plugin | ||
|
||
|
||
class Fixture(nanaimo.fixtures.SubprocessFixture): | ||
""" | ||
Fixture for controlling Yepkit USB hubs with switchable power. For example | ||
the `YKUSH3 <https://www.yepkit.com/product/300110/YKUSH3>`_ is a 3-port | ||
USB-3 hub that allows individual control of the power rails for each port. | ||
""" | ||
|
||
fixture_name = 'nanaimo_ykush' | ||
argument_prefix = 'yku' | ||
|
||
ykush_cmd = 'ykushcmd' | ||
|
||
@classmethod | ||
def on_visit_test_arguments(cls, arguments: nanaimo.Arguments) -> None: | ||
arguments.add_argument('--model', | ||
default='ykush3', | ||
help='The ykush board type.') | ||
arguments.add_argument('--serial', | ||
help='A serial number of the board to send the command to.') | ||
arguments.add_argument('--command', | ||
help='Simple pass through of arguments to ') | ||
|
||
def on_construct_command(self, arguments: nanaimo.Namespace, inout_artifacts: nanaimo.Artifacts) -> str: | ||
serial_arg = self.get_arg_covariant(arguments, 'serial') | ||
serial = ('' if serial_arg is None else ' -s ' + serial_arg) | ||
return '{ykush_cmd} {board}{serial} {command}'.format( | ||
ykush_cmd=self.ykush_cmd, | ||
board=self.get_arg_covariant(arguments, 'model', ''), | ||
serial=serial, | ||
command=self.get_arg_covariant(arguments, 'command') | ||
) | ||
|
||
|
||
@nanaimo.fixtures.PluggyFixtureManager.type_factory | ||
def get_fixture_type() -> typing.Type['Fixture']: | ||
return Fixture | ||
|
||
|
||
@pytest.fixture | ||
def nanaimo_instr_ykush(request: typing.Any) -> nanaimo.fixtures.Fixture: | ||
""" | ||
Provides a :class:`nanaimo.instruments.ykush.Fixture` fixture to a pytest. | ||
This fixture controls a `YKUSH <https://www.yepkit.com/products/ykush>`_ | ||
family board attached to the system via USB. | ||
:param pytest_request: The request object passed into the pytest fixture factory. | ||
:type pytest_request: _pytest.fixtures.FixtureRequest | ||
:return: A fixture providing control of a YKUSH usb hub. | ||
:rtype: nanaimo.instruments.ykush.Fixture | ||
""" | ||
return nanaimo.pytest.plugin.create_pytest_fixture(request, Fixture.get_canonical_name()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,6 @@ | |
# nanaimo (@&&&&####@@* | ||
# | ||
|
||
__version__ = '0.0.51' | ||
__version__ = '0.0.52' | ||
|
||
__license__ = 'MIT' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# This software is distributed under the terms of the MIT License. | ||
# | ||
|
||
import nanaimo | ||
import nanaimo.fixtures | ||
|
||
|
||
def test_ykush_exists(nanaimo_instr_ykush: nanaimo.fixtures.Fixture) -> None: | ||
""" | ||
Just making sure the fixture exists. | ||
""" | ||
assert nanaimo_instr_ykush.get_canonical_name() is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters