Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #12645

Re: SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in autopkgtest?

From Simon McVittie <smcv@debian.org>
Newsgroups linux.debian.maint.python
Subject Re: SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in autopkgtest?
Date 2020-06-09 13:30 +0200
Message-ID <AfKC5-Mt-3@gated-at.bofh.it> (permalink)
References <AfrSO-6fO-29@gated-at.bofh.it> <AfIgW-7Hn-7@gated-at.bofh.it> <AfJcZ-8g3-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 09 Jun 2020 at 11:50:02 +0200, Julien Puydt wrote:
> (1) during the autopkgtest run, we're not in the package source tree,
> are we? So there should be no access do d/changelog?

    The cwd of each test is guaranteed to be the root of the source
    package, which will have been unpacked but not built. However note
    that the tests must test the installed version of the package,
    as opposed to programs or any other file from the built tree.
    — https://salsa.debian.org/ci-team/autopkgtest/blob/master/doc/README.package-tests.rst

I've found that a lot of the time, what makes most sense is to gather
the information you need from the source tree, copy the files you
need from the source tree into a temporary directory, cd into the
temporary directory, and do the rest of your testing there. This avoids
things like Python's default "add the script's directory to sys.path"
behaviour accidentally picking up the version of the library that's in
the source package, which would result in not testing the installed copy
as required. For example, src:python-mpd does this.

Another way to get a similar result is to install the tests as part of the
binary packages, cd into an empty temporary directory, and run them from the
installed location. src:tap.py does this (the tests are small, so they're
just included in the main binary package) and so does src:dbus-python (the
tests are larger and have non-trivial dependencies, so they're a separate
binary package).

autopkgtest guarantees that $AUTOPKGTEST_TMP is an empty temporary
directory, or you can make your own with mktemp -d or similar, or you
can use a tool like ginsttest-runner (aka gnome-desktop-testing-runner,
in the gnome-desktop-testing package) that does it for you.

    smcv

Back to linux.debian.maint.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in autopkgtest? Julien Puydt <julien.puydt@gmail.com> - 2020-06-08 17:30 +0200
  Re: SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in autopkgtest? Ondrej Novy <novy@ondrej.org> - 2020-06-09 11:00 +0200
    Re: SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in  autopkgtest? Julien Puydt <julien.puydt@gmail.com> - 2020-06-09 12:00 +0200
      Re: SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in  autopkgtest? Simon McVittie <smcv@debian.org> - 2020-06-09 13:30 +0200

csiph-web