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

Amar Takhar amar at rtems.org
Tue Mar 17 18:05:14 UTC 2020


On 2020-03-17 15:20 +0100, Sebastian Huber wrote:
> 
> Ok, what would be a recommendation for the guidelines? Something like this:
> 
> Place tests for a module in a directory. Use individual test files for tests
> related to a particular class or functionality, e.g. module/test_xyz.py.
> 
> OR
> 
> Use individual test files for tests related to a particular class or
> functionality. Include the module name in the test file names, e.g.
> test_module_xyz.py.

The last one .. however the first does apply if we're going to have 1,000 test 
files.  I'd only use subdirs if it will be difficult to manage which is fairly 
rare.

It's nice to be able to 'ls -1' and get an overview of your entire module / 
class / support list in the file names.  It also makes it easy to relate back to 
the actual python file that is being tested.

For example:

mymodule.py -> tests/test_mymodule.py

mymodule.py:class First -> tests/test_mymodule_first.py
mymodule.py:class Second -> tests/test_mymodule_second.py
mymodule.py:class Third -> tests/test_mymodule_third.py

You can also do:

file_handler.py -> tests/test_file_handler_input.py
file_handler.py -> tests/test_file_handler_output.py

The 2nd is an example of grouping similar tests but doesn't necessarily reflect 
any classes in file_handler.py

When you really need to change your testing methodology it should really go into 
a different file.


Amar.


More information about the devel mailing list