• Re: Testsuite: autopkgtest-pkg-pybuild: weird behavior in my uploaded p

    From Antonio Terceiro@21:1/5 to Andrey Rakhmatullin on Mon Nov 11 22:40:01 2024
    On Fri, Nov 08, 2024 at 03:27:12PM +0500, Andrey Rakhmatullin wrote:
    On Fri, Nov 08, 2024 at 10:03:18AM +0100, Roland Mas wrote:
    You need to list the files required for testing in debian/pybuild.testfiles.
    Then both dh_auto_test and autopkgtest-pkg-pybuild do the right thing.

    This is the thing I didn't want to suggest, because dh_auto_test already works.

    One issue is that the tests assume that the code to be imported is on a
    parent directory, and that does not really work when running against the installed code.

    I got it to work by making these changes to the upstream tests:

    ----------------8<----------------8<----------------8<-----------------
    --- fscacher-0.4.1.orig/src/fscacher/tests/test_cache.py
    +++ fscacher-0.4.1/src/fscacher/tests/test_cache.py
    @@ -8,8 +8,8 @@ import subprocess
    import sys
    import time
    import pytest
    -from .. import PersistentCache
    -from ..cache import DirFingerprint, FileFingerprint
    +from fscacher import PersistentCache
    +from fscacher.cache import DirFingerprint, FileFingerprint

    platform_system = platform.system().lower()
    on_windows = platform_system == "windows"
    --- fscacher-0.4.1.orig/src/fscacher/tests/test_util.py
    +++ fscacher-0.4.1/src/fscacher/tests/test_util.py
    @@ -1,5 +1,5 @@
    import pytest
    -from ..cache import xor_bytes
    +from fscacher.cache import xor_bytes


    @pytest.mark.parametrize( ----------------8<----------------8<----------------8<-----------------

    And these changes to the Debian packaging:

    ----------------8<----------------8<----------------8<-----------------
    diff -Nru fscacher-0.4.1/debian/control fscacher-0.4.1/debian/control
    --- fscacher-0.4.1/debian/control 2024-11-08 1
  • From Andrey Rakhmatullin@21:1/5 to Boyuan Yang on Fri Nov 8 08:30:01 2024
    On Thu, Nov 07, 2024 at 08:34:29PM -0500, Boyuan Yang wrote:
    According to pybuild-autopkgtest(1) [1], it seems that Python packages that uses Testsuite: autopkgtest-pkg-build will "run the tests in the same way as pybuild ... exception that tests are not run in the build directory". I have some confusion on it with my recent uploads.

    When I look at fscacher/0.4.1-1.1 upload [2], the autopkgtest failure for this upload is weird. In [3], it looks like the tests are still to be executed in the "build" directory.

    There is no package build directory when autopkgtest runs, because
    autopkgtest runs in a new separate chroot. That's what the line from the manpage means.

    Since this package is not built in autopkgtest, pytest cannot find
    anything to test and then directly fails:

    It's not directly related to building, it's just because your tests are in src/fscacher/tests and so they are not copied into the test dir by
    default. I don't know what's the preferred best practice for such
    packages, I imagine both copying the test manually and running tests
    against /usr/lib/python3/dist-packages/fscacher would work, but I don't
    think either are possible with autopkgtest-pkg-build, at least if you
    don't want to do extra copying not needed for build-time tests in d/rules.
    In my package (python-queuelib) that has a similar layout I haven't
    switched to autopkgtest-pkg-build.

    (I would also expect that if a maintainer adds autopkgtests to a package
    they actually run those before uploading)


    --
    WBR, wRAR

    -----BEGIN PGP SIGNATURE-----

    iQJhBAABCgBLFiEEolIP6gqGcKZh3YxVM2L3AxpJkuEFAmctu6gtFIAAAAAAFQAP cGthLWFkZHJlc3NAZ251cGcub3Jnd3JhckBkZWJpYW4ub3JnAAoJEDNi9wMaSZLh F+4QAKTro3sem34EwND9bcowozEskONkdDVj/NbFvzoOp5XUjnhBIczrfED++lRL Y2hgzLvXR+xHnruge2Dvd+ofx+8DMHWsBBrgZB2Se4vK+LxPpBT92UTZSxNQeCGN E7FzfIXL52RGMgjlVd6+SsrLpOKSGKKEvwxIa27Q9QpvHQR/mtdplBJGYROo+12s BgrTPaRsQbaB6MyC2GJGO++q5185bv3Ld7dZYia5APKPqHWijrc7yVgsZYQPoZUu zcomwEIsbPtRFEHzsWPhMdYavAN2s/mjNKWQDYzu1w9hGRvPhCfzqePIX5NjhLfe Xa/DyAojsGsKZdSygFYtF6V4cbyytxKpX8YDSsiwD3y5f2Bf0hfvGazHR8jGG3CK e2UiltKstZgXFAQxFd4Qdds/TJEnEZ8hf/6y/WCF2IQ6CoUS3f2jlu5jCzqBI3JJ PVLHGXtQEsv8cGiR57h+r0Qj06xQQViEbwgN1Hq/THgyFuyzgmKqPKQiynTyLXpB cV8vBQb2YqOUXQJTn3kVaJrm5a5jNpA0+bSiWbWdN+XGW0CcdIdkVhNJ9Q0+/PMw PxSoX6nWSpIFWFhRrPtmqWTCXHrVNqIvlhrh9Qk779gzZ00jMkzp+JX8FOcs5cOj +QXcxWrWqvKcSeyAo4pMl90xRMCF2S2X2NbySTH/pGb2O2Mq
    =vJXN
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roland Mas@21:1/5 to All on Fri Nov 8 10:20:01 2024
    Le 08/11/2024 à 08:20, Andrey Rakhmatullin a écrit :
    On Thu, Nov 07, 2024 at 08:34:29PM -0500, Boyuan Yang wrote:
    According to pybuild-autopkgtest(1) [1], it seems that Python packages that >> uses Testsuite: autopkgtest-pkg-build will "run the tests in the same way as >> pybuild ... exception that tests are not run in the build directory". I have >> some confusion on it with my recent uploads.

    When I look at fscacher/0.4.1-1.1 upload [2], the autopkgtest failure for
    this upload is weird. In [3], it looks like the tests are still to be
    executed in the "build" directory.
    There is no package build directory when autopkgtest runs, because autopkgtest runs in a new separate chroot. That's what the line from the manpage means.

    Since this package is not built in autopkgtest, pytest cannot find
    anything to test and then directly fails:
    It's not directly related to building, it's just because your tests are in src/fscacher/tests and so they are not copied into the test dir by
    default. I don't know what's the preferred best practice for such
    packages,

    You need to list the files required for testing in
    debian/pybuild.testfiles. Then both dh_auto_test and
    autopkgtest-pkg-pybuild do the right thing.

    Roland.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrey Rakhmatullin@21:1/5 to Roland Mas on Fri Nov 8 11:30:01 2024
    On Fri, Nov 08, 2024 at 10:03:18AM +0100, Roland Mas wrote:
    You need to list the files required for testing in debian/pybuild.testfiles. Then both dh_auto_test and autopkgtest-pkg-pybuild do the right thing.

    This is the thing I didn't want to suggest, because dh_auto_test already
    works.

    --
    WBR, wRAR

    -----BEGIN PGP SIGNATURE-----

    iQJhBAABCgBLFiEEolIP6gqGcKZh3YxVM2L3AxpJkuEFAmct54AtFIAAAAAAFQAP cGthLWFkZHJlc3NAZ251cGcub3Jnd3JhckBkZWJpYW4ub3JnAAoJEDNi9wMaSZLh aI8QAIwngipm6QWf6FFgStNpqWE9NG16hjwuiU6xyIeOEqCfsD31g8+poBP3Xk3V tlkMuCqR0uXDZyUtzyn4ZLeKX4zuLglhGu96bQn5AKo5M++n5Sz6cLFYW7MBpyaR CQjtTcwDQXD0kKw9h40KHY8NV0g3W5qgujtSvwyBV040GOFxdUsNVKOUFG9w/NHF WmkQeTOsDWbpbcceA1kWAuDR5FsJcCGCT6r8CwA/h3CXzb+mroYPViGFb+tI0PP2 UGeeBNB7KxAz41jNsUB5OHUgcKsBN6ZqnU1pLVACLOj3QttasrpnJSxfTE53iIKC 0eEO9pt55dqvKu9dUX0FODqFBLgNp83Q5WJsIkXrxDz/JHFrtEVsPeiWAwIvhWjQ /zScq3/kfZhB4X56cvQGqZTtFyYMDeQBQaahkBtnpGUhjbI9tL7sEMEF36Lmr6CP uQQ7TQ0rPLe/f8DMtfj0RLqiB7veEK4Ss62lsvyQ8M2UpSyqMa5i/Un8kR0s8o36 /yBqFRJDQyATHt7o8YYNWiyprhO9cilrCeKeqqmvnnCSjEnKeuUW5A4E3F9rb9ry 6u1kIOmBdrd/LK2W4LWfEhy8ceVLgLO+BoTEoJ95LMIVk+zsQn2/bW8wwsRuah76 uuuWeWiODG2gBwYeeTJLUNUwAH/QSHEfx42pwlIyXSRHp+c/
    =mNhX
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)