• python-mnemonic: problem with test not able to find local file

    From Soren Stoutner@21:1/5 to Debian Python on Thu Sep 26 20:05:25 2024
    I am in the process of updating python-mnemonic. Historically, tests have not been enabled. I can build the new version just fine, but when I enable tests by adding a Build-Depend on "python3-pytest <!nocheck>” the build fails [1] with the following error:

    def test_vectors(self) -> None:
    with open("vectors.json", "r") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'vectors.json' tests/test_mnemonic.py:45: FileNotFoundError

    vectors.json is located in the root [2]. But for some reason it is not available in the test environment (or the test is looking in the wrong place).
    I could, of course, disable the tests again. But I would like to run them if possible. Does anybody have any idea what I would need to do to make this file
    available to the test?

    [1] https://salsa.debian.org/python-team/packages/python-mnemonic/-/jobs/ 6341467#L1138
    [2] https://salsa.debian.org/python-team/packages/python-mnemonic/-/blob/ debian/master/vectors.json?ref_type=heads

    --
    Soren Stoutner
    [email protected]
    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEJKVN2yNUZnlcqOI+wufLJ66wtgMFAmb2IPUACgkQwufLJ66w tgMTDQ/+PrG9TRKAzodqnscbXNH6wKFiMsbSsmN4IVz2FoKRFkNGI4WScoHMZunI +vuMEhC3SV7M+0JYponYBwVU2/TXoRp2tAFEk1Y00GydgWhmbg9hW9IFHa/cIzUK u1kT1LbHPGHwaco6J8HkuekDmKcawvrpIFdHFsCXZhRzN4B56w8l6N0L2siMaOvI ISXRquH3OjVChnZx1BpRxzbt7h0YiXRC7oCNSqwpffgeeAlCIDW48RlQ4PwOKJCx nz23PvnPwBhGAWDnrS2dyM1HLex3BAP9Y9HT4FmZaXCoFSCqxDMtBO+UDy1vbNMa YawYE9m0KyjAOBwhj/D9XUKME2UAMBntCCe+BrhGY0mP/4+shgTVhgeDxFcGyW25 vVfW3s1stTYbBn1q8hjTeino9QYY2iyYv3A02SgE1va5HwRUGmDqRNewJJIVPzdk UcF1oxhBh+yoJHFsxbS6nRuwreYfCuFntUPy+W2liH2JufzgsFSTpoi8cM7NoeXQ dRiD1xkslbULGxn5XtsXjbEeiGYLo5h/aOKUiGdAW/pUI1b7znTTJ8Mw2tc2ZHWF V3jmahwN156kvNZMaSesPSiNf4NQ0BM33Uaw3cL095I2w8RBFWd9i5zSXhbPN1CI d8fzP4AIkRQE+aCfG+z4gB/Y9vLlja6GWbYsad3hnmIAEKwJJOg=
    =zXNc
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From weepingclown@21:1/5 to All on Fri Sep 27 07:00:01 2024
    ------PRV59NKT4A01VA9C9HQVIQ2BSKERCI
    Content-Type: text/plain;
    charset=utf-8
    Content-Transfer-Encoding: quoted-printable

    Hi,

    the file must not have been copied to the testbed, I assume. You can try adding a debian/pybuild.testfiles file with vectors.json listed in it and that'd *probably* take care of the issue.

    Best,
    Ananthu
    ------PRV59NKT4A01VA9C9HQVIQ2BSKERCI
    Content-Type: text/html;
    charset=utf-8
    Content-Transfer-Encoding: quoted-printable

    <!DOCTYPE html><html><body><div dir="auto">Hi,<br><br>the file must not have been copied to the testbed, I assume. You can try adding a debian/pybuild.testfiles file with vectors.json listed in it and that'd *probably* take care of the issue.<br><br>Best,
    <br>Ananthu</div></body></html>
    ------PRV59NKT4A01VA9C9HQVIQ2BSKERCI--

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carsten Schoenert@21:1/5 to All on Fri Sep 27 07:30:01 2024
    Hi,

    Am 27.09.24 um 06:56 schrieb weepingclown:
    Hi,

    the file must not have been copied to the testbed, I assume. You can try adding a debian/pybuild.testfiles file with vectors.json listed in it
    and that'd *probably* take care of the issue.

    that's one option and mostly the more straightforwarded one.

    https://manpages.debian.org/testing/dh-python/pybuild.1.en.html#testfiles

    I often use this different way. The comments are not needed, just added
    to show what is happen here.

    $ git diff
    diff --git a/debian/rules b/debian/rules
    index d5af02b..415b0e1 100755
    --- a/debian/rules
    +++ b/debian/rules
    @@ -1,6 +1,10 @@
    #!/usr/bin/make -f

    export PYBUILD_NAME=mnemonic
    +# Copy needed file vectors.json into build directory before test are running.
    +export PYBUILD_BEFORE_TEST=cp vectors.json {build_dir}
    +# And remove the file after the test before the data is geting copied into the package.
    +export PYBUILD_AFTER_TEST=rm {build_dir}/vectors.json

    %:
    dh $@ --with python3 --buildsystem=pybuild

    BTW:
    If you do a 's/dh-python/dh-sequence-python3' in d/control you can also
    drop the '--with python3' option in the default rarget in d/rules.

    --
    Regards
    Carsten

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Soren Stoutner@21:1/5 to All on Fri Sep 27 11:59:36 2024
    On Thursday, September 26, 2024 10:17:07 PM MST Carsten Schoenert wrote:

    the file must not have been copied to the testbed, I assume. You can try adding a debian/pybuild.testfiles file with vectors.json listed in it
    and that'd *probably* take care of the issue.

    that's one option and mostly the more straightforwarded one.

    https://manpages.debian.org/testing/dh-python/pybuild.1.en.html#testfiles

    Thank you to everyone for your help. This fixed the problem.

    BTW:
    If you do a 's/dh-python/dh-sequence-python3' in d/control you can also
    drop the '--with python3' option in the default rarget in d/rules.

    Thank you. I had seen dh-sequence-python3, but I was unaware of what using it would do.

    --
    Soren Stoutner
    [email protected]
    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEJKVN2yNUZnlcqOI+wufLJ66wtgMFAmb3AJgACgkQwufLJ66w tgOnzA//c1nJnwX1Y6FkHvYU+IFHhBlf94TaW/71LzAOppZR5r1rwd27+LyY7stQ S0lF9ubtuobCrfi4fI0uOvdN5AKSpFhMMOXJ0sUMX2AmOzQHf8cYJMEckUNMZ8hP U7taA6vaDUeV8D2p3RDAQYH8zxABdGJyqyi62dtzBwxfOYbKRlE61XTZb96JUyYI iSrxSHakH5KrFJESwDUJRaFsxw7ncNOrH3Htj7BTOCs04NGJJGQddhK4aualdWug mMBvdWXGi7+dklLeWQmWOTa2Gg6SPx86Ske56PsoRsI0/6xgfDW1+c9KdRivT85b 3ehnCR7pXKCPtO4uEPctWgcsim3mgwOKB7ZQa3H9CE9rOqw4VpfIjATwnPWCsHLH fjTuOQczy2QA97ucYiw3gjn8uBbL/mvGUH5gdCUw+OtHGMFG76O6vdn3x7Sc7EyS LvxC2VEnNgZGhDth9F+kM0NDeC9xtxhYvaRVPLKFPE8AjBbaZeumZ48be/FSvVBq pxaRwFsu+ZlSNqWbjZgYx3NxIjZekxEnW+k8bsn6H0KrtPgd7TJY1S4eNihwpkuz A2QgodLV5ACgxdXmonEXtuJQRdzIsNr/XDqsKSGn1koMnGcgS3Spx0XL4V8GPct8 TeF8HJupvJJh4rsg4Gs8nz81eNMrCpymWXSB4D0OBkFd6qLYI4E=
    =9/LM
    -----END PGP SIGNATURE-----

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