summaryrefslogtreecommitdiffstats
path: root/library/python/testing/filter
diff options
context:
space:
mode:
Diffstat (limited to 'library/python/testing/filter')
-rw-r--r--library/python/testing/filter/filter.py114
-rw-r--r--library/python/testing/filter/ya.make8
2 files changed, 61 insertions, 61 deletions
diff --git a/library/python/testing/filter/filter.py b/library/python/testing/filter/filter.py
index a1642bd052f..2a6e19388ce 100644
--- a/library/python/testing/filter/filter.py
+++ b/library/python/testing/filter/filter.py
@@ -1,57 +1,57 @@
-# coding: utf-8
-# TODO move devtools/ya/test/filter.py to library/python/testing/filter/filter.py
-import re
-import fnmatch
-import logging
-
-logger = logging.getLogger(__name__)
-TEST_SUBTEST_SEPARATOR = '::'
-
-PARSE_TAG_RE = re.compile("([+-]?[\w:]*)")
-
-
-class FilterException(Exception):
- mute = True
-
-
-def fix_filter(flt):
- if TEST_SUBTEST_SEPARATOR not in flt and "*" not in flt:
- # user wants to filter by test module name
- flt = flt + TEST_SUBTEST_SEPARATOR + "*"
- return flt
-
-
-def escape_for_fnmatch(s):
- return s.replace("[", "[").replace("]", "]")
-
-
-def make_py_file_filter(filter_names):
- if filter_names is not None:
- with_star = []
- wo_star = set()
- for flt in filter_names:
- flt = flt.split(':')[0]
- if '*' in flt:
- with_star.append(flt.split('*')[0] + '*')
- else:
- wo_star.add(flt)
-
- def predicate(filename):
- if filter_names is None:
- return True
- return filename in wo_star or any([fnmatch.fnmatch(escape_for_fnmatch(filename), escape_for_fnmatch(filter_name)) for filter_name in with_star])
-
- return predicate
-
-
-def make_name_filter(filter_names):
- filter_names = map(fix_filter, filter_names)
- filter_full_names = set()
- for name in filter_names:
- if '*' not in name:
- filter_full_names.add(name)
-
- def predicate(testname):
- return testname in filter_full_names or any([fnmatch.fnmatch(escape_for_fnmatch(testname), escape_for_fnmatch(filter_name)) for filter_name in filter_names])
-
- return predicate
+# coding: utf-8
+# TODO move devtools/ya/test/filter.py to library/python/testing/filter/filter.py
+import re
+import fnmatch
+import logging
+
+logger = logging.getLogger(__name__)
+TEST_SUBTEST_SEPARATOR = '::'
+
+PARSE_TAG_RE = re.compile("([+-]?[\w:]*)")
+
+
+class FilterException(Exception):
+ mute = True
+
+
+def fix_filter(flt):
+ if TEST_SUBTEST_SEPARATOR not in flt and "*" not in flt:
+ # user wants to filter by test module name
+ flt = flt + TEST_SUBTEST_SEPARATOR + "*"
+ return flt
+
+
+def escape_for_fnmatch(s):
+ return s.replace("[", "[").replace("]", "]")
+
+
+def make_py_file_filter(filter_names):
+ if filter_names is not None:
+ with_star = []
+ wo_star = set()
+ for flt in filter_names:
+ flt = flt.split(':')[0]
+ if '*' in flt:
+ with_star.append(flt.split('*')[0] + '*')
+ else:
+ wo_star.add(flt)
+
+ def predicate(filename):
+ if filter_names is None:
+ return True
+ return filename in wo_star or any([fnmatch.fnmatch(escape_for_fnmatch(filename), escape_for_fnmatch(filter_name)) for filter_name in with_star])
+
+ return predicate
+
+
+def make_name_filter(filter_names):
+ filter_names = map(fix_filter, filter_names)
+ filter_full_names = set()
+ for name in filter_names:
+ if '*' not in name:
+ filter_full_names.add(name)
+
+ def predicate(testname):
+ return testname in filter_full_names or any([fnmatch.fnmatch(escape_for_fnmatch(testname), escape_for_fnmatch(filter_name)) for filter_name in filter_names])
+
+ return predicate
diff --git a/library/python/testing/filter/ya.make b/library/python/testing/filter/ya.make
index 22c485d2580..a23d1459214 100644
--- a/library/python/testing/filter/ya.make
+++ b/library/python/testing/filter/ya.make
@@ -1,5 +1,5 @@
-PY23_LIBRARY()
+PY23_LIBRARY()
OWNER(g:yatest)
-PY_SRCS(filter.py)
-
-END()
+PY_SRCS(filter.py)
+
+END()