Skip to content

tests/periph_i2c: Example i2c test using pytest#10448

Closed
MrKevinWeiss wants to merge 3 commits intoRIOT-OS:masterfrom
MrKevinWeiss:info/show/i2c/pytest/example
Closed

tests/periph_i2c: Example i2c test using pytest#10448
MrKevinWeiss wants to merge 3 commits intoRIOT-OS:masterfrom
MrKevinWeiss:info/show/i2c/pytest/example

Conversation

@MrKevinWeiss
Copy link
Contributor

Contribution description

PLEASE DO NOT MERGE, EXAMPLE ONLY, RFC

This provides a similar i2c test and result to the Robot Framework i2c testing PR #10147. I hope it shows some of the benefits and pitfalls of using pytest compared to robot framework. I am sure it isn't fully implementing the features of pytest as it is a big library with lots to learn, however it does give a glance and what can be achieved with mostly out of the box framework/plugins.

Testing procedure

Install the dependencies
pip3 install pytest pytest-html riot-pal

Flash PHiLIP firmware on PHiLIP device (usually nucleo-f103rb)

Flash the DUT (device under test) with RIOT firmware
BOARD=<DUT board name> make -C tests/periph_i2c/ flash

Connect sda, scl and reset pin from PHiLIP to the DUT

Run pytest
pytest tests/periph_i2c/tests/ --html=report.html --junitxml=report.xml --philip_port=/dev/ttyACM0 --dut_port=/dev/ttyACM1 --dut_baud=<DUT baudrate, usually 115200> --board=<DUT board name> --self-contained-html

Issues/PRs references

The following PRs discussing testing frameworks:
#10241
RIOT-OS/Release-Specs#86
#10147
#10095

@MrKevinWeiss MrKevinWeiss added Area: tests Area: tests and testing framework Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR labels Nov 21, 2018
@MrKevinWeiss MrKevinWeiss self-assigned this Nov 21, 2018
Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking 😬

@MrKevinWeiss
Copy link
Contributor Author

@smlng smart!

@tcschmidt
Copy link
Member

@MrKevinWeiss can we move a refined version into a comment of issue #10241 and close this PR?

@miri64
Copy link
Member

miri64 commented Nov 21, 2018

@MrKevinWeiss can we move a refined version into a comment of issue #10241 and close this PR?

1600+ lines of code don't belong in a comment. Please leave the PR open so people can actually check out the code.

@tcschmidt
Copy link
Member

@MrKevinWeiss can we move a refined version into a comment of issue #10241 and close this PR?

1600+ lines of code don't belong in a comment. Please leave the PR open so people can actually check out the code.

Well, as you like: The objective is to just see the examples side by side (e.g. as a linked resource) to support an easy comparison. The objective is not to contribute any code.

IMO it is completely irrelevant how to repeat this test here. All is needed is an easy access to input and output so that folks can get a feeling on what to expect from Robot versus Pytest.

@miri64
Copy link
Member

miri64 commented Nov 21, 2018

Well, as you like: The objective is to just see the examples side by side (e.g. as a linked resource) to support an easy comparison. The objective is not to contribute any code.

IMO it is completely irrelevant how to repeat this test here. All is needed is an easy access to input and output so that folks can get a feeling on what to expect from Robot versus Pytest.

As a contributor who isn't just interested in results but also how to implement stuff, I'm very much interested how the tests are implemented, how much needs to be repeated and what is possible with each framework (I'm not sure if you mean that by "input" but then again this is the code contribution here so I am a little confused about your terminology here).

@smlng
Copy link
Member

smlng commented Nov 22, 2018

1600+ lines of code don't belong in a comment. Please leave the PR open so people can actually check out the code.

I assume the point of @tcschmidt was that is not really necessary to open a PR here but rather point to respective branch and link files for comparison in a comment at #10241. For instance, as I did for the comparison of the CoAP tests by @kb2ma in the Release-Specs, see comment.

@jcarrano jcarrano added the State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. label Nov 22, 2018
@RIOT-OS RIOT-OS deleted a comment Nov 23, 2018
@smlng
Copy link
Member

smlng commented Nov 30, 2018

closing: no need to keep this open, it's an example only and all files are linked in the respective issue mentioned above.

@smlng smlng closed this Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: tests Area: tests and testing framework Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants