summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:54:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 20:04:14 +0000
commit04ed2a5ec67fdd72a4113ba7e14968281f5f7312 (patch)
treea3ac1ed1972e7dff14e3f76fa85383b0fc5a3f5e /debian/tests
parentAdding upstream version 0.1.21. (diff)
downloaddebputy-04ed2a5ec67fdd72a4113ba7e14968281f5f7312.tar.xz
debputy-04ed2a5ec67fdd72a4113ba7e14968281f5f7312.zip
Adding debian version 0.1.21.debian/0.1.21
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control19
-rwxr-xr-xdebian/tests/debputy-cli49
-rwxr-xr-xdebian/tests/debputy-cli-lint-lsp6
-rwxr-xr-xdebian/tests/debputy-py.test33
4 files changed, 107 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..642bb5c
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,19 @@
+Tests: debputy-py.test
+Restrictions: allow-stderr
+Depends:
+ @,
+ python3-pytest,
+ python3-lsprotocol,
+ python3-all,
+# debputy loads the library directly for one of the tests.
+ libcap2,
+
+Tests: debputy-cli
+Restrictions: allow-stderr, superficial
+Depends: @
+
+Tests: debputy-cli-lint-lsp
+Restrictions: allow-stderr, superficial
+Depends:
+ @,
+ python3-lsprotocol,
diff --git a/debian/tests/debputy-cli b/debian/tests/debputy-cli
new file mode 100755
index 0000000..cf52f7d
--- /dev/null
+++ b/debian/tests/debputy-cli
@@ -0,0 +1,49 @@
+#!/bin/sh
+set -e -u -x
+
+debputy --no-pager --help
+debputy --no-pager check-manifest
+
+debputy --no-pager plugin --help
+debputy --no-pager plugin list --help
+
+debputy --no-pager plugin list
+debputy --no-pager plugin list plugins
+debputy --no-pager plugin list ppf
+debputy --no-pager plugin list uppf
+debputy --no-pager plugin list manifest-variables
+debputy --no-pager plugin list manifest-variables --show-all-variables
+debputy --no-pager plugin list pmr
+debputy --no-pager plugin list automatic-discard-rules
+debputy --no-pager plugin list a-d-r
+
+
+debputy --no-pager plugin show ppf changelog
+debputy --no-pager plugin show ppf debian/changelog
+debputy --no-pager plugin show ppf service
+
+debputy --no-pager plugin show pmr --help
+
+echo "Checking installations manifest rules"
+for rule in install install-docs install-man discard ; do
+ debputy --no-pager plugin show pmr "${rule}"
+done
+
+echo "Checking binary package transformations manifest rules"
+for rule in TransformationRule::remove move create-symlink path-metadata create-directories \
+ run-build-time-tests arch-matches not build-profiles-matches cross-compiling \
+ binary-version definitions variables ::definitions definitions::variables ::; do
+ debputy --no-pager plugin show pmr "${rule}"
+done
+
+for variable in DEB_SOURCE token:TAB DEB_HOST_ARCH DEB_BUILD_ARCH; do
+ debputy --no-pager plugin show manifest-variables "${variable}"
+done
+
+for rule in python-cache-files la-files backup-files version-control-paths gnu-info-dir-file debian-dir doxygen-cruft-files; do
+ debputy --no-pager plugin show automatic-discard-rules "${rule}"
+done
+
+debputy --no-pager tool-support annotate-debian-directory
+debputy --no-pager tool-support export-reference-data --output-format=json
+debputy --no-pager tool-support export-reference-data file-categories
diff --git a/debian/tests/debputy-cli-lint-lsp b/debian/tests/debputy-cli-lint-lsp
new file mode 100755
index 0000000..c808abe
--- /dev/null
+++ b/debian/tests/debputy-cli-lint-lsp
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e -u -x
+
+debputy lint --no-linter-exit-code
+debputy lsp editor-config emacs
+debputy lsp editor-config vim
diff --git a/debian/tests/debputy-py.test b/debian/tests/debputy-py.test
new file mode 100755
index 0000000..640e84b
--- /dev/null
+++ b/debian/tests/debputy-py.test
@@ -0,0 +1,33 @@
+#!/bin/sh
+set -e -u -x
+mkdir "${AUTOPKGTEST_TMP}/debian"
+cp -r pyproject.toml tests/ "${AUTOPKGTEST_TMP}"
+cp -a debian/control "${AUTOPKGTEST_TMP}/debian"
+export PYTHONWARNINGS=d
+# This is a lie, but the debputy test framework will restrict certain
+# plugin loading methods otherwise and that will neuter our ability to
+# test the plugin test framework itself. To avoid issues, we do the
+# dance below to ensure that py.test will not see the source version
+# of debputy (and accordingly cannot use the uninstalled version by
+# mistake).
+export DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS=uninstalled
+DEBPUTY_PYTHONPATH=/usr/share/dh-debputy
+PYTHOHPATH=${PYTHOHPATH:-}
+if [ "${PYTHOHPATH:-}" ]; then
+ PYTHOHPATH="${DEBPUTY_PYTHONPATH}:${PYTHOHPATH}"
+else
+ PYTHOHPATH="${DEBPUTY_PYTHONPATH}"
+fi
+
+export DEBPUTY_REQUIRE_LIBCAP=1
+
+cd "${AUTOPKGTEST_TMP}/"
+
+for py in $(py3versions -s); do
+ echo "----------------------------------------------"
+ echo "Testing with $py"
+ echo "----------------------------------------------"
+ # text mode file opening is locale dependent so try both ASCII and UTF-8
+ PYTHONPATH="${PYTHOHPATH}" LC_ALL=C $py -m pytest
+ PYTHONPATH="${PYTHOHPATH}" LC_ALL=C.UTF-8 $py -m pytest
+done