[PATCH 2/2] Add a message to run 'pytest' to run rest of test suite.

Amar Takhar amar at rtems.org
Mon Mar 16 20:49:56 UTC 2020


On 2020-03-16 21:21 +0100, Sebastian Huber wrote:
> >
> > https://lists.rtems.org/pipermail/devel/2020-March/058289.html
> 
> I converted an example test from unittest to pytest:

There's no reason to use classes here you should use simple functions.

Classes are only useful if you want to maintain a state using a setup or 
teardown.  Look at test_macro.py for an example of this.

You should be using a setup similar to test_host.py which is just simple 
functions it's less work and easier to read.

This is one of the best features of pytest. :)

BTW examples are in my rtemstoolkit patch.


> https://git.rtems.org/sebh/rtems-qual.git/commit/?id=823c74c5d68a5b0913eba2bd9202897cb883dcef
> 
> Using plain assert statements is quite nice. Also the "tmpdir" fixture 
> is really nice.

Yes, pytest  has quite a few fixtures that make life extremely easy.  Also just 
using asserts really saves a lot of time and is easier to develop with.  No need 
to remember dozens of unique functions.


Amar.



More information about the devel mailing list