Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #12369 > unrolled thread
| Started by | Sao I Kuan <saoikuan@gmail.com> |
|---|---|
| First post | 2020-03-19 07:30 +0100 |
| Last post | 2020-03-21 00:50 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.debian.maint.python
Questions about including tests/ directory into package Sao I Kuan <saoikuan@gmail.com> - 2020-03-19 07:30 +0100
Re: Questions about including tests/ directory into package Diane Trout <diane@ghic.org> - 2020-03-19 19:00 +0100
Re: Questions about including tests/ directory into package Sao I Kuan <saoikuan@gmail.com> - 2020-03-20 12:30 +0100
Re: Questions about including tests/ directory into package Sandro Tosi <morph@debian.org> - 2020-03-21 00:50 +0100
| From | Sao I Kuan <saoikuan@gmail.com> |
|---|---|
| Date | 2020-03-19 07:30 +0100 |
| Subject | Questions about including tests/ directory into package |
| Message-ID | <zLWQO-zz-3@gated-at.bofh.it> |
Hi,
I'm newcomer to Debian packaging, and trying to add the autopkgtest
test script into python-tinyalign[1].
[1] https://salsa.debian.org/med-team/python-tinyalign
And now I'm facing a (maybe simple) problem.
The upstream test files are located in tests/ directory, but seems
this directory is excluded during packaging.
I have no idea how to include this tests/ directory.
1. Please let me know is there any variable for including the specific
file/directory.
2. Why and when the tests/ directory excluded? I tried to find the
logic in dh-python [2], but failed.
[2] https://salsa.debian.org/python-team/tools/dh-python
3. Is this a correct approach for including the excluded test materials?
Always appreciates.
Sincerely,
Sao I Kuan
saoikuan@gmail.com
[toc] | [next] | [standalone]
| From | Diane Trout <diane@ghic.org> |
|---|---|
| Date | 2020-03-19 19:00 +0100 |
| Message-ID | <zM7Cx-734-3@gated-at.bofh.it> |
| In reply to | #12369 |
On Thu, 2020-03-19 at 15:22 +0900, Sao I Kuan wrote: > Hi, > > I'm newcomer to Debian packaging, and trying to add the autopkgtest > test script into python-tinyalign[1]. > > [1] https://salsa.debian.org/med-team/python-tinyalign > > And now I'm facing a (maybe simple) problem. > > The upstream test files are located in tests/ directory, but seems > this directory is excluded during packaging. > I have no idea how to include this tests/ directory. The way I solved that problem in a similar package was this Test-Command: set -e ; for py in $(py3versions -r 2>/dev/null) ; do cd tests ; echo "Testing with $py in $(pwd):" ; http_proxy= $py -m pytest -v --pyargs ; done Depends: @, python3-all, python3-pytest The goal of autopkgtests is to test the installed package, when autopkgtest starts running it defaults to starting in the extracted copy of the source package. The goal is to make sure you test the copy in /usr/lib/python*/dist- packages. So I assumed if cd-ed into the tests directory the package source module wouldn't be available to the test runner. I did make the assumption that none of the tests messed with the python path to look in the parent directory... If that's a problem, maybe copy the contents of tests/ to $AUTOPKGTEST_TMP and run the tests there. Hope that helps, Diane
[toc] | [prev] | [next] | [standalone]
| From | Sao I Kuan <saoikuan@gmail.com> |
|---|---|
| Date | 2020-03-20 12:30 +0100 |
| Message-ID | <zMo0F-oY-5@gated-at.bofh.it> |
| In reply to | #12370 |
On Fri, Mar 20, 2020 at 2:38 AM Diane Trout <diane@ghic.org> wrote: > The way I solved that problem in a similar package was this > > Test-Command: set -e > ; for py in $(py3versions -r 2>/dev/null) > ; do cd tests > ; echo "Testing with $py in $(pwd):" > ; http_proxy= $py -m pytest -v --pyargs > ; done > Depends: @, python3-all, python3-pytest > > The goal of autopkgtests is to test the installed package, when > autopkgtest starts running it defaults to starting in the extracted > copy of the source package. > > The goal is to make sure you test the copy in /usr/lib/python*/dist- > packages. So I assumed if cd-ed into the tests directory the package > source module wouldn't be available to the test runner. > > I did make the assumption that none of the tests messed with the python > path to look in the parent directory... Thanks, Diane. I tried with your given example, it really helped. A lot of appreciates. Thanks for your kind and deep explanation. Sincerely, Sao I Kuan saoikuan@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Sandro Tosi <morph@debian.org> |
|---|---|
| Date | 2020-03-21 00:50 +0100 |
| Message-ID | <zMzyN-7n2-13@gated-at.bofh.it> |
| In reply to | #12369 |
> packages=find_packages("src"),
>
> Setuptools will only find "tinyalign" under the "src" folder, as a
> python module to package, which is why that's the only thing that is
> going to be packaged.
>
> IMO, the best approach to this problem is to convince upstream to move
> their tests folder into the Python package folder. Best is even to make
> upstream get rid of the "src" folder, rename that one "tinyalign" and
> put the tests folder in it. In other words, make upstream do:
that's not correct: the "src" directory is a very well know
best-practice (you can google for it, if you need references),
intended to avoid situations where "import mymodule" will have
inconsistent results depending on where you run that command and easy
of testing.
--
Sandro "morph" Tosi
My website: http://sandrotosi.me/
Me at Debian: http://wiki.debian.org/SandroTosi
Twitter: https://twitter.com/sandrotosi
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.maint.python
csiph-web