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

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 16 20:21:53 UTC 2020


On 16/03/2020 21:01, Sebastian Huber wrote:

> On 16/03/2020 20:26, Amar Takhar wrote:
>
>> I should have also added some of my own reasons why pytest is better 
>> for writing
>> tests in Python:
>>
>>    - Fantastic exception handling makes it far easier to debug test 
>> and code.
>>      PDB works seamlessly.
>>    - Far less overhead in creating initial tests.
>>    - Trivial fixture support
>>    - Paramaterised tests -- this is incredibly essential / useful.
>>
>> Another feature that's not often mentioned is pytest discovers tests 
>> all on its
>> own.  You can put a test anywhere labled test_*.py and it will work.  
>> You can
>> run pytest anywhere in the source as well.
>>
>> The above are starkly different from unittest where these features 
>> don't exist
>> or are difficult / have a large overhead to implement.
>
> Ok, I guess I have to adjust my draft of the Python guidelines:
>
> https://lists.rtems.org/pipermail/devel/2020-March/058289.html

I converted an example test from unittest to pytest:

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.

Chris, what do you think about using pytest in favour of the standard 
Python unitttest?



More information about the devel mailing list