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


Groups > linux.debian.maint.python > #11244 > unrolled thread

pybuild and testing pytest plugins

Started byScott Talbert <swt@techie.net>
First post2019-01-13 20:40 +0100
Last post2019-01-14 12:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.debian.maint.python


Contents

  pybuild and testing pytest plugins Scott Talbert <swt@techie.net> - 2019-01-13 20:40 +0100
    Re: pybuild and testing pytest plugins Alexandros Afentoulis <alexaf@bloom.re> - 2019-01-14 09:30 +0100
      Re: pybuild and testing pytest plugins Piotr Ożarowski <piotr@debian.org> - 2019-01-14 12:40 +0100

#11244 — pybuild and testing pytest plugins

FromScott Talbert <swt@techie.net>
Date2019-01-13 20:40 +0100
Subjectpybuild and testing pytest plugins
Message-ID<xfTLX-2hA-5@gated-at.bofh.it>
When packaging a pytest plugin and wanting to run the plugin's unit tests 
during the build process, the plugin usually has to be installed before 
running the tests, otherwise pytest cannot find the plugin.  This seems to 
require workarounds such as this [1].

Is there any way to avoid this with pybuild or is such a workaround really 
necessary?

Thanks,
Scott

[1] https://salsa.debian.org/python-team/modules/pytest-xdist/blob/debian/master/debian/rules#L12

[toc] | [next] | [standalone]


#11246

FromAlexandros Afentoulis <alexaf@bloom.re>
Date2019-01-14 09:30 +0100
Message-ID<xg5N8-1nN-5@gated-at.bofh.it>
In reply to#11244
On 1/13/19 9:23 PM, Scott Talbert wrote:
> When packaging a pytest plugin and wanting to run the plugin's unit 
> tests during the build process, the plugin usually has to be installed 
> before running the tests, otherwise pytest cannot find the plugin.  This 
> seems to require workarounds such as this [1].
> 
> Is there any way to avoid this with pybuild or is such a workaround 
> really necessary?
> 
> Thanks,
> Scott
> 
> [1] 
> https://salsa.debian.org/python-team/modules/pytest-xdist/blob/debian/master/debian/rules#L12 
> 
> 
> 

Hi!

Conceptually I think it's more relevant to override dh_auto_test. To 
make sure pytest will register the plugin one may tweak the $PYTHONPATH. 
That's the approach I followed in pytest-flask, see [1].

Not sure if this is a workaround too though :)

Cheers,
Alex

[1] 
https://salsa.debian.org/python-team/modules/pytest-flask/blob/debian/master/debian/rules

[toc] | [prev] | [next] | [standalone]


#11247

FromPiotr Ożarowski <piotr@debian.org>
Date2019-01-14 12:40 +0100
Message-ID<xg8KZ-3ak-1@gated-at.bofh.it>
In reply to#11246
> Conceptually I think it's more relevant to override dh_auto_test. To make
> sure pytest will register the plugin one may tweak the $PYTHONPATH. That's
> the approach I followed in pytest-flask, see [1].

> [1] https://salsa.debian.org/python-team/modules/pytest-flask/blob/debian/master/debian/rules

while tests are run in build target (not my choice, I'd check installed files)
I strongly advise to *not* use source files (i.e. "PYTHONPATH=$(CURDIR)")
in dh_auto_test, especially if you build an extension. pybuild changes
directory for a reason.

If you need some files from source directory during tests, please list
them in debian/pybuild.testfiles file and pybuild will copy them to
build directory (and remove after tests). See pybuild manpage for more info.
-- 
GPG: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.maint.python


csiph-web