8.0: test suite is failing in test_element.py unit
+ /usr/bin/meson test -C noarch-redhat-linux-gnu --num-processes 48 --print-errorlogs
ninja: Entering directory `/home/tkloczko/rpmbuild/BUILD/secrets-8.0/noarch-redhat-linux-gnu'
ninja: no work to do.
1/3 Validate schema file OK 0.01s
2/3 Validate metainfo file OK 0.02s
3/3 test_element.py FAIL 0.66s exit status 2
>>> MALLOC_PERTURB_=94 /usr/bin/python3 -m pytest
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/secrets-8.0
collected 0 items / 1 error
==================================== ERRORS ====================================
____________________ ERROR collecting tests/test_element.py ____________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/secrets-8.0/tests/test_element.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_element.py:11: in <module>
from gsecrets.database_manager import DatabaseManager
gsecrets/database_manager.py:10: in <module>
import gsecrets.config_manager as config
gsecrets/config_manager.py:6: in <module>
from gsecrets import const
E ImportError: cannot import name 'const' from 'gsecrets' (unknown location)
=========================== short test summary info ============================
ERROR tests/test_element.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.38s ===============================
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Summary of Failures:
3/3 test_element.py FAIL 0.66s exit status 2
Ok: 2
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/tkloczko/rpmbuild/BUILD/secrets-8.0/noarch-redhat-linux-gnu/meson-logs/testlog.txt
Other thing is that pytest should not be uses be execute python -m pytest
because when python interpreter is executed with -m
it adds curent directory ro sys.path
which is asking for troubles. This is why pytest provides pytest
wrapper script.