summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/decorator/oetag.py
blob: ad38ab78a54a26a28e66697ce8f1c5f2af21d031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)

from . import OETestFilter, registerDecorator
from oeqa.core.utils.misc import strToList

def _tagFilter(tags, filters):
    return False if set(tags) & set(filters) else True

@registerDecorator
class OETestTag(OETestFilter):
    attrs = ('oetag',)

    def bind(self, registry, case):
        super(OETestTag, self).bind(registry, case)
        self.oetag = strToList(self.oetag, 'oetag')

    def filtrate(self, filters):
        if filters.get('oetag'):
            filterx = strToList(filters['oetag'], 'oetag')
            del filters['oetag']
            if _tagFilter(self.oetag, filterx):
                return True
        return False