A couple of functions were implemented to automate the unit test if the module follows the same design as pyquickhelper:
The unit tests must be in
There are only one level of subfolders inside this folder, all names are prefixed by
Tests files starts with
Unit test must inherits from :py:`unittest:TestCase` or :py:class:`ExtTestCase <pyquickhelper.pycode.unittestclass.ExtTestCase>` which adds a couple of *assert methods.
One function is used to prints information but is disabled
when running the whole list of unit tests:
Another function is often used to create a temporary folder
relative to the test file:
The option is prefered because it lets temporary data available
close to the code. It is easier to check if something went wrong.
Plus temporary files or folder are not always fully cleaned by the
operating system. A limit is sometimes reached and produces
an error difficult to interpret if the developer is not aware
of that limit.
Some behavior might change on continuous integration.
returns the continuous integration system used.
Finally, testing notebooks is important when there are many
and that’s an important part of teachings.
The following function
tests a notebooks assuming it is in folder
It also keeps track of the number of executed cells and reports
on the coverage.