Add specialized function to declare pytest tests
This MR adds a new function to declare pytest
tests: gaudi_add_pytest
. Test files discovered by pytest
are map to one ctest
test each, so that the can be run in parallel.
The new function is also more flexible than the gaudi_add_tests(PYTEST)
, as it allows to tune the options pased to pytest
.
The list of tests is collected when ctest
is invoked, instead of at configuration time (as we currently do for .qmt
), so the detection of changes in the list of tests does not require a re-configure. To avoid pointless costly invocations of pytest
, test files are hashed and pytest
is invoked again only if a change is detected. A number of special targets is also added to be able to collect the tests (if needed) during build, before the first invocation of ctest
.
This is an alternative approach to what is proposed in !1430 (closed), in particular addressing my comment.
The use of a new CMake function instead of changing the implementation of gaudi_add_tests
makes the new approach an opt-in feature and it simplifies addressing !1430 (comment 6460134).
/cc @mimazure