Re: electrum: How to enable autopkgtest?

2024-10-30 Thread Antonio Terceiro
On Tue, Oct 29, 2024 at 01:43:50PM -0700, Soren Stoutner wrote:
> I recently requested the upstream maintainers add the tests directory to 
> their 
> signed tarball releases.  I am now in the process of trying to enable those 
> tests in the Debian package.
> 
> I added a Build-Depend on "python3-pytest ” and added “Testsuite: 
> autopkgtest-pkg-pybuild” to debian/control.  This enables the tests during 
> build time, but I receive the following error during autopkgtest:
> 
> E   ModuleNotFoundError: No module named ‘electrum.gui.qml’
> 
> https://salsa.debian.org/cryptocoin-team/electrum/-/jobs/6505015#L677
> 
> I believe I could fix this problem by adding the following to debian/rules:
> 
> export PYBUILD_NAME=electrum
> 
> However, this breaks the current splitting of the files into two binary 
> packages, electrum and python3-electrum, using .install files.
> 
> My question is, what is the canonical way to handle this?  Is there some 
> variation of the “export PYBUILD_NAME” command that preserves the contents of 
> the two binary packages?  Or, is there some other command I am missing that 
> will allow autopkgtest to import the built modules?

If you check the artfifacts in the pipeline, your python3-electron does
not contain the module that the test is trying to import:

$ dpkg --contents python3-electrum_4.5.8+ds-1+salsaci+20241029+49_all.deb | 
grep qml.*py
-rw-r--r-- root/root  4142 2024-10-18 00:56 
./usr/lib/python3/dist-packages/electrum/plugins/labels/qml.py
-rw-r--r-- root/root  4559 2024-10-18 00:56 
./usr/lib/python3/dist-packages/electrum/plugins/trustedcoin/qml.py

This is why the import fails, it has nothing to do with PYBUILD_NAME.


signature.asc
Description: PGP signature


Re: electrum: How to enable autopkgtest?

2024-10-30 Thread Andrey Rakhmatullin
On Wed, Oct 30, 2024 at 12:06:32AM -0700, Soren Stoutner wrote:
> 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’

The correct way is --ignore tests/test_qml_types.py



-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: electrum: How to enable autopkgtest?

2024-10-30 Thread Soren Stoutner
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 
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

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


Re: electrum: How to enable autopkgtest?

2024-10-30 Thread Soren Stoutner
On Wednesday, October 30, 2024 12:16:33 AM MST Andrey Rakhmatullin wrote:
> On Wed, Oct 30, 2024 at 12:06:32AM -0700, Soren Stoutner wrote:
> > 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’
> 
> The correct way is --ignore tests/test_qml_types.py

Thank you.  That works perfectly.

Do you think it would be helpful to add that to the wiki at:

https://wiki.debian.org/Python/Pybuild#CUSTOMIZATION

Should it replace the information about the -k command or are they 
complimentary, with each having advantages in different scenarios?

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

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


Re: electrum: How to enable autopkgtest?

2024-10-30 Thread Andrey Rakhmatullin
On Wed, Oct 30, 2024 at 12:28:27AM -0700, Soren Stoutner wrote:
> > > 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’
> > 
> > The correct way is --ignore tests/test_qml_types.py
> 
> Thank you.  That works perfectly.
> 
> Do you think it would be helpful to add that to the wiki at:
> 
> https://wiki.debian.org/Python/Pybuild#CUSTOMIZATION

Yes.

> Should it replace the information about the -k command or are they 
> complimentary, with each having advantages in different scenarios?

They are complimentary, --ignore skips the file at the test collection
step (https://docs.pytest.org/en/stable/example/pythoncollection.html), -k
and -m select/deselect specific tests
(https://docs.pytest.org/en/stable/example/markers.html).


-- 
WBR, wRAR


signature.asc
Description: PGP signature