Apply patches from upstream regarding zsh tests

This commit is contained in:
Sandro 2023-11-25 16:34:35 +01:00
parent 7c333947b4
commit 1c8ddc7419
No known key found for this signature in database
GPG Key ID: 68D0FF74FE9F382A
3 changed files with 74 additions and 1 deletions

48
464.patch Normal file
View File

@ -0,0 +1,48 @@
From 77aac68d8b50df0d63e3670755afad5c3e5c7eec Mon Sep 17 00:00:00 2001
From: Evan <evanunderscore@gmail.com>
Date: Sat, 25 Nov 2023 21:23:16 +1100
Subject: [PATCH] Add sanity check to shell tests
---
test/test.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/test/test.py b/test/test.py
index c89912a6..d94e55ac 100755
--- a/test/test.py
+++ b/test/test.py
@@ -8,6 +8,7 @@
import subprocess
import sys
import unittest
+import unittest.util
from io import StringIO
from tempfile import NamedTemporaryFile, TemporaryFile, mkdtemp
@@ -33,6 +34,9 @@
from argcomplete.completers import DirectoriesCompleter, FilesCompleter, SuppressCompleter # noqa: E402
from argcomplete.lexers import split_line # noqa: E402
+# Default max length is insufficient for troubleshooting.
+unittest.util._MAX_LENGTH = 1000
+
IFS = "\013"
COMP_WORDBREAKS = " \t\n\"'><=;|&(:"
@@ -1239,12 +1243,16 @@ def test_comp_point(self):
class TestBashZshBase(TestShellBase):
+ maxDiff = None
+
# 'dummy' argument unused; checks multi-command registration works
# by passing 'prog' as the second argument.
install_cmd = 'eval "$(register-python-argcomplete dummy prog)"'
def setUp(self):
sh = self.repl_provider()
+ output = sh.run_command("echo ready")
+ self.assertEqual(output, "ready\r\n")
path = ":".join([os.path.join(BASE_DIR, "scripts"), TEST_DIR, "$PATH"])
sh.run_command("export PATH={0}".format(path))
sh.run_command("export PYTHONPATH={0}".format(BASE_DIR))

View File

@ -0,0 +1,22 @@
From 9c022cb2addcc3fb92fedc5ac10c9266bd816207 Mon Sep 17 00:00:00 2001
From: Evan <evanunderscore@gmail.com>
Date: Sun, 26 Nov 2023 03:06:56 +1100
Subject: [PATCH] Work around trailing null characters
---
test/test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test.py b/test/test.py
index d94e55a..2acba32 100755
--- a/test/test.py
+++ b/test/test.py
@@ -54,7 +54,7 @@ def run_command(self, command, **kwargs):
raise Exception("Expected to see a newline in command response")
echo_cmd, actual_res = res.split("\n", 1)
res_without_ansi_seqs = re.sub(r"\x1b\[0m.+\x1b\[J", "", actual_res)
- return res_without_ansi_seqs
+ return res_without_ansi_seqs.rstrip('\x00')
else:
return res

View File

@ -6,7 +6,7 @@
%endif
# Enable all tests (requires check to be true)
%bcond all_tests 0
%bcond all_tests 1
Name: python-argcomplete
Summary: Bash tab completion for argparse
@ -15,6 +15,9 @@ Release: %autorelease
License: Apache-2.0
URL: https://github.com/kislyuk/argcomplete
Source0: %pypi_source argcomplete
# https://github.com/kislyuk/argcomplete/issues/447
Patch: https://patch-diff.githubusercontent.com/raw/kislyuk/argcomplete/pull/464.patch
Patch: https://github.com/kislyuk/argcomplete/commit/9c022cb2addcc3fb92fedc5ac10c9266bd816207.patch
BuildRequires: python3-devel