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


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

Anyway to omit some tests within unittest framework?

Started byzhao feng <zhaofengshu33@gmail.com>
First post2020-06-13 15:30 +0200
Last post2020-06-14 01:10 +0200
Articles 2 — 2 participants

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


Contents

  Anyway to omit some tests within unittest framework? zhao feng <zhaofengshu33@gmail.com> - 2020-06-13 15:30 +0200
    Re: Anyway to omit some tests within unittest framework? Peter Pentchev <roam@ringlet.net> - 2020-06-14 01:10 +0200

#12653 — Anyway to omit some tests within unittest framework?

Fromzhao feng <zhaofengshu33@gmail.com>
Date2020-06-13 15:30 +0200
SubjectAnyway to omit some tests within unittest framework?
Message-ID<Aheop-6g8-9@gated-at.bofh.it>
Recently I want to make a debian package of a scientific computing
library. I try to use
pybuild in my debian/rules. I found some tests failed because the test
code downloads some data from the internet when the test code is
running for the first time. I want to omit these tests. However, the
test uses Python built-in unittests I do not find any switch to omit a
small number of tests (it seems only supporting selecting which tests
to include). The document in pybuild mentions that it is possible for
`pytest` framework
(https://wiki.debian.org/Python/Pybuild#debian.2Fcontrol).
Since pybuild wraps the command line switch of these frameworks. I
think it is hard to find solution on pybuild level if unittests do not
support it. As far as I can figure out, I can inject some decorator to
the test code to omit these test functions, I do not know whether it
is acceptable to make such "patch" in debian. I wonder if there were
any way to deal with this kind of problems.

Some additional informations:
https://salsa.debian.org/zhaofeng-shu33-guest/ete is the source code
repo.

Thanks

[toc] | [next] | [standalone]


#12657

FromPeter Pentchev <roam@ringlet.net>
Date2020-06-14 01:10 +0200
Message-ID<AhnrH-3ks-7@gated-at.bofh.it>
In reply to#12653

[Multipart message — attachments visible in raw view] — view raw

On Sat, Jun 13, 2020 at 09:05:23PM +0800, zhao feng wrote:
> Recently I want to make a debian package of a scientific computing
> library. I try to use
> pybuild in my debian/rules. I found some tests failed because the test
> code downloads some data from the internet when the test code is
> running for the first time. I want to omit these tests. However, the
> test uses Python built-in unittests I do not find any switch to omit a
> small number of tests (it seems only supporting selecting which tests
> to include). The document in pybuild mentions that it is possible for
> `pytest` framework
> (https://wiki.debian.org/Python/Pybuild#debian.2Fcontrol).
> Since pybuild wraps the command line switch of these frameworks. I
> think it is hard to find solution on pybuild level if unittests do not
> support it. As far as I can figure out, I can inject some decorator to
> the test code to omit these test functions, I do not know whether it
> is acceptable to make such "patch" in debian. I wonder if there were
> any way to deal with this kind of problems.
> 
> Some additional informations:
> https://salsa.debian.org/zhaofeng-shu33-guest/ete is the source code
> repo.

It is possible to explicitly tell pybuild to use pytest for testing; see
the PYBUILD_TEST_PYTEST variable that I use e.g. in
https://sources.debian.org/src/confget/2.3.4-1/debian/rules/#L33 and
the following couple of lines. I expect that in this case you'd want to
set the PYBUILD_TEST_ARGS variable to the arguments that pytest will be
invoked with, e.g. -k 'not something' to exclude certain tests and maybe
the path to the unit tests directory and, if really necessary,
--rootdir.

I'm sorry, I cannot do any actual tests with your package right now.
If you run into problems, I could fetch it from your Git repository and
try a couple of things, but it will have to wait a day or two.

Hope that helps!

G'luck,
Peter

-- 
Peter Pentchev  roam@ringlet.net roam@debian.org pp@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

[toc] | [prev] | [standalone]


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


csiph-web