Hi Andrey, list
On 03 Oct 2023 at 23:52:58, Carles Pina i Estany wrote: > On 03 Oct 2023 at 12:25:27, Andrey Rakhmatullin wrote: > > On Mon, Oct 02, 2023 at 11:32:31PM +0100, Carles Pina i Estany wrote: > > > I will create a new version of the package and upload it into > > > mentors.debian.net when I finish this email. For reference: it will be > > > the version 1.2.69-3. > > Note that the usual practice is not bumping Debian versions for packages > > that were not uploaded yet and always uploading -1. > > Note taken, thanks! It will stay in -1 until uploaded. Makes it even > easier. > > > > In my first version (not published) I wrote a simple autopkgtest with an > > > "import cloudscraper" (I know that this is not fully testing everything > > > but at least something!). Then I realised that it's not needed... > > Yeah. > > And you should try "Testsuite: autopkgtest-pkg-pybuild" instead, to run > > Ha! I didn't know of autopkgtest-pkg-pybuild. Thanks for this! > > > upstream tests. Though I think it won't see your explicit `pytest -k` and > > you should replace the override with a PYBUILD_TEST_ARGS var. > > Done this way: > https://salsa.debian.org/python-team/packages/python-cloudscraper/-/commit/78a83fbb0fe5fdfba78136921b919a11c8c9bc43 > > When I added it, the automatic simple test from autodep8 (importing the > module) stopped being added. > > pytest, as run automatically when having "Testsuite: > autopkgtest-pkg-pybuild": runs in the directory > "/tmp/autopkgtest-lxc.u3g8w1m_/downtmp/autopkgtest_tmp/build" doing > "python3.11 -m pytest -k ...". > > The contents of the directory via "ls -l" can be seen here: > https://salsa.debian.org/carlespina/python-cloudscraper/-/jobs/4766353#L357) > > Because there is the sub-directory > /tmp/autopkgtest-lxc.u3g8w1m_/downtmp/autopkgtest_tmp/build/cloudscraper > : for what I can tell, pytest is running the tests with the code from > /tmp/autopkgtest-lxc.u3g8w1m_/downtmp/autopkgtest_tmp/build/cloudscraper > and not the installed package in > /usr/lib/python3/dist-packages/cloudscraper/ . Generally speaking, I > prefer to use the installed code (as done via the basic "import"). > > Once, in a similar situation, some files were shipped but not installed > and the tests were running but not for the user. > > So I still added this: > --- > Test-Command: set -e ; cd "$AUTOPKGTEST_TMP" ; python3 -c "import > cloudscraper" > Depends: python3-cloudscraper > Features: test-name=import-cloudscraper > --- > (simplified from the the original code done by autodep8) Recap: pytest executed from "pybuild-autopkgtest", in the python-cloudscraper package, would use the src cloudscrapper instead of the installed one. So, to make sure that pytest uses the installed one, I added in debian/rules: ----- before-pybuild-autopkgtest: mv cloudscraper $(AUTOPKGTEST_TMP) after-pybuild-autopkgtest: mv $(AUTOPKGTEST_TMP) cloudscraper ----- https://salsa.debian.org/carlespina/python-cloudscraper/-/commit/c4ad00d05f9a7cf95c1c62d9fc791bf2cf0f222d Then I could delete (seems redundant now) what I did last night (debian/tests/control): ----- Test-Command: set -e ; cd "$AUTOPKGTEST_TMP" ; python3 -c "import cloudscraper" Depends: python3-cloudscraper Features: test-name=import-cloudscraper ----- Which was testing the import from the installed package. Any thoughts? -- Carles Pina i Estany https://carles.pina.cat