Package: pyetta
pyettapyettais a multi-tool made to simplify device on target testing workflows by
providing some helpers which modularise the process of on target testing. It
provides both a CLI for simple use cases, and a library of components that can
simplify creation of test scripts.The tool can be installed from pip by running the following command.$pipinstallpyettaAssistanceDetailed information including usage and development goals can be found in theofficial documentation.What does it do?pyettatries to bridge the gap between embedded systems development
(targeting microcontrollers) and CI/CD practises and the concept of
continual testing.It does this in 2 approaches:A shipped CLI tool, which enables systems with commonly used frameworks to
avoid having to rewrite testing parsers and converters to get the test
results from the embedded board to their CI/CD pipeline.A library of common tools used within the CLI tool that can assist and
simplify the process of writing integration tests against the system.See the example below, if this sounds like something you have encountered or
are encountering, thenpyettamay be able to help!Sample Use CaseA firmware developer develops an application targeting an STM32
microcontroller. This board performs various actions, including interfacing
with an SPI-based NAND flash storage device. The developer either writes this
driver themselves or they use an existing implementation provided by an external
party. Both of these scenarios needs to be tested.Usingpyetta, the developer may simplify their testing of the interaction
between the microcontroller and the flash chip. Depending on the testing
approach, the functionality can be testing either on-target (with the
microcontroller running the tests) or off-target, with a PC running the test on
the microcontroller.For on-target testing,pyettaCLI tool can assist the process of loading
firmware onto the board, executing the tests, collecting the data for these
tests, and parsing it into a supported and consumable format for the CI/CD
pipeline such as JUnit XML.For off-target testing,pyetta's library of components can assist with
developing fixtures via the off-target unit test library (pytest for example).Project StructureThe project is structured as follows.root
|---.github: Github specific CI/CD actions
|---docs: Documentation for this project
|---examples: Examples relating to plugin development.
|---pyetta: Project sources
|---test: Test directory for project.Project EnvironmentThe project python dependencies can be obtained by using pip to install them.
Ensure the[dev]extras is installed in order to perform common developer
actions such as testing or building docs or running tests.DependenciesThe command below will install all the dependencies and the project itself into
the standard python locations for your platform.$pipinstall.[dev]If only the dependencies are needed, you can subsequently callpip uninstallto remove the top level pyetta package.$pipuninstall--yespyettaLinting, Tests and CoverageTests for this project usetoxto orchestrate all testing items and is used
for preparing a branch for submission. As such, it is the recommended way to do
preliminary testing on the development machine as well.The command below runs tox on the developer's python version, as well as
building the documentation. You can specify the standardtox environmentsfor testing specific python versions.$tox-pCoverage can be generated by first combining all the coverage files, then
creating the relevant reports.$coveragecombine
$coveragehtmlIf you do not wish to usetox, the individual actions supported fromtox. inican be inspected and run manually. Some common manual steps are shown
below for reference.Linting and AnalysisLinting and static analysis is done usingflake8. The command below can be
used to run the linter.$flake8--show-sourceDocumentationDocumentation for this project is located in thedocsfolder and is built bysphinx.$sphinx-builddocsdist/docsRunning the command above will generate the documentation for this project and
save it to a folderdist/docs.PackagingPacking is done using python's build command. The command below will build the
package for deployment to a python package repository.$python-mbuildDebuggingA note on debugging pyetta built-in plugins. The built-in plugins can be
auto-loaded if  the pyetta package is installed and the entrypoint metadata is
available to the system. To circumvent this, builtin commands can be injected in
via the--extrasflag if they are needed during development.