logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

autodep8 - DEP-8 test control file generator

Automatic Usage By Autopkgtest

       autodep8 can be automatically called by autopkgtest(1). To achieve that, you must set the Testsuite:
       field in the source package paragraph to autopkgtest-pkg-TYPE, where TYPE if one of package types
       supported by autodep8. The valid values of TYPE are listed below as the headings of the "EXAMPLES OF
       PRODUCED TEST CONTROL FILES" section.

       See the autopkgtest(1) documentation for more details.

Combining Auto-Generated Tests With Manually Specified Ones

       If `debian/tests/control` exists, autodep8 will prepend the contents of that file to its own output. In
       that case, autodep8 will exit with a status of 0 even if no known package type is detected. The same
       applies for `debian/tests/control.autodep8`, but the use of that file is deprecated because the test
       dependencies defined there aren't processed by dpkg-source.

Description

       autodep8 will detect well-known types of packages and generate DEP-8-compliant test control files for
       them. It can be used by DEP-8 implementations to support implicit test control files.

Examples Of Produced Test Control Files

dkms(kpatch)
           Test-Command: /usr/lib/dkms/dkms-autopkgtest
           Restrictions: needs-root, allow-stderr
           Depends: @, dkms

   elpa(flycheck)
           Test-Command: dh_elpa_test --autopkgtest
           Depends: @, @builddeps@
           Restrictions: rw-build-tree

   go(prometheus)
           Test-Command: /usr/bin/dh_golang_autopkgtest
           Depends: @, @builddeps@, dh-golang
           Restrictions: allow-stderr
           Architecture: !armhf

   nodejs(node-tar)
           Test-Command: /usr/share/pkg-js-autopkgtest/runner require
           Depends: @, pkg-js-autopkgtest
           Restrictions: superficial

           Test-Command: /usr/share/pkg-js-autopkgtest/runner
           Depends: @, @builddeps@, pkg-js-autopkgtest
           Restrictions: allow-stderr, skippable

   octave(octave-signal)
           Test-Command: DH_OCTAVE_TEST_ENV="xvfb-run -a" /usr/bin/dh_octave_check --use-installed-package
           Depends: @, octave-control (>= 3.1.0), dh-octave-autopkgtest (>= 0.5.6), xauth, xvfb
           Restrictions: allow-stderr

   perl(libtest-most-perl)
           Test-Command: /usr/share/pkg-perl-autopkgtest/runner build-deps
           Depends: @, @builddeps@, pkg-perl-autopkgtest
           Features: test-name=autodep8-perl-build-deps

           Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps
           Depends: @, pkg-perl-autopkgtest
           Features: test-name=autodep8-perl

           Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends
           Depends: @, pkg-perl-autopkgtest
           Restrictions: needs-recommends
           Features: test-name=autodep8-perl-recommends

   php(php-composer-semver)
           Test-Command: phpunit-autopkgtest
           Depends: @, phpunit, pkg-php-tools, @builddeps@,
           Restrictions: allow-stderr, skippable,
           Features: test-name=phpunit-autopkgtest

   pybuild(python-ofxclient)
           Test-Command: pybuild-autopkgtest
           Depends: @, pybuild-plugin-autopkgtest, @builddeps@,
           Restrictions: allow-stderr, skippable,
           Features: test-name=pybuild-autopkgtest

   python(python-flaky)
           Test-Command: set -e ; for py in $(py3versions -r 2>/dev/null) ; do cd "$AUTOPKGTEST_TMP" ; echo "Testing with $py:" ; $py -c "import flaky; print(flaky)" ; done
           Depends: python3-all, python3-flaky
           Restrictions: allow-stderr, superficial
           Features: test-name=autodep8-python3

           Test-Command: cd "$AUTOPKGTEST_TMP" ; pypy -c "import flaky; print flaky"
           Depends: pypy-flaky
           Restrictions: allow-stderr, superficial
           Features: test-name=autodep8-pypy

   r(r-cran-evaluate)
           Test-Command: /usr/share/dh-r/pkg-r-autopkgtest
           Depends: @, r-cran-testthat,r-cran-testthat-dbgsym,r-cran-lattice,r-cran-lattice-dbgsym,r-cran-ggplot2, pkg-r-autopkgtest
           Restrictions: allow-stderr

   ruby(ruby-sqlite3)
           Test-Command: gem2deb-test-runner --autopkgtest --check-dependencies 2>&1
           Depends: @, libsqlite3-dev,rake,ruby-hoe,ruby-minitest,ruby-redcloth, gem2deb-test-runner

How The Package Type Is Detected

autodep8 will first look for Testsuite:autopkgtest-pkg-TYPE field in debian/control. if TYPE is a known
       package type, then that is used. If not, each supported package type is tried against a set of
       heuristics, based on packages names, build dependencies. specific files under debian/, or a combination
       of those.

Name

       autodep8 - DEP-8 test control file generator

Package-Specific Configuration

       Packages can provide configuration for autodep8 in debian/tests/autopkgtest-pkg-${PACKAGETYPE}.conf. The
       file format is the following:

           # comment lines start with # and are ignored.
           # note that #'s only mark comments when in the beginning of the line
           # empty lines are also ignored

           # values are set in this format:
           var1=value1

           # spaces around the = sign are allowed
           var2 = value 2

           # backslashes allow one to set values that span multiple lines.
           # Note that the newline is removed in the final value, though
           # The following is equivalent to "multilinevar=value1, value2"
           multilinevar = value1, \
           value2

       The following configuration variables are supported:

   Allpackagetypesextra_depends: extra test dependencies to be added to the generated tests.  Will be included as-is in the
       generated control file.

       extra_restrictions: extra restrictions to be added to the generated tests.  Will be included as-is in the
       generated control file.

       architecture: Adds restrictions on what architecture the generated tests are suitable to run on.  Will be
       included as-is in the generated control file.

   octave(debian/tests/autopkgtest-pkg-octave.conf)test_env: value for the DH_OCTAVE_TEST_ENV environment variable that will be used when invoking
       dh_octave_check. The default value of DH_OCTAVE_TEST_ENV is "xvfb -a".

   python(debian/tests/autopkgtest-pkg-python.conf)import_name: name of the module to import, if it cannot be inferred from the name of the Debian package.
       For example, `python3-xlib` is used via `import Xlib`, so `import_name = Xlib` would be appropriate.
       This used to be configured by writing to `debian/tests/pkg-python/import-name`, but that is now
       deprecated.

Usage

           $ autodep8                 # assumes source package in current dir
           $ autodep8 /path/to/srcpkg # path to source package

       If a known package type is detected, autodep8 exits with 0 and prints the suggested contents of
       debian/tests/control to the standard output.

       If a known package type is NOT detected, autodep8 exits with 1 and produces not output.

See Also