[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Questions about including tests/ directory into package



On 3/19/20 7:22 AM, 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.
> 
> 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

Hi,

Ah... how much I hate python and setuptools for being so liberal and let
every developer design its own thing... we end up with no standard, one
having to read setup.py, know all the internals of setuptools, and this
thread is one more collateral of that. :/

For this specific package, what's being packaged is what's found by
setup.py. In that file, you can see:

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:

mv src/tinyalign .
rmdir src
mv tests tinyalign
sed -i 's/packages=.*/packages=["tinyalign"],/' setup.py

Cheers,

Thomas Goirand (zigo)


Reply to: