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:
```console
+ 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 =
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 ====================================================================
```
This is fixed in a test update in 4ffcd59113fa26d7c2e9d5897b1eef919fd4b457. 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
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
build
with--no-isolation
I'm using during all processes only locally installed modulescut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
Here is list of installed modules in build env