-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement ykush auxiliary #225
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
15d8fb7
feat: Implement ykush auxiliary
yannpoupon af4c658
chore: applying suggestions
yannpoupon 24b3a60
chore: applying suggestions
yannpoupon b5d43b8
chore: applying suggestions
yannpoupon 404c295
chore: changing function name
yannpoupon 147f872
chore: removing path from connect_device function
yannpoupon 869199f
Merge branch 'master' into itf-ykush-auxiliary
yannpoupon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ Included Auxiliaries | |
record_auxiliary | ||
simulated_auxiliary | ||
uds_auxiliary | ||
ykush_auxiliary |
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,16 @@ | ||
ykush_auxiliary | ||
=============== | ||
|
||
Example can be found here :ref:`ykush_aux`. | ||
|
||
.. automodule:: pykiso.lib.auxiliaries.ykush_auxiliary | ||
:members: | ||
|
||
.. note:: | ||
This auxiliary has only been tested on the Ykush Device. | ||
|
||
Ykush 3 and Ykush XS have not been tested. | ||
|
||
|
||
A command line to get information about the device or port can be found | ||
on the following link : https://github.com/Yepkit/ykush |
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,28 @@ | ||
.. _ykush_aux: | ||
|
||
Controlling an Yepkit USB hub | ||
=============================== | ||
yannpoupon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The ykush auxiliary offers commands to control an Yepkit usb hub. | ||
Ports can be switched on and off individually. | ||
yannpoupon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
yannpoupon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Usage Examples | ||
~~~~~~~~~~~~~~ | ||
|
||
To use the auxiliary in your test scripts the auxiliary must be properly defined | ||
in the config yaml. Example: | ||
|
||
.. code:: yaml | ||
|
||
auxiliaries: | ||
ykush_aux: | ||
config: | ||
# Serial number to connect to. Example: "YK00006" | ||
serial_number : null # null = auto detection. | ||
type: pykiso.lib.auxiliaries.ykush_auxiliary:YkushAuxiliary | ||
|
||
Below find a example for the usage in a test script. All available methods are shown there. | ||
|
||
.. literalinclude:: ../../examples/test_suite_ykush/test_ykush.py | ||
:language: python |
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,66 @@ | ||
########################################################################## | ||
# Copyright (c) 2010-2022 Robert Bosch GmbH | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Eclipse Public License 2.0 which is available at | ||
# http://www.eclipse.org/legal/epl-2.0. | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
########################################################################## | ||
|
||
""" | ||
Ykush auxiliary test | ||
******************** | ||
|
||
:module: test_ykush | ||
|
||
:synopsis: Example test that shows how to control the Ykush usb. | ||
|
||
.. currentmodule:: test_ykush | ||
|
||
""" | ||
|
||
import logging | ||
|
||
import pykiso | ||
from pykiso.auxiliaries import ykush_aux | ||
|
||
|
||
@pykiso.define_test_parameters(suite_id=1, case_id=1, aux_list=[ykush_aux]) | ||
class ExampleYkushTest(pykiso.BasicTest): | ||
def setUp(self): | ||
"""Hook method from unittest in order to execute code before test case run.""" | ||
logging.info( | ||
f"--------------- SETUP: {self.test_suite_id}, {self.test_case_id} ---------------" | ||
) | ||
|
||
def test_run(self): | ||
logging.info( | ||
f"--------------- RUN: {self.test_suite_id}, {self.test_case_id} ---------------" | ||
) | ||
list_state = ykush_aux.get_all_ports_state_str() | ||
logging.info(f"The state of the ports are :{list_state}") | ||
|
||
logging.info("Power off all ports") | ||
ykush_aux.set_all_ports_off() | ||
|
||
list_state = ykush_aux.get_all_ports_state() | ||
logging.info(f"The state of the ports are :{list_state}") | ||
|
||
logging.info("Power on the port 1") | ||
ykush_aux.set_port_on(port_number=1) | ||
logging.info("Get the state of the port 1") | ||
|
||
state_port_1 = ykush_aux.get_port_state_str(port_number=1) | ||
logging.info(f"Port 1 is {state_port_1}") | ||
|
||
logging.info("Power off the port number 1") | ||
ykush_aux.set_port_off(port_number=1) | ||
|
||
list_state = ykush_aux.get_all_ports_state_str() | ||
logging.info(f"The state of the ports are :{list_state}") | ||
yannpoupon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def tearDown(self): | ||
"""Hook method from unittest in order to execute code after test case run.""" | ||
logging.info( | ||
f"--------------- TEARDOWN: {self.test_suite_id}, {self.test_case_id} ---------------" | ||
) |
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,10 @@ | ||
auxiliaries: | ||
ykush_aux: | ||
config: | ||
# Serial number to connect to. Example: "YK00006" | ||
serial_number : null # null = auto detection. | ||
type: pykiso.lib.auxiliaries.ykush_auxiliary:YkushAuxiliary | ||
test_suite_list: | ||
- suite_dir: test_suite_ykush | ||
test_filter_pattern: '*.py' | ||
test_suite_id: 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done