| Summary: | Исправление ошибок тестов zstd для patool | ||
|---|---|---|---|
| Product: | [Сторонние программы (Other programs)] Прочее | Reporter: | Павел Солдатов <soldatoff> |
| Component: | Общее | Assignee: | Павел Солдатов <soldatoff> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P4 | ||
| Version: | не указана | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| URL: | https://github.com/vitlav/patool/tree/implement-zstd | ||
| Whiteboard: | |||
| Заявки RT: | Связано с: | ||
| Дата напоминания: | |||
|
Description
Павел Солдатов
2021-03-29 19:00:13 MSK
Скопировал репозиторий, перешёл в ветку implement-ztd для работы.
запускаю конкретный тест zstd
$ py.test3 tests/archives/test_zstd.py
====test session starts====
platform linux -- Python 3.7.4, pytest-3.10.1, py-1.8.0, pluggy-0.11.0
rootdir: /srv/soldatoff/Projects/patool, inifile:
collected 2 items
tests/archives/test_zstd.py FF
_ TestZStd.test_zstd _
args = (<tests.archives.test_zstd.TestZStd testMethod=test_zstd>,), kwargs = {}
def newfunc(*args, **kwargs):
if not testfunc(name):
pytest.skip("%s %r is not available" % (description, name))
> return func(*args, **kwargs)
tests/__init__.py:42:
_ _
tests/archives/test_zstd.py:27: in test_zstd
self.archive_commands('t.txt.zst', check=Content.Singlefile)
tests/archives/__init__.py:56: in archive_commands
self.archive_list(filename)
tests/archives/__init__.py:120: in archive_list
patoolib.list_archive(archive, program=self.program, verbosity=verbosity, interactive=False)
patoolib/__init__.py:697: in list_archive
util.check_existing_filename(archive)
filename = '/srv/soldatoff/Projects/patool/tests/data/t.txt.zst', onlyfiles = True
def check_existing_filename (filename, onlyfiles=True):
"""Ensure that given filename is a valid, existing file."""
if not os.path.exists(filename):
> raise PatoolError("file `%s' was not found" % filename)
E patoolib.util.PatoolError: file `/srv/soldatoff/Projects/patool/tests/data/t.txt.zst' was not found
patoolib/util.py:408: PatoolError
tests/archives/test_zstd.py .F
_ TestZStd.test_zstd_file _
args = (<tests.archives.test_zstd.TestZStd testMethod=test_zstd_file>,), kwargs = {}
def newfunc(*args, **kwargs):
if not testfunc(name):
pytest.skip("%s %r is not available" % (description, name))
> return func(*args, **kwargs)
tests/__init__.py:42:
_ _
tests/__init__.py:42: in newfunc
return func(*args, **kwargs)
tests/archives/test_zstd.py:32: in test_zstd_file
self.archive_commands('t.txt.zst.foo', skip_create=True, check=None)
tests/archives/__init__.py:56: in archive_commands
self.archive_list(filename)
tests/archives/__init__.py:120: in archive_list
patoolib.list_archive(archive, program=self.program, verbosity=verbosity, interactive=False)
patoolib/__init__.py:697: in list_archive
util.check_existing_filename(archive)
_ _
filename = '/srv/soldatoff/Projects/patool/tests/data/t.txt.zst.foo', onlyfiles = True
def check_existing_filename (filename, onlyfiles=True):
"""Ensure that given filename is a valid, existing file."""
if not os.path.exists(filename):
> raise PatoolError("file `%s' was not found" % filename)
E patoolib.util.PatoolError: file `/srv/soldatoff/Projects/patool/tests/data/t.txt.zst.foo' was not found
patoolib/util.py:408: PatoolError
Про _ TestZStd.test_zstd _ в коде нашел, что проверкой всего является "ответ на главный вопрос жизни, вселенной и всего такого" - 42, который вписан в txt файл, который потом преображался. тест не мог найти t.txt.zst, создал его в папке patool/test/data
$ zstd t.txt -o t.txt.zst
После чего первый тест успешно завершался
$ py.test3 tests/archives/test_zstd.py
tests/archives/test_zstd.py .F
Второй тест ищет t.txt.zst.foo
Проблема с тестом TestZStd.test_zstd_file. Не может "узнать" архив с .foo на конце. во всех тестах 5 аналогичных проблем с архивами.foo Причина в: patool/patoolib/__int__.py 310: patoolib.util.PatoolError: unknown archive format for file `data/t.txt.zst.foo' проверяет есть ли в 234 patool/patoolib/util.py , который берет информацию из 278 patool/patoolib/util.py из os.path.splitext(filename) Причину пока не могу понять. Проверил путь tar.foo Проблем не возникло. Будем разбираться Исправил zstd test Залил новую версию patool на гитлаб https://gitlab.eterfund.ru/Soldatov/patool-etersoft patoolib/__int__.py @@ -83,3 +83,3 @@ ArchiveMimetypes = { 'application/x-zip-compressed': 'zip', - 'application/zstd': 'zstd', + 'application/x-zstd': 'zstd', 'application/x-zoo': 'zoo', patoolib/util.py @@ -254,3 +254,3 @@ Encoding2Mime = { 'xz': "application/x-xz", - 'zstd': "application/zstd", + 'zstd': "application/x-zstd", } @@ -260,3 +260,3 @@ Mime2Encoding['application/x-gzip'] = 'gzip' # file --mime returns ZStandard incorrect MIME type application/x-zstd (https://bugs.astron.com/view.php?id=103) -Mime2Encoding['application/x-zstd'] = 'zstd' +#Mime2Encoding['application/x-zstd'] = 'zstd' test/archives/test_zstd.py @@ -30,4 +30,5 @@ class TestZStd (ArchiveTest): self.archive_commands('t.txt.zst.foo', skip_create=True, check=None) - self.archive_test('t.txt.zst.foo') self.archive_extract('t.txt.zst.foo', check=Content.Singlefile) + self.archive_test('t.txt.zst.foo') added 2 files test/data/ t.txt.zst & t.txt.zst.foo Задача решена. Закрываю. Закрываю. |