Path: csiph.com!aioe.org!bofh.it!news.nic.it!robomod From: Simon McVittie Newsgroups: linux.debian.maint.python Subject: Re: SETUPTOOLS_SCM_PRETEND_VERSION trick : how to use it in autopkgtest? Date: Tue, 09 Jun 2020 13:30:01 +0200 Message-ID: References: X-Original-To: debian-python@lists.debian.org X-Mailbox-Line: From debian-python-request@lists.debian.org Tue Jun 9 11:29:29 2020 Old-Return-Path: X-Amavis-Spam-Status: No, score=-5.901 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LDO_WHITELIST=-5, LONGWORD=2, RCVD_IN_DNSWL_LOW=-0.7] autolearn=no autolearn_force=no Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.master; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-ID:Content-Description; bh=NWjrq89nX44KeFebdz/tEzYE32dpUHStMCUmeveg8Ac=; b=A6/e+cYmMbtLsPb11j9L+SUvTs czqnp/nAZAFxlxXunmhTksSm9S/H4mB9W7HzZb6aInOSQ73CLdYKgmmHOq0ttLbmIIesQCaotHi4S NRIYneAmOL7J6i0Ulq59jDpECaN3TGbYBWbAYMZ2CQdB26yCO6/v6XLsANkPXcE+sZbvxDuGUfOWk n/U13Dnv+xMaxxtgfSRnMwS/OcNDOSWyePmh+2cuA6sqPX0MeY9THkKFlKZuy3VZHYJ2Iyivi781R nGQTFlT/VyzjicUdxBB0GatHWAWBHhLIDX1srYFf6SmevB5ALIaGRFJRK5OyLcpNLr29B8WEFlgNr gbG127yQ==; MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailing-List: archive/latest/18352 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/20200609112905.GA504113@espresso.pseudorandom.co.uk Approved: robomod@news.nic.it Lines: 32 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Tue, 9 Jun 2020 12:29:05 +0100 X-Original-Message-ID: <20200609112905.GA504113@espresso.pseudorandom.co.uk> X-Original-References: Xref: csiph.com linux.debian.maint.python:12645 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