aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/chardet/py3/patches/01-fix-tests.patch
blob: 5c3f808bdf8949b203ea200c1af6f8fcb5d75ae7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- contrib/python/chardet/py3/test.py	(index)
+++ contrib/python/chardet/py3/test.py	(working tree)
@@ -45,7 +45,8 @@ EXPECTED_FAILURES = {
 
 def gen_test_params():
     """Yields tuples of paths and encodings to use for test_encoding_detection"""
-    base_path = relpath(join(dirname(realpath(__file__)), "tests"))
+    import yatest.common
+    base_path = yatest.common.work_path('test_data/tests')
     for encoding in listdir(base_path):
         path = join(base_path, encoding)
         # Skip files in tests directory
@@ -68,8 +69,11 @@ def gen_test_params():
                 continue
             full_path = join(path, file_name)
             test_case = full_path, encoding
-            if full_path in EXPECTED_FAILURES:
-                test_case = pytest.param(*test_case, marks=pytest.mark.xfail)
+            name_test = full_path.split("/test_data/")[-1]
+            if name_test in EXPECTED_FAILURES:
+                test_case = pytest.param(*test_case, marks=pytest.mark.xfail, id=name_test)
+            else:
+                test_case = pytest.param(*test_case, id=name_test)
             yield test_case