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

Re: When packaging a library, should I prevent its test suite from being packaged



On Tue, 9 Sep 2014 17:28:25 +0200
Piotr Ożarowski <piotr@debian.org> wrote:

> [Konstantin Khomoutov, 2014-09-09]
> > This library includes a test suite, in a subdirectory named "tests",
> > within its source tree.  This directory gets packaged, installed and
> > byte-compiled (by the generated postinst script) during the
> > installation.
> > 
> > Having the test suite packaged along with the code looks like having
> > not much sense to me, so should I try to exclude this subdirectory
> > from packaging?  Is it considered a bad practice?  I don't have much
> > familiarity with Python, let alone packaging its libraries, so I'm
> > not sure if removing such files will break the library or not and
> > what seasoned Python packagers do in cases like this.
> 
> if it is installed  as .../dist-packages/tests, then remove¹ it and
> report bug upstream (to move it to pymysql/tests)
> (I will remove all .../dist-packages/test{,s} by default in next
> dh_python{2,3} version).
> 
> If it is installed as .../dist-packages/pymysq/tests and doesn't
> contain anything other than .py files, then leave it. It will be
> useful while running runtime tests (f.e. in autopkgtest)

The library appears to be well-behaving and installs its tests under
its own directory, that is, in .../dist-packages/pymysq/tests.

> [¹] export PYBUILD_AFTER_INSTALL=rm -r {install_dir}/tests

Thanks, that worked.
But based on the insight provided by you and others, I'm inclined to
revert this change and let the test files be installed.

One minor thing remains with this test suite though: after fixing it to
work with Python 3.2 (Wheezy's; the test suite uses those u"" no-op
prefixes for some Unicode literals, which were not present in 3.2) I
have discovered the tests attempt to connect to a MySQL instance on
the localhost, and authenticate there as the user "root" using no
password.  So it seems that the test suite either expects a certain
setup to be present to have a sensible run or has some knobs for the
user to tweak up front...  What I'm leading to, it that in the
library's present state, it's hard to decide whether these tests are
really useful because you can't "just run" them.  I understand that
this is a rather philosophical question though so I'm communicating
this mostly for amusement.

Thanks to all who replied!


Reply to: