[Avocado-devel] Implement skip class decorator

Jan Richter jarichte at redhat.com
Fri May 8 09:05:50 UTC 2020

> Yes you are right it is possible to do that, but I think that we can't
> just avoid loading the class, because we have to mark all the test inside
> the class as skipped, and also I don't see the way how to deal with
> constraints in skipIf() and skipUnless() methods when we avoid loading
> class.

On Mon, May 4, 2020 at 3:01 PM Amador Pahim <amador at pahim.org> wrote:

> On Mon, May 4, 2020 at 11:55 AM Jan Richter <jarichte at redhat.com> wrote:
>> Hello everyone,
>> some time ago was added the ability for avocado.skip decorators to be
>> used on classes. This decorator just loop over all the methods of the class
>> and marks them as skip
>> https://github.com/avocado-framework/avocado/pull/3570
>> However, this implementation comes a question if this is enough, so I
>> created this issue.
>> https://github.com/avocado-framework/avocado/issues/3579
>> Because when we want to skip some class, there shouldn't be any code
>> executed at all, no initialization, nothing. I spent some time on that, and
>> I didn't find an efficient way how to do that. So I would like to start a
>> discussion about how it can be done.
>> The problem is that is difficult to use classic python decorators on that
>> because they are called with initialization of test class, but at that time
>> the Loader already loads this test class, and we want to skip that too.
>> One possible way is to use some tag for skipping, which can be parsed from
>> the test file. But there is a lot of problems with parsing, like how we
>> deal with skipIf. Another solution is to use decorators and skip the
>> initialization of test class and then delete it from the Loader. But I
>> think that in practice it will have the same effect as looping over all the
>> methods of the test class.
> Can we avoid loading the class that has the decorator? We are using
> inspect already...
> https://github.com/avocado-framework/avocado/blob/master/avocado/core/loader.py#L289-L294
>> Now I am stuck in the dead-end with this problem, so any comments or
>> suggestion will help me a lot.
>> Best regards,
>> --
>> Jan Richter
>> Intern
>> Red Hat <https://www.redhat.com/>
>> <https://www.redhat.com/>


Jan Richter


Red Hat <https://www.redhat.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/avocado-devel/attachments/20200508/95910776/attachment.htm>

More information about the Avocado-devel mailing list