build-system: add capability to execute scripts with custom executor #18770
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
I sometimes find it more convenient to use
pytest
to execute and debug my more complex tests (it shows output in order of test execution, in color, you can filter tests and has flags to step in withpdb
, ...). However, for that I either need to define all the RIOT environment in my shell, or touchmakefile/tests/tests.mk
to execute the test withpytest
. Since I do not want to enforcepytest
on everyone and the CI, this amends that file with two optional macrosTEST_EXECUTOR
andTEST_EXECUTOR_FLAGS
, so the executor for the tests can be selected from the environment.Testing procedure
Sadly, not all tests are able to be run this way: when the
test...
function has an argument,pytest
thinks that argument is a fixture and gets confused (another reason why I madepytest
optional). However, all tests that are based on unittest classes (so eitherunittests.TestCase
ortestrunner.unittest.PexpectTestCase
(e.g.tests/turo
can now be executed this way):Of course, the normal approach should also still work:
Issues/PRs references
None, but got the idea while debugging #18769.