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.
Loading
Please register or sign in to comment