Package: python-argcomplete
Version: 3.4.0-1
Severity: minor
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu oracular ubuntu-patch

Dear Maintainer,

The test-suite for python-argcomplete fails when the TERM variable is
set to "linux". This reproducible by invoking autopkgtest with
--env=TERM=linux (this is what we have in the Ubuntu infrastructure).

autopkgtest --env=TERM=linux python-argcomplete -- schroot unstable-amd64

133s ======================================================================
133s FAIL: test_special_characters_double_quoted 
(__main__.TestZshGlobalImplicit.test_special_characters_double_quoted)
133s ----------------------------------------------------------------------
133s Traceback (most recent call last):
133s   File "/tmp/autopkgtest.6mZKBg/autopkgtest_tmp/test/test.py", line 1261, 
in setUp
133s     self.assertEqual(output, "ready\r\n")
133s AssertionError: 'ready\r\n\x1b[m\x0f\x1b[27m\x1b[24m\x1b[J' != 'ready\r\n'
133s   ready
133s - ␛[m␏␛[27m␛[24m␛[J
133s +
133s
133s
133s ======================================================================
133s FAIL: test_special_characters_single_quoted 
(__main__.TestZshGlobalImplicit.test_special_characters_single_quoted)
133s ----------------------------------------------------------------------
133s Traceback (most recent call last):
133s   File "/tmp/autopkgtest.6mZKBg/autopkgtest_tmp/test/test.py", line 1261, 
in setUp
133s     self.assertEqual(output, "ready\r\n")
133s AssertionError: 'ready\r\n\x1b[m\x0f\x1b[27m\x1b[24m\x1b[J' != 'ready\r\n'
133s   ready
133s - ␛[m␏␛[27m␛[24m␛[J
133s +
133s
133s
133s ======================================================================
133s FAIL: test_unquoted_space 
(__main__.TestZshGlobalImplicit.test_unquoted_space)
133s ----------------------------------------------------------------------
133s Traceback (most recent call last):
133s   File "/tmp/autopkgtest.6mZKBg/autopkgtest_tmp/test/test.py", line 1261, 
in setUp
133s     self.assertEqual(output, "ready\r\n")
133s AssertionError: 'ready\r\n\x1b[m\x0f\x1b[27m\x1b[24m\x1b[J' != 'ready\r\n'
133s   ready
133s - ␛[m␏␛[27m␛[24m␛[J
133s +
133s
133s
133s ======================================================================
133s FAIL: test_wordbreak_chars 
(__main__.TestZshGlobalImplicit.test_wordbreak_chars)
133s ----------------------------------------------------------------------
133s Traceback (most recent call last):
133s   File "/tmp/autopkgtest.6mZKBg/autopkgtest_tmp/test/test.py", line 1261, 
in setUp
133s     self.assertEqual(output, "ready\r\n")
133s AssertionError: 'ready\r\n\x1b[m\x0f\x1b[27m\x1b[24m\x1b[J' != 'ready\r\n'
133s   ready
133s - ␛[m␏␛[27m␛[24m␛[J
133s +
133s
133s
133s ----------------------------------------------------------------------
133s Ran 189 tests in 75.390s
133s
133s FAILED (failures=68, skipped=12, expected failures=5)

It does not directly affect Debian today because the autopkgtest
invocation is different, but having the test-suite fail when environment
variables are set/unset usually provides a bad experience.

I forwarded the patch upstream at:

https://github.com/kislyuk/argcomplete/pull/497

Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers noble-updates
  APT policy: (500, 'noble-updates'), (500, 'noble-security'), (500, 'noble'), 
(100, 'noble-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.8.0-39-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.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 python-argcomplete-3.4.0/debian/patches/series 
python-argcomplete-3.4.0/debian/patches/series
--- python-argcomplete-3.4.0/debian/patches/series      2024-06-17 
13:47:04.000000000 +0200
+++ python-argcomplete-3.4.0/debian/patches/series      2024-08-01 
18:33:31.000000000 +0200
@@ -1,3 +1,4 @@
 py3k-tests.patch
 tests_pip_fix.patch
 python-argcomplete-check-easy-install-script_help_fix.patch
+tests-mock-TERM.patch
diff -Nru python-argcomplete-3.4.0/debian/patches/tests-mock-TERM.patch 
python-argcomplete-3.4.0/debian/patches/tests-mock-TERM.patch
--- python-argcomplete-3.4.0/debian/patches/tests-mock-TERM.patch       
1970-01-01 01:00:00.000000000 +0100
+++ python-argcomplete-3.4.0/debian/patches/tests-mock-TERM.patch       
2024-08-01 18:33:31.000000000 +0200
@@ -0,0 +1,22 @@
+Description: Fix zsh-related tests failure when TERM variable is set
+ When running zsh-related tests in the Ubuntu autopkgtest infrastructure, the
+ TERM environment variable is set to "linux". This causes the test-suite to
+ fail because zsh's output is impact by the TERM variable. We now override the
+ variable when running the zsh-related tests to make the test-suite pass.
+Author: Olivier Gayot <olivier.ga...@canonical.com>
+Bug: https://github.com/kislyuk/argcomplete/issues/496
+Bug-Ubuntu: https://launchpad.net/bugs/2075572
+Forwarded: https://github.com/kislyuk/argcomplete/pull/497
+Last-Update: 2024-08-02
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/test/test.py
++++ b/test/test.py
+@@ -65,6 +65,7 @@
+ 
+ def _repl_sh(command, args, non_printable_insert):
+     os.environ["PS1"] = "$"
++    os.environ["TERM"] = ""
+     child = pexpect.spawn(command, args, echo=False, encoding="utf-8")
+     ps1 = PEXPECT_PROMPT[:5] + non_printable_insert + PEXPECT_PROMPT[5:]
+     ps2 = PEXPECT_CONTINUATION_PROMPT[:5] + non_printable_insert + 
PEXPECT_CONTINUATION_PROMPT[5:]

Reply via email to