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

pbuilder and debhelper: Test suite run before dependencies satisfied



Howdy mentors,

Why does 'dh build' attempt to run the package's test suite, but
doesn't satisfy the run-time dependencies before doing so? How can
this be made to work within a pbuilder environment?


I'm packaging a Python application that has a unit test suite. This
unit test suite, naturally, imports each of the modules in the
application in order to test them. That, in turn, causes any of the
'import bar' statements in the application to be executed. So, the
unit test suite will fail in the absence of any one of the package's
Python library dependencies.

Yet, when I attempt to 'pdebuild' this package, it runs the 'build'
target of 'debian/rules', which runs 'dh build', which runs
'dh_auto_test', which runs the application unit test suite. At this
point in the process, though, the pbuilder environment does not have
the package dependencies installed, so the unit test suite fails,
failing the 'pdebuild'.

Running 'debian/rules build' shouldn't need the package dependencies
installed, because the package isn't being installed yet, only built
into a Debian binary package. So why is the package unit test suite
run from 'dh build'? Isn't this going to be a problem for every
package that has a unit test suite?


One possible response would be to list every run-time library
dependency as a build dependency, but that seems ludicrous; those
libraries aren't needed to build the package, they're only needed when
running the application (whether under test or not).

Another possibility would be to suppress the 'dh_auto_test', but I
don't want to change the way debhelper operates without a very good
reason. So far all I have is the fact that it's getting in my way, but
that could well be my fault.

How is this supposed to work?

-- 
 \            “Beware of bugs in the above code; I have only proved it |
  `\                 correct, not tried it.” —Donald Knuth, 1977-03-29 |
_o__)                                                                  |
Ben Finney


Reply to: