Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

0.4.27: pytest is failing #285

Open
kloczek opened this issue Mar 21, 2023 · 1 comment
Open

0.4.27: pytest is failing #285

kloczek opened this issue Mar 21, 2023 · 1 comment

Comments

@kloczek
Copy link

kloczek commented Mar 21, 2023

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-magic-0.4.27-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-magic-0.4.27-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-magic-0.4.27
collected 20 items

test/libmagic_test.py ...                                                                                                                                                             [ 15%]
test/python_magic_test.py ..F...........ss.                                                                                                                                           [100%]

========================================================================================= FAILURES ==========================================================================================
_________________________________________________________________________________ MagicTest.test_extension __________________________________________________________________________________

self = <test.python_magic_test.MagicTest testMethod=test_extension>

    def test_extension(self):
        try:
            m = magic.Magic(extension=True)
>           self.assert_values(m, {
                # some versions return '' for the extensions of a gz file,
                # including w/ the command line.  Who knows...
                'test.gz': ('gz/tgz/tpz/zabw/svgz', '', '???'),
                'name_use.jpg': 'jpeg/jpg/jpe/jfif',
            })

test/python_magic_test.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/python_magic_test.py:53: in assert_values
    self.assertIn(value, expected_value)
E   AssertionError: 'gz/tgz/tpz/zabw/svgz/adz/kmy/xcfgz' not found in ('gz/tgz/tpz/zabw/svgz', '', '???')
===================================================================================== warnings summary ======================================================================================
test/libmagic_test.py::MagicTestCase::test_detect_from_content
test/libmagic_test.py::MagicTestCase::test_detect_from_filename
test/libmagic_test.py::MagicTestCase::test_detect_from_fobj
  /home/tkloczko/rpmbuild/BUILD/python-magic-0.4.27/magic/__init__.py:437: PendingDeprecationWarning: Using compatibility mode with libmagic's python binding. See https://github.com/ahupp/python-magic/blob/master/COMPAT.md for details.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] test/python_magic_test.py:143: Magic file doesn't return expected type.
SKIPPED [1] test/python_magic_test.py:153: Magic file doesn't return expected type.
FAILED test/python_magic_test.py::MagicTest::test_extension - AssertionError: 'gz/tgz/tpz/zabw/svgz/adz/kmy/xcfgz' not found in ('gz/tgz/tpz/zabw/svgz', '', '???')
==================================================================== 1 failed, 17 passed, 2 skipped, 3 warnings in 0.14s ====================================================================

Here is list of installed modules in build env

Package         Version
--------------- --------------
attrs           22.2.0
build           0.10.0
distro          1.8.0
exceptiongroup  1.0.0
gpg             1.18.0-unknown
iniconfig       2.0.0
libcomps        0.1.19
packaging       23.0
pip             23.0.1
pluggy          1.0.0
pyproject_hooks 1.0.0
pytest          7.2.2
python-dateutil 2.8.2
rpm             4.17.0
setuptools      65.6.3
six             1.16.0
tomli           2.0.1
wheel           0.38.4
@ahupp
Copy link
Owner

ahupp commented Mar 22, 2023

This is fixed in a test update in 4ffcd59. I usually only roll a new release for feature updates, but I could put out a 0.4.28 with this if it's helpful

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants