Source: borgbackup2 Followup-For: Bug #1110195 X-Debbugs-Cc: [email protected]
Attached is said patch, I'll also be uploading it to Ubuntu. -- System Information: Debian Release: trixie/sid APT prefers plucky-updates APT policy: (500, 'plucky-updates'), (500, 'plucky-security'), (500, 'plucky'), (100, 'plucky-proposed') Architecture: amd64 (x86_64) Kernel: Linux 6.14.0-24-generic (SMP w/12 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
diff -Nru borgbackup2-2.0.0b18/debian/changelog borgbackup2-2.0.0b18/debian/changelog --- borgbackup2-2.0.0b18/debian/changelog 2025-07-18 12:45:37.000000000 +0200 +++ borgbackup2-2.0.0b18/debian/changelog 2025-07-31 19:30:53.000000000 +0200 @@ -1,3 +1,9 @@ +borgbackup2 (2.0.0b18-3) UNRELEASED; urgency=medium + + * fix running unit tests in autopkgtests (Closes: #1110195, LP: #2118916) + + -- Simon Chopin <[email protected]> Thu, 31 Jul 2025 19:30:53 +0200 + borgbackup2 (2.0.0b18-2) unstable; urgency=medium * Merge borgbackup 1.4.1-4 diff -Nru borgbackup2-2.0.0b18/debian/patches/0008-tests-tweak-some-unit-tests-when-using-the-installed.patch borgbackup2-2.0.0b18/debian/patches/0008-tests-tweak-some-unit-tests-when-using-the-installed.patch --- borgbackup2-2.0.0b18/debian/patches/0008-tests-tweak-some-unit-tests-when-using-the-installed.patch 1970-01-01 01:00:00.000000000 +0100 +++ borgbackup2-2.0.0b18/debian/patches/0008-tests-tweak-some-unit-tests-when-using-the-installed.patch 2025-07-31 19:07:59.000000000 +0200 @@ -0,0 +1,61 @@ +From: Simon Chopin <[email protected]> +Date: Thu, 31 Jul 2025 18:20:16 +0200 +Subject: tests: tweak some unit tests when using the installed testsuite + +In autopkgtests we want to test the installed code, but a couple of unit +tests assume (not unreasonably) that they're run from the source repo. + +We introduce a new environment variable that allows us to tweak a few +tests, either disabling them out-right or changing some of the paths to +point to the installed files. + +This is *very* Debian-specific, no need to push upstream. + +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/borgbackup2/+bug/2118916 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1110195 +Forwarded: not-needed +--- + src/borg/testsuite/shell_completions_test.py | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/borg/testsuite/shell_completions_test.py b/src/borg/testsuite/shell_completions_test.py +index 3ec3e71..46fa326 100644 +--- a/src/borg/testsuite/shell_completions_test.py ++++ b/src/borg/testsuite/shell_completions_test.py +@@ -1,14 +1,19 @@ + import subprocess ++import os + from pathlib import Path + + import pytest + ++INSTALLED = os.environ.get("TEST_INSTALLED_CODE") == "1" + SHELL_COMPLETIONS_DIR = Path(__file__).parent / ".." / ".." / ".." / ".." / ".." / "scripts" / "shell_completions" + + + def test_bash_completion_is_valid(): + """Test that the bash completion file is valid bash syntax.""" +- bash_completion_file = SHELL_COMPLETIONS_DIR / "bash" / "borg" ++ if INSTALLED: ++ bash_completion_file = Path("/usr/share/bash-completion/completions/borg2") ++ else: ++ bash_completion_file = SHELL_COMPLETIONS_DIR / "bash" / "borg" + assert bash_completion_file.is_file() + + # Check if bash is available +@@ -22,6 +27,7 @@ def test_bash_completion_is_valid(): + assert result.returncode == 0, f"Bash completion file has syntax errors: {result.stderr.decode()}" + + [email protected](INSTALLED, reason="not installed in Debian") + def test_fish_completion_is_valid(): + """Test that the fish completion file is valid fish syntax.""" + fish_completion_file = SHELL_COMPLETIONS_DIR / "fish" / "borg.fish" +@@ -38,6 +44,7 @@ def test_fish_completion_is_valid(): + assert result.returncode == 0, f"Fish completion file has syntax errors: {result.stderr.decode()}" + + [email protected](INSTALLED, reason="not installed in Debian") + def test_zsh_completion_is_valid(): + """Test that the zsh completion file is valid zsh syntax.""" + zsh_completion_file = SHELL_COMPLETIONS_DIR / "zsh" / "_borg" diff -Nru borgbackup2-2.0.0b18/debian/patches/series borgbackup2-2.0.0b18/debian/patches/series --- borgbackup2-2.0.0b18/debian/patches/series 2025-07-18 12:45:02.000000000 +0200 +++ borgbackup2-2.0.0b18/debian/patches/series 2025-07-31 18:24:38.000000000 +0200 @@ -5,3 +5,4 @@ explicit_version.patch manifest-data-files.patch fix-testsuite-shell.patch +0008-tests-tweak-some-unit-tests-when-using-the-installed.patch diff -Nru borgbackup2-2.0.0b18/debian/tests/unit borgbackup2-2.0.0b18/debian/tests/unit --- borgbackup2-2.0.0b18/debian/tests/unit 2025-07-18 12:40:21.000000000 +0200 +++ borgbackup2-2.0.0b18/debian/tests/unit 2025-07-31 18:51:51.000000000 +0200 @@ -27,8 +27,10 @@ echo export PATH="$PATH" >> ~/.profile echo "Running the unit test suite ..." + +TEST_INSTALLED_CODE=1 \ +PYTHONPATH=/usr/lib/borgbackup2 \ pytest \ -n auto -rs \ - --cov=borg --cov-config=.coveragerc \ --benchmark-skip \ --pyargs borg.testsuite diff -Nru borgbackup2-2.0.0b18/debian/tests/unit-nofuse borgbackup2-2.0.0b18/debian/tests/unit-nofuse --- borgbackup2-2.0.0b18/debian/tests/unit-nofuse 2025-07-18 12:40:21.000000000 +0200 +++ borgbackup2-2.0.0b18/debian/tests/unit-nofuse 2025-07-31 18:51:51.000000000 +0200 @@ -27,8 +27,10 @@ echo export PATH="$PATH" >> ~/.profile echo "Running the unit test suite ..." + +TEST_INSTALLED_CODE=1 \ +PYTHONPATH=/usr/lib/borgbackup2 \ pytest \ -n auto -rs \ - --cov=borg --cov-config=.coveragerc \ --benchmark-skip \ --pyargs borg.testsuite

