Skip to content
Commit 8270ff03 authored by Douglas RAILLARD's avatar Douglas RAILLARD
Browse files

lisa.tests.base: Allow test pre-filtering with another test

Test methods can be pre-filtered using another test. If the decorating
test does not pass, the ResultBundle.result will be set to
Result.UNDECIDED.

    class Foo(TestBundle):
	def test_foo(self, xxx=42, ...) -> ResultBundle:
	   ...

    class Bar(Foo):
	@Foo.test_foo.undecided_filter
	def test_bar(self, yyy=43, ...) -> ResultBundle:
	   ...

The resulting decorated method can take the union of keyword parameters:

    bar = Bar()
    bar.test_bar(xxx=33, yyy=55)
    # Same as
    bar.test_bar(33, yyy=55)
    # But this fails, since only keyword arguments can be passed to the
    # wrapping pre-test
    bar.test_bar(33, 55)

If there is a parameter conflict, it is detected at import time and will
result in a TypeError.

Note that even if the pre-test does not succeed, the wrapped test is
still executed, so that the ResultBundle metrics are updated and the
artifacts still produced. This can be important in order to manually
analyse results in case the pre-filter was overly conservative and
marked a usable result as UNDECIDED.
parent 802880f8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment