diff options
| author | maxim-yurchuk <[email protected]> | 2024-10-09 12:29:46 +0300 |
|---|---|---|
| committer | maxim-yurchuk <[email protected]> | 2024-10-09 13:14:22 +0300 |
| commit | 9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch) | |
| tree | a8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/chardet | |
| parent | a44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff) | |
publishFullContrib: true for ydb
<HIDDEN_URL>
commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/chardet')
4 files changed, 87 insertions, 0 deletions
diff --git a/contrib/python/chardet/py2/.yandex_meta/yamaker.yaml b/contrib/python/chardet/py2/.yandex_meta/yamaker.yaml new file mode 100644 index 00000000000..71c27b7b1a8 --- /dev/null +++ b/contrib/python/chardet/py2/.yandex_meta/yamaker.yaml @@ -0,0 +1,2 @@ +exclude: + - tests/* diff --git a/contrib/python/chardet/py2/patches/01-fix-tests.patch b/contrib/python/chardet/py2/patches/01-fix-tests.patch new file mode 100644 index 00000000000..ac2f97cc8d9 --- /dev/null +++ b/contrib/python/chardet/py2/patches/01-fix-tests.patch @@ -0,0 +1,57 @@ +--- contrib/python/chardet/py2/test.py (index) ++++ contrib/python/chardet/py2/test.py (working tree) +@@ -11,7 +11,7 @@ import textwrap + from difflib import ndiff + from io import open + from os import listdir +-from os.path import dirname, isdir, join, realpath, relpath, splitext ++from os.path import dirname, isdir, join, splitext, basename + + try: + import hypothesis.strategies as st +@@ -22,20 +22,21 @@ except ImportError: + import pytest + + import chardet ++import yatest.common + + + # TODO: Restore Hungarian encodings (iso-8859-2 and windows-1250) after we + # retrain model. + MISSING_ENCODINGS = {'iso-8859-2', 'iso-8859-6', 'windows-1250', + 'windows-1254', 'windows-1256'} +-EXPECTED_FAILURES = {'tests/iso-8859-7-greek/disabled.gr.xml', +- 'tests/iso-8859-9-turkish/divxplanet.com.xml', +- 'tests/iso-8859-9-turkish/subtitle.srt', +- 'tests/iso-8859-9-turkish/wikitop_tr_ISO-8859-9.txt'} ++EXPECTED_FAILURES = {'iso-8859-7-greek/disabled.gr.xml', ++ 'iso-8859-9-turkish/divxplanet.com.xml', ++ 'iso-8859-9-turkish/subtitle.srt', ++ 'iso-8859-9-turkish/wikitop_tr_ISO-8859-9.txt'} + + def gen_test_params(): + """Yields tuples of paths and encodings to use for test_encoding_detection""" +- base_path = relpath(join(dirname(realpath(__file__)), 'tests')) ++ base_path = yatest.common.work_path('test_data') + for encoding in listdir(base_path): + path = join(base_path, encoding) + # Skip files in tests directory +@@ -58,12 +59,16 @@ def gen_test_params(): + continue + full_path = join(path, file_name) + test_case = full_path, encoding +- if full_path in EXPECTED_FAILURES: ++ if join(basename(path), file_name) in EXPECTED_FAILURES: + test_case = pytest.param(*test_case, marks=pytest.mark.xfail) + yield test_case + + [email protected] ('file_name, encoding', gen_test_params()) ++def get_test_name(args): ++ return join(basename(dirname(args)), basename(args)) ++ ++ [email protected] ('file_name, encoding', gen_test_params(), ids=get_test_name) + def test_encoding_detection(file_name, encoding): + with open(file_name, 'rb') as f: + input_bytes = f.read() diff --git a/contrib/python/chardet/py3/.yandex_meta/yamaker.yaml b/contrib/python/chardet/py3/.yandex_meta/yamaker.yaml new file mode 100644 index 00000000000..71c27b7b1a8 --- /dev/null +++ b/contrib/python/chardet/py3/.yandex_meta/yamaker.yaml @@ -0,0 +1,2 @@ +exclude: + - tests/* diff --git a/contrib/python/chardet/py3/patches/01-fix-tests.patch b/contrib/python/chardet/py3/patches/01-fix-tests.patch new file mode 100644 index 00000000000..5c3f808bdf8 --- /dev/null +++ b/contrib/python/chardet/py3/patches/01-fix-tests.patch @@ -0,0 +1,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 + + |
