Skip to content

Commit

Permalink
feat: make DuT DT-aux capable (#77)
Browse files Browse the repository at this point in the history
feat: add FlasherExample connector (only for testing purpose)
refactor : DUT auxiliary robot version is fully using pykiso interface (TestEntity class usage remove)
refactor : refactor DUT auxiliary implementation
refactor : remove unnecessary example_test_auxiliary (duplicate code)
refactor : remove unnecessary code from test_message_handler module
test: adapt DUT auxiliary pytest (Robot version too)
refactor: remove the usage of the none existing example_test_auxiliary in virtual example
refactor: add deprecated warning message
refactor: remove AuxiliaryInterface class from coverage
  • Loading branch information
BKaDamien authored Jul 4, 2022
1 parent f5cd266 commit 3d7b683
Show file tree
Hide file tree
Showing 32 changed files with 1,058 additions and 1,211 deletions.
4 changes: 4 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ PyVISA-py 0.5.2

* License: MIT

tabulate 0.8.10

* License: MIT

## Cryptography

Content may contain encryption software. The country in which you are currently
Expand Down
3 changes: 0 additions & 3 deletions docs/auxiliaries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ Included Auxiliaries
.. automodule:: pykiso.lib.auxiliaries.communication_auxiliary
:members:

.. automodule:: pykiso.lib.auxiliaries.example_test_auxiliary
:members:

.. automodule:: pykiso.lib.auxiliaries.simulated_auxiliary
:members:

Expand Down
5 changes: 0 additions & 5 deletions docs/auxiliaries/example_test_auxiliary.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/auxiliaries/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Included Auxiliaries
acroname_auxiliary
communication_auxiliary
dut_auxiliary
example_test_auxiliary
instrument_control_auxiliary
mp_proxy_auxiliary
proxy_auxiliary
Expand Down
5 changes: 5 additions & 0 deletions docs/connectors/Flashers/flash_example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cc_flasher_example
==================

.. automodule:: pykiso.lib.connectors.cc_flasher_example
:members:
1 change: 1 addition & 0 deletions docs/connectors/Flashers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Flashers

flash_jlink
flash_lauterbach
flash_example
8 changes: 7 additions & 1 deletion docs/whats_new/version_ongoing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ and one for the reception.
Proxy Auxiliary adaption
^^^^^^^^^^^^^^^^^^^^^^^^
refactor code of the proxy auxiliary to fit with the brand new double threaded
auxiliary interface
auxiliary interface.
Add useful decorators for common behaviors open_connector, close_connector, flash_target.

CCProxy channel adaption
^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -29,3 +30,8 @@ Communication Auxiliary adaption
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
refactor code of the communication auxiliary to fit with the brand new double
threaded auxiliary interface

DUT Auxiliary adaption
^^^^^^^^^^^^^^^^^^^^^^
refactor/redesign of the device under test auxiliary to fit with the brand new double
threaded auxiliary interface
14 changes: 7 additions & 7 deletions examples/conf_access.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ auxiliaries:
connectors:
com: chan1
config: null
type: ext_lib/example_test_auxiliary.py:ExampleAuxiliary
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
aux2:
connectors:
com: chan2
flash: chan3
type: pykiso.lib.auxiliaries.example_test_auxiliary:ExampleAuxiliary
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
aux3:
connectors:
com: chan4
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
connectors:
chan1:
config: null
config:
param_1: "value 1"
param_2: 2000
type: ext_lib/cc_example.py:CCExample
chan2:
type: ext_lib/cc_example.py:CCExample
chan4:
type: ext_lib/cc_example.py:CCExample
chan3:
config:
param_1: "value 1"
param_2: 2000
type: ext_lib/cc_example.py:CCExample
config: ~
type: pykiso.lib.connectors.cc_flasher_example:FlasherExample
test_suite_list:
- suite_dir: conf_access
test_filter_pattern: '*.py'
Expand Down
10 changes: 5 additions & 5 deletions examples/conf_access/test_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def test_run(self):
logging.info("Auxiliary aux2 has a flasher")

# just make a simple assertion in order to raise an error and
# stop test execution if a specific value is not given to chan3
# stop test execution if a specific value is not given to chan1
# connector
self.assertEqual(yaml_config.connectors.chan3.config.param_1, "value 1")
self.assertEqual(yaml_config.connectors.chan1.config.param_1, "value 1")

def tearDown(self):
"""Just print aux2 configuration and it related connector too."""
Expand All @@ -82,10 +82,10 @@ def tearDown(self):

logging.info("*** print associated connector configuration ***")
logging.info(
f"flasher chan3 param 1: {yaml_config.connectors.chan3.config.param_1}"
f"channel chan1 param 1: {yaml_config.connectors.chan1.config.param_1}"
)
logging.info(
f"flasher chan3 param 2: {yaml_config.connectors.chan3.config.param_2}"
f"channel chan1 param 2: {yaml_config.connectors.chan1.config.param_2}"
)
logging.info(f"flasher chan3 type: {yaml_config.connectors.chan3.type}")
logging.info(f"channel chan1 type: {yaml_config.connectors.chan1.type}")
logging.info(f"connector chan2 type: {yaml_config.connectors.chan2.type}")
11 changes: 5 additions & 6 deletions examples/dummy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ auxiliaries:
connectors:
com: chan1
config: null
type: ext_lib/example_test_auxiliary.py:ExampleAuxiliary
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
aux2:
connectors:
com: chan2
flash: chan3
type: pykiso.lib.auxiliaries.example_test_auxiliary:ExampleAuxiliary
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
aux3:
connectors:
com: chan4
flash: chan3
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
connectors:
chan1:
Expand All @@ -22,9 +22,8 @@ connectors:
chan4:
type: ext_lib/cc_example.py:CCExample
chan3:
config:
configKey: "config value"
type: ext_lib/cc_example.py:CCExample
config: null
type: pykiso.lib.connectors.cc_flasher_example:FlasherExample
test_suite_list:
- suite_dir: test_suite_1
test_filter_pattern: '*.py'
Expand Down
13 changes: 6 additions & 7 deletions examples/dummy_env_var.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ auxiliaries:
connectors:
com: chan1
config: null
type: ext_lib/example_test_auxiliary.py:ExampleAuxiliary
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
aux2:
connectors:
com: chan2
flash: chan3
type: pykiso.lib.auxiliaries.example_test_auxiliary:ExampleAuxiliary
com: chan2
flash: chan3
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
connectors:
chan1:
config: null
type: ext_lib/cc_example.py:CCExample
chan2:
type: ext_lib/cc_example.py:CCExample
chan3:
config:
configKey: "config value"
type: ext_lib/cc_example.py:CCExample
config: null
type: pykiso.lib.connectors.cc_flasher_example:FlasherExample
test_suite_list:
- suite_dir: ENV{TEST_SUITE_1}
test_filter_pattern: '*.py'
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/suite_dut/test_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_run(self):
test_case=self.test_case_id,
)

state = aux1.run_command(awesome_message, blocking=True, timeout_in_s=10)
state = aux1.send_fixture_command(awesome_message, timeout=10)

self.assertEqual(state, True)

Expand Down
27 changes: 4 additions & 23 deletions examples/test_suite_1/test_suite_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@


@pykiso.define_test_parameters(suite_id=1, aux_list=[aux1, aux2])
class SuiteSetup(pykiso.BasicTestSuiteSetup):
class SuiteSetup(pykiso.RemoteTestSuiteSetup):
"""This test suite setup will be executed using base behavior
given by BasicTestSuiteSetup.
given by RemoteTestSuiteSetup.
Using decorator define_test_parameters the following parameters will
Expand All @@ -41,24 +41,13 @@ class SuiteSetup(pykiso.BasicTestSuiteSetup):
-> suite_id : set to 1
-> aux_list : test suite setup executed using aux1 and aux2 (see
yaml configuration file)
-> setup_timeout : ITF will wait 2 seconds (maximum) to receive a
report from device under test otherwise an abort command is sent.
If setup_timeout is not given the default timeout value is 10
seconds.
"""

module = importlib.import_module("pykiso.auxiliaries")
attribute = dir(module)
logging.error(f"this is the attribute of pykiso.auxiliaries: {attribute}")

pass


@pykiso.define_test_parameters(suite_id=1, aux_list=[aux1, aux2])
class SuiteTearDown(pykiso.BasicTestSuiteTeardown):
class SuiteTearDown(pykiso.RemoteTestSuiteTeardown):
"""This test suite teardown will be executed using base behavior
given by RemoteTestSuiteTeardown.
given by RemoteTestSuiteSetup.
Using decorator define_test_parameters the following parameters will
be applied on test suite teardown :
Expand All @@ -68,8 +57,6 @@ class SuiteTearDown(pykiso.BasicTestSuiteTeardown):
yaml configuration file)
"""

pass


@pykiso.define_test_parameters(
suite_id=1,
Expand Down Expand Up @@ -172,10 +159,6 @@ def test_run(self):
This test will be run 3 times in order to test stability (setUp
and tearDown excluded as the flags are set to False).
"""
module = importlib.import_module("pykiso.auxiliaries")
attribute = dir(module)
logging.error(f"this is the attribute of pykiso.auxiliaries: {attribute}")

logging.info(f"------------suspend auxiliaries run-------------")
aux3.suspend()
aux2.suspend()
Expand Down Expand Up @@ -218,5 +201,3 @@ class MyTest3(pykiso.RemoteTest):
If setup_timeout, run_timeout and teardown_timeout are not given the
default timeout value is 10 seconds for each.
"""

pass
20 changes: 6 additions & 14 deletions examples/test_suite_2/test_suite_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from pykiso.auxiliaries import aux1, aux2


@pykiso.define_test_parameters(suite_id=2, case_id=0, aux_list=[aux1, aux2])
class SuiteSetup(pykiso.BasicTestSuiteSetup):
@pykiso.define_test_parameters(suite_id=2, aux_list=[aux1, aux2])
class SuiteSetup(pykiso.RemoteTestSuiteSetup):
"""This test suite setup will be executed using base behavior given
by BasicTestSuiteTeardown.
Expand All @@ -39,11 +39,9 @@ class SuiteSetup(pykiso.BasicTestSuiteSetup):
yaml configuration file)
"""

pass


@pykiso.define_test_parameters(suite_id=2, case_id=0, aux_list=[aux1, aux2])
class SuiteTearDown(pykiso.BasicTestSuiteTeardown):
@pykiso.define_test_parameters(suite_id=2, aux_list=[aux1, aux2])
class SuiteTearDown(pykiso.RemoteTestSuiteTeardown):
"""This test suite teardown will be executed using base behavior
given by BasicTestSuiteTeardown.
Expand All @@ -58,16 +56,14 @@ class SuiteTearDown(pykiso.BasicTestSuiteTeardown):
yaml configuration file)
"""

pass


@pykiso.define_test_parameters(
suite_id=2,
case_id=1,
aux_list=[aux1],
tag={"variant": ["variant3", "variant2"], "branch_level": ["daily"]},
)
class MyTest4(pykiso.BasicTest):
class MyTest4(pykiso.RemoteTest):
"""This test case definition will be executed using base behavior
given by BasicTest.
Expand All @@ -82,11 +78,9 @@ class MyTest4(pykiso.BasicTest):
-> tag: [optional] allows the run of subset of tests
"""

pass


@pykiso.define_test_parameters(suite_id=2, case_id=2, aux_list=[aux2])
class MyTest2(pykiso.BasicTest):
class MyTest5(pykiso.RemoteTest):
"""This test case definition will be executed using base behavior
given by BasicTest.
Expand All @@ -98,5 +92,3 @@ class MyTest2(pykiso.BasicTest):
-> aux_list : test case executed using aux2(see yaml
configuration file)
"""

pass
2 changes: 1 addition & 1 deletion examples/virtual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ auxiliaries:
connectors:
com: chan1
config: null
type: pykiso.lib.auxiliaries.example_test_auxiliary:ExampleAuxiliary
type: pykiso.lib.auxiliaries.dut_auxiliary:DUTAuxiliary
connectors:
chan1:
config: {dest_ip : '127.0.0.1', dest_port: 5005}
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ omit = [
"*/tasks.py",
"*/src/pykiso/tool/*",
"*/src/pykiso/__main__.py",
"*/src/pykiso/interfaces/thread_auxiliary.py",
"*__init__.py",
]

Expand Down
Loading

0 comments on commit 3d7b683

Please sign in to comment.