Page MenuHomePhabricator

tools_tests.OpenArchiveTestCase.test_open_archive_7z fails
Open, Needs TriagePublic

Description

user@pc:~/python/core/tests {master}$ py27 -m unittest tools_tests.OpenArchiveTestCase.test_open_archive_7z
tests: max_retries reduced from 25 to 1
E
======================================================================
ERROR: test_open_archive_7z (tools_tests.OpenArchiveTestCase)
Test open_archive with 7za if installed.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tools_tests.py", line 159, in test_open_archive_7z
    self.assertEqual(self._get_content(self.base_file + '.7z'), self.original_content)
  File "tools_tests.py", line 107, in _get_content
    with tools.open_archive(*args, **kwargs) as f:
  File "/home/user/python/core/pywikibot/tools/__init__.py", line 1102, in open_archive
    'Unexpected STDERR output from 7za {0}'.format(stderr))
OSError: Unexpected STDERR output from 7za 
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)

Processing archive: /home/user/python/core/tests/data/xml/article-pyrus.xml.7z

Extracting  article-pyrus.xml

Everything is Ok

Size:       3871
Compressed: 1184


----------------------------------------------------------------------
Ran 1 test in 0.016s

FAILED (errors=1)

stderr has data even when succesful.

Event Timeline

OK, found this: https://gerrit.wikimedia.org/r/#/c/301771/, which anyhow it does not solve my issue of having an old version.

Anyhow, I think stderr = process.stderr.read() in tools/__init__.py is going to block for large files.

else:
    stderr = process.stderr.read()
    process.stderr.close()
    if stderr != b'':
        process.stdout.close()
        raise OSError(
            'Unexpected STDERR output from 7za {0}'.format(stderr))