On Tuesday, October 29, 2024 11:11:44 PM MST Soren Stoutner wrote:
> > > My question is, what is the canonical way to handle this?
> > 
> > Fixing the package so that it provides that module or patching the tests
> > so that they don't require it.
> 
> The tests run successfully during build.
> 
> "688 passed, 3 skipped, 3 warnings in 98.99s (0:01:38)”
> 
> https://salsa.debian.org/cryptocoin-team/electrum/-/jobs/6505007#L1548

Looking at things more deeply, the underlying cause is that the upstream 
source contains GUI environments for both Linux (Qt) and Android (QML).  In 
the build environment, all these files are present (this was the key I was 
missing).  But, in the Debian package, the QML files have been removed (because 
they aren’t needed).

(Andrey, as I’m writing this I see you just sent me an email explaining the 
same thing.)

The test in question is test_qml_types.py.

If I disable it in debian/rules using the following command the test no longer 
runs during build.

export PYBUILD_TEST_ARGS=-k 'not test_qml_types.py’

However, that doesn’t fix the autopkgtest problem.  I still receive the 
following error:

I: pybuild base:311: cd /tmp/autopkgtest-lxc.0qtzuqhg/downtmp/autopkgtest_tmp/
build; python3.12 -m pytest -k 'not test_qml_types.py'
============================= test session starts 
==============================
platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
rootdir: /tmp/autopkgtest-lxc.0qtzuqhg/downtmp/autopkgtest_tmp/build
plugins: typeguard-4.3.0
collected 688 items / 1 error
==================================== ERRORS 
====================================
___________________ ERROR collecting tests/test_qml_types.py 
___________________
ImportError while importing test module '/tmp/autopkgtest-lxc.0qtzuqhg/
downtmp/autopkgtest_tmp/build/tests/test_qml_types.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_qml_types.py:5: in <module>
    from electrum.gui.qml.qetypes import QEAmount
E   ModuleNotFoundError: No module named ‘electrum.gui.qml’


https://salsa.debian.org/cryptocoin-team/electrum/-/jobs/6506576#L662

I assume this is because autopkgtests enumerates all of the imports, even for 
tests it isn’t going to run.

Is there a recommended way to disable this test entirely, including the 
import?  I would assume at least one of the following would work:

1.  Use some other command (of which I am not aware) instead of "export 
PYBUILD_TEST_ARGS=-k” that causes autopkgtest to ignore the file entirely.
2.  Patch out the import line in the test using debian/patches.
3.  Exclude the entire test file when repacking the upstream source.

-- 
Soren Stoutner
so...@debian.org

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to