aboutcode-org / aboutcode-org/extractcode

Various tests failures on Python 3.12.0rc1

Offen
#53 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
39
Forks
23
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Environment:
- Python 3.12.0rc1
- Fedora Rawhide
- libmagic 5.45
- libarchive 3.7.1
- p7zip 16.02

Summary
```
FAILED tests/test_archive.py::TestGetExtractorTest::test_get_extractor_qcow2
FAILED tests/test_archive.py::TestRar::test_extract_rar_with_trailing_data - ...
FAILED tests/test_extractcode_cli.py::test_extractcode_command_can_take_an_empty_directory
FAILED tests/test_extractcode_cli.py::test_extractcode_command_does_extract_verbose
FAILED tests/test_extractcode_cli.py::test_extractcode_command_always_shows_something_if_not_using_a_tty_verbose_or_not
FAILED tests/test_extractcode_cli.py::test_extractcode_command_works_with_relative_paths
FAILED tests/test_extractcode_cli.py::test_extractcode_command_works_with_relative_paths_verbose
FAILED tests/test_extractcode_cli.py::test_usage_and_help_return_a_correct_script_name_on_all_platforms
FAILED tests/test_extractcode_cli.py::test_extractcode_command_can_extract_archive_with_unicode_names_verbose
FAILED tests/test_extractcode_cli.py::test_extractcode_command_can_extract_archive_with_unicode_names
FAILED tests/test_extractcode_cli.py::test_extractcode_command_can_extract_shallow
FAILED tests/test_extractcode_cli.py::test_extractcode_command_can_ignore - A...
FAILED tests/test_extractcode_cli.py::test_extractcode_command_does_not_crash_with_replace_originals_and_corrupted_archives
FAILED tests/test_extractcode_cli.py::test_extractcode_command_can_extract_nuget
```

Details:

```
=================================== FAILURES ===================================
________________ TestGetExtractorTest.test_get_extractor_qcow2 _________________

self =

def test_get_extractor_qcow2(self):
test_file = self.extract_test_tar('vmimage/foobar.qcow2.tar.gz')
test_file = str(Path(test_file) / 'foobar.qcow2')

expected = []
self.check_get_extractors(test_file, expected, kinds=extractcode.default_kinds)

expected = [archive.extract_vm_image]
> self.check_get_extractors(test_file, expected, kinds=())

tests/test_archive.py:217:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
test_file = '/tmp/scancode-tk-tests -uejk8_7m/u6e9wzs8/foobar.qcow2.tar.gz/foobar.qcow2'
expected = [], kinds = ()

def check_get_extractors(self, test_file, expected, kinds=()):
from extractcode import archive

test_loc = self.get_test_loc(test_file)
if kinds:
extractors = archive.get_extractors(test_loc, kinds)
else:
extractors = archive.get_extractors(test_loc)

fe = fileutils.file_extension(test_loc).lower()
em = ', '.join(e.__module__ + '.' + e.__name__ for e in extractors)

msg = ('%(expected)r == %(extractors)r for %(test_file)s\n'
'with fe:%(fe)r, em:%(em)s' % locals())
> assert expected == extractors, msg
E AssertionError: [] == [] for /tmp/scancode-tk-tests -uejk8_7m/u6e9wzs8/foobar.qcow2.tar.gz/foobar.qcow2
E with fe:'.qcow2', em:
E assert [] == []
E Left contains one more item:
E Use -v to get more diff

tests/extractcode_assert_utils.py:166: AssertionError
_________________ TestRar.test_extract_rar_with_trailing_data __________________

self =

def test_extract_rar_with_trailing_data(self):
test_file = self.get_test_loc('archive/rar/rar_trailing.rar')
test_dir = self.get_temp_dir()
expected = Exception('Unknown error')
> self.assertRaisesInstance(expected, archive.extract_rar, test_file, test_dir)

tests/test_archive.py:1693:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
excInstance = Exception('Unknown error')
callableObj =
args = ('/builddir/build/BUILD/extractcode-31.0.0/tests/data/archive/rar/rar_trailing.rar', '/tmp/scancode-tk-tests -uejk8_7m/h4a951m9')
kwargs = {}, excClass = , excName = 'Exception'

def assertRaisesInstance(self, excInstance, callableObj, *args, **kwargs):
"""
This assertion accepts an instance instead of a class for refined
exception testing.
"""
kwargs = kwargs or {}
excClass = excInstance.__class__
try:
callableObj(*args, **kwargs)
except excClass as e:
assert str(e).startswith(str(excInstance))
else:
if hasattr(excClass, '__name__'):
excName = excClass.__name__
else:
excName = str(excClass)
> raise self.failureException('%s not raised' % excName)
E AssertionError: Exception not raised

tests/extractcode_assert_utils.py:184: AssertionError
_____________ test_extractcode_command_can_take_an_empty_directory _____________

def test_extractcode_command_can_take_an_empty_directory():
test_dir = test_env.get_temp_dir()
> result = run_extract([test_dir], expected_rc=0)

tests/test_extractcode_cli.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['/tmp/scancode-tk-tests -uejk8_7m/fna7ftnv'], expected_rc = 0
cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
________________ test_extractcode_command_does_extract_verbose _________________

def test_extractcode_command_does_extract_verbose():
test_dir = test_env.get_test_loc('cli/extract', copy=True)
> result = run_extract(['--verbose', test_dir], expected_rc=1)

tests/test_extractcode_cli.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--verbose', '/tmp/scancode-tk-tests -uejk8_7m/bbuw3oy4/extract']
expected_rc = 1, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
_ test_extractcode_command_always_shows_something_if_not_using_a_tty_verbose_or_not _

def test_extractcode_command_always_shows_something_if_not_using_a_tty_verbose_or_not():
test_dir = test_env.get_test_loc('cli/extract/some.tar.gz', copy=True)

> result = run_extract(options=['--verbose', test_dir], expected_rc=0)

tests/test_extractcode_cli.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--verbose', '/tmp/scancode-tk-tests -uejk8_7m/36o7wnm7/some.tar.gz']
expected_rc = 0, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
______________ test_extractcode_command_works_with_relative_paths ______________

def test_extractcode_command_works_with_relative_paths():
# The setup is complex because we want to have a relative dir to the base
# dir where we run tests from, i.e. the git checkout dir To use relative
# paths, we use our tmp dir at the root of the code tree
from os.path import join
from commoncode import fileutils
import extractcode
import tempfile
import shutil

try:
test_file = test_env.get_test_loc('cli/extract_relative_path/basic.zip')

project_tmp = join(project_root, 'tmp')
fileutils.create_dir(project_tmp)
temp_rel = tempfile.mkdtemp(dir=project_tmp)
assert os.path.exists(temp_rel)

relative_dir = temp_rel.replace(project_root, '').strip('\\/')
shutil.copy(test_file, temp_rel)

test_src_file = join(relative_dir, 'basic.zip')
test_tgt_dir = join(project_root, test_src_file) + extractcode.EXTRACT_SUFFIX
> result = run_extract([test_src_file], expected_rc=0, cwd=project_root)

tests/test_extractcode_cli.py:124:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['tmp/tmpiu9t_zt7/basic.zip'], expected_rc = 0
cwd = '/builddir/build/BUILD/extractcode-31.0.0'

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
__________ test_extractcode_command_works_with_relative_paths_verbose __________

def test_extractcode_command_works_with_relative_paths_verbose():
# The setup is a tad complex because we want to have a relative dir
# to the base dir where we run tests from, i.e. the git checkout dir
# To use relative paths, we use our tmp dir at the root of the code tree
from os.path import join
from commoncode import fileutils
import tempfile
import shutil

try:
project_tmp = join(project_root, 'tmp')
fileutils.create_dir(project_tmp)
test_src_dir = tempfile.mkdtemp(dir=project_tmp).replace(project_root, '').strip('\\/')
test_file = test_env.get_test_loc('cli/extract_relative_path/basic.zip')
shutil.copy(test_file, test_src_dir)
test_src_file = join(test_src_dir, 'basic.zip')

> result = run_extract(['--verbose', test_src_file] , expected_rc=0)

tests/test_extractcode_cli.py:158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--verbose', 'tmp/tmpc_z4ga7z/basic.zip'], expected_rc = 0
cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
______ test_usage_and_help_return_a_correct_script_name_on_all_platforms _______

def test_usage_and_help_return_a_correct_script_name_on_all_platforms():
options = ['--help']

> result = run_extract(options , expected_rc=0)

tests/test_extractcode_cli.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--help'], expected_rc = 0, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
___ test_extractcode_command_can_extract_archive_with_unicode_names_verbose ____

def test_extractcode_command_can_extract_archive_with_unicode_names_verbose():
test_dir = test_env.get_test_loc('cli/unicodearch', copy=True)
> result = run_extract(['--verbose', test_dir] , expected_rc=0)

tests/test_extractcode_cli.py:195:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--verbose', '/tmp/scancode-tk-tests -uejk8_7m/2rcvcl3l/unicodearch']
expected_rc = 0, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
_______ test_extractcode_command_can_extract_archive_with_unicode_names ________

def test_extractcode_command_can_extract_archive_with_unicode_names():
test_dir = test_env.get_test_loc('cli/unicodearch', copy=True)
> run_extract([test_dir] , expected_rc=0)

tests/test_extractcode_cli.py:213:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['/tmp/scancode-tk-tests -uejk8_7m/3a9hxexv/unicodearch']
expected_rc = 0, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
_________________ test_extractcode_command_can_extract_shallow _________________

def test_extractcode_command_can_extract_shallow():
test_dir = test_env.get_test_loc('cli/extract_shallow', copy=True)
> run_extract(['--shallow', test_dir] , expected_rc=0)

tests/test_extractcode_cli.py:230:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--shallow', '/tmp/scancode-tk-tests -uejk8_7m/n1bkdpux/extract_shallow']
expected_rc = 0, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
_____________________ test_extractcode_command_can_ignore ______________________

def test_extractcode_command_can_ignore():
test_dir = test_env.get_test_loc('cli/extract_ignore', copy=True)
> run_extract(['--ignore', '*.tar', test_dir] , expected_rc=0)

tests/test_extractcode_cli.py:248:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--ignore', '*.tar', '/tmp/scancode-tk-tests -uejk8_7m/bs_94w2l/extract_ignore']
expected_rc = 0, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
_ test_extractcode_command_does_not_crash_with_replace_originals_and_corrupted_archives _

def test_extractcode_command_does_not_crash_with_replace_originals_and_corrupted_archives():
test_dir = test_env.get_test_loc('cli/replace-originals', copy=True)
> result = run_extract(['--replace-originals', '--verbose', test_dir] , expected_rc=1)

tests/test_extractcode_cli.py:266:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--replace-originals', '--verbose', '/tmp/scancode-tk-tests -uejk8_7m/ldztqpv3/replace-originals']
expected_rc = 1, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
__________________ test_extractcode_command_can_extract_nuget __________________

@pytest.mark.skipif(on_windows, reason='FIXME: this test fails on Windows until we have support for long file names.')
def test_extractcode_command_can_extract_nuget():
test_dir = test_env.get_test_loc('cli/extract_nuget', copy=True)
> result = run_extract(['--verbose', test_dir])

tests/test_extractcode_cli.py:283:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

options = ['--verbose', '/tmp/scancode-tk-tests -uejk8_7m/zcx7geku/extract_nuget']
expected_rc = None, cwd = None

def run_extract(options, expected_rc=None, cwd=None):
"""
Run extractcode as a plain subprocess. Return rc, stdout, stderr.
"""
bin_dir = 'Scripts' if on_windows else 'bin'
# note: this assumes that we are using a standard directory layout as set
# with the configure script
cmd_loc = os.path.join(project_root, 'venv', bin_dir, 'extractcode')
> assert os.path.exists(cmd_loc + ('.exe' if on_windows else ''))
E AssertionError: assert False
E + where False = (('/builddir/build/BUILD/extractcode-31.0.0/venv/bin/extractcode' + ''))
E + where = .exists
E + where = os.path

tests/test_extractcode_cli.py:38: AssertionError
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.