.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "PYBUILD-AUTOPKGTEST" 1 "" "" .SH NAME pybuild-autopkgtest \- invokes the test suite against requested Python versions and installed packages .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 pybuild\-autopkgtest .UNINDENT .UNINDENT .SH OPTIONS .sp \fIpybuild\-autopkgtest\fP takes no options or arguments. All configuration is done via the same mechanisms you use to control \fIpybuild\fP itself, namely by having build dependencies on the right packages, or by setting \fIPYBUILD_*\fP environment variables in \fIdebian/rules\fP\&. .SH DESCRIPTION .sp \fIpybuild\-autopkgtest\fP is an autopkgtest test runner that reuses all the \fIpybuild\fP infrastructure to run tests against installed packages, as expected by autopkgtest. To enable \fIpybuild\-autopkgtest\fP for your package, you need to add \fBTestsuite: autopkgtest\-pkg\-pybuild\fP to the source stanza in \fIdebian/control\fP\&. This will cause autodep8(1) to produce the correct contents for \fIdebian/tests/control\fP\&. .sp \fIpybuild\-autopkgtest\fP will run the tests in exactly the same way as \fIpybuild\fP will during the build, with the exception that the tests are not run in the build directory. The test files are copied to a temporary directory, so that the tests will run against the installed Python modules, and not against anything in the source tree. .sp All the pybuild infrastructure is used, so for most packages you don\(aqt need to add any extra code configure for \fIpybuild\-autopkgtest\fP\&. For example, just having a \fIpython3\-pytest\fP as a build dependency is enough to make the test runner use \fIpytest\fP to run the tests. .sp The tests are executed via a temporary makefile that includes \fIdebian/rules\fP from the package, so that any environment variables defined there will also be available during autopkgtest, including but not limited to \fIPYBUILD_*\fP variables for configuring the behavior of \fIpybuild\fP itself. .SH ADOPTING PYBUILD-AUTOPKGTEST .sp Since \fIpybuild\-autopkgtest\fP reuses environment variables set in \fIdebian/rules\fP, migrating packages to use \fIpybuild\-autopkgtest\fP should not require much effort. .sp You might have a \fIdebian/tests/control\fP that duplicates what \fIpybuild\-autopkgtest\fP already does, e.g. copying the test files to a temporary directory, changing to it, and running the tests from there. Such test entries can usually be removed in favor of adding \fBTestsuite: autopkgtest\-pkg\-pybuild\fP to \fIdebian/control\fP\&. .sp In general, you want to move any test\-related command line arguments to pybuild into environment variables in \fIdebian/rules\fP\&. .sp You can also have specialized, manually\-written test cases, alongside the ones autogenerated by \fIautodep8\fP\&. For this, both set \fBTestsuite: autopkgtest\-pkg\-pybuild\fP in \fIdebian/control\fP and keep your custom tests in \fIdebian/tests/control\fP\&. .SH VARYING BEHAVIOR UNDER AUTOPKGTEST .sp Ideally, the behavior of the tests should be the same during the build and under autopkgtest, except for the fact that during autopkgtest the tests should load the code from the installed package. \fIpybuild\-autopkgtest\fP should do this correctly most of the time. .sp There are situations, however, in which you need a slightly different behavior during the autopkgtest run. There are a few mechanisms to support that: .INDENT 0.0 .IP \(bu 2 \fIpybuild\-autopkgtest\fP sets the \fIPYBUILD_AUTOPKGTEST\fP environment variable to \fI1\fP during the test run. This way, you can add conditional behavior in \fIdebian/rules\fP\&. .IP \(bu 2 Before and after running the tests, \fIpybuild\-autopkgtest\fP will call the \fIdebian/rules\fP targets \fIbefore\-pybuild\-autopkgtest\fP and \fIafter\-pybuild\-autopkgtest\fP, respectively, if they exist. .UNINDENT .SH SAMPLE TEST CONTROL FILE .sp The control file produced by autodep8(1) looks like this: .INDENT 0.0 .INDENT 3.5 .sp .EX Test\-Command: pybuild\-autopkgtest Depends: @, @builddeps@, Restrictions: allow\-stderr, skippable, Features: test\-name=pybuild\-autopkgtest .EE .UNINDENT .UNINDENT .sp You should never need to hardcode this in \fIdebian/tests/control\fP\&. You can add extra items to \fIRestrictions\fP and \fIDepends\fP by providing a configuration file for \fIautodep8\fP (\fIdebian/tests/autopkgtest\-pkg\-pybuild.conf\fP) like this: .INDENT 0.0 .INDENT 3.5 .sp .EX extra_depends=foo, bar extra_restrictions=isolation\-container, breaks\-testbed .EE .UNINDENT .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 pybuild(1) .IP \(bu 2 autopkgtest(1) .IP \(bu 2 autodep8(1) .UNINDENT .SH AUTHOR Antonio Terceiro, 2021 .\" Generated by docutils manpage writer. .