Discussion:
python-mnemonic: problem with test not able to find local file
(too old to reply)
Soren Stoutner
2024-09-27 03:10:01 UTC
Permalink
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]
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
***@debian.org
weepingclown
2024-09-27 05:00:01 UTC
Permalink
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
Carsten Schoenert
2024-09-27 05:30:01 UTC
Permalink
Hi,
Post by 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.
Post by weepingclown
$ 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
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
Soren Stoutner
2024-09-27 19:10:01 UTC
Permalink
Post by Carsten Schoenert
Post by weepingclown
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.
Post by Carsten Schoenert
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
***@debian.org
Loading...