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


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

Re: running tests against installed version of package

From Thomas Goirand <zigo@debian.org>
Newsgroups linux.debian.maint.python
Subject Re: running tests against installed version of package
Date 2016-04-01 00:00 +0200
Message-ID <riSNd-2N8-7@gated-at.bofh.it> (permalink)
References <rguch-6J2-5@gated-at.bofh.it>
Organization Debian

Show all headers | View raw


On 03/25/2016 08:17 AM, Brian May wrote:
> Hello,
> 
> By default pybuild runs tests I think using the source tree.

In most cases, Pybuild isn't very helpful for running tests and fails in
the most common traps (like the one I'm solving for you below), which is
why I don't really think it's useful at all. YMMV...

> However I have a package where the tests require the entry points from
> setup.py to be configured, the tests fail without this.

Most of the time, you get by this doing:
PYTHONPATH=$(CURDIR) python -m pytest tests

If this doesn't work (maybe because you need the egg-info which isn't in
the tarball, or otherwise...), then get the package installed first:

python setup.py install --install-layout=deb \
	--root $(CURDIR)/debian/tmp
PYTHONPATH=$(CURDIR)/debian/tmp python -m pytest tests

In the case of apscheduler, simply defining PYTHONPATH=. is enough, then
unit tests failing are those trying to connect to a local redis server
which may be fixed by manually starting redis-server from your
debian/rules (take care: you *must* start it on a non-standard port or
unix file-socket, and get your unit tests to use that non-standard port,
otherwise you'll be in trouble either in sbuild, or in non-sbuild).

By doing the above, I was able to run *all* of the unit tests of
apscheduler (ie: 404 tests, minus the 7 tests which got automatically
skipped).

I hope this helps, even though you probably will not maintain this
package. Hopefully, it will help you for the next one! :)

Cheers,

Thomas Goirand (zigo)

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


Thread

running tests against installed version of package Brian May <brian@linuxpenguins.xyz> - 2016-03-25 08:20 +0100
  Re: running tests against installed version of package Ben Finney <ben+debian@benfinney.id.au> - 2016-03-25 11:50 +0100
    Re: running tests against installed version of package Brian May <bam@debian.org> - 2016-03-26 03:50 +0100
      Re: running tests against installed version of package Brian May <bam@debian.org> - 2016-03-26 04:10 +0100
        Re: running tests against installed version of package Ben Finney <ben+debian@benfinney.id.au> - 2016-03-26 04:20 +0100
      Re: running tests against installed version of package Ben Finney <ben+debian@benfinney.id.au> - 2016-03-26 04:10 +0100
  Re: running tests against installed version of package Barry Warsaw <barry@debian.org> - 2016-03-25 23:20 +0100
    Re: running tests against installed version of package Brian May <bam@debian.org> - 2016-03-26 04:00 +0100
      Re: running tests against installed version of package Barry Warsaw <barry@debian.org> - 2016-03-31 19:00 +0200
  Re: running tests against installed version of package Brian May <brian@linuxpenguins.xyz> - 2016-03-27 07:20 +0200
    egg-info executable files Brian May <bam@debian.org> - 2016-03-27 07:30 +0200
      Re: egg-info executable files Ben Finney <ben+debian@benfinney.id.au> - 2016-03-27 08:50 +0200
  Re: running tests against installed version of package Thomas Goirand <zigo@debian.org> - 2016-04-01 00:00 +0200
    Re: running tests against installed version of package Piotr Ożarowski <piotr@debian.org> - 2016-04-01 00:20 +0200
      Re: running tests against installed version of package Thomas Goirand <zigo@debian.org> - 2016-04-02 14:00 +0200
        Re: running tests against installed version of package Piotr Ożarowski <piotr@debian.org> - 2016-04-02 23:00 +0200
    Re: running tests against installed version of package Tiago Ilieve <tiago.myhro@gmail.com> - 2016-04-02 10:10 +0200
      Re: running tests against installed version of package Brian May <bam@debian.org> - 2016-04-03 03:40 +0200
        Re: running tests against installed version of package Tiago Ilieve <tiago.myhro@gmail.com> - 2016-04-03 04:50 +0200
          Re: running tests against installed version of package Brian May <bam@debian.org> - 2016-04-03 05:00 +0200
      Re: running tests against installed version of package Thomas Goirand <zigo@debian.org> - 2016-04-06 00:30 +0200
        Re: running tests against installed version of package Piotr Ożarowski <piotr@debian.org> - 2016-04-06 11:00 +0200

csiph-web