summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRed_M <1468433+Red-M@users.noreply.github.com>2023-04-03 02:48:18 +1000
committerGitHub <noreply@github.com>2023-04-03 02:48:18 +1000
commit2532721644781543ca660e52d48a35bd93872fc1 (patch)
treeaaa0b5e0b8a30de11f18f24b489d479bd89e6535
parent06f4ed2be13b9209d1ac89c72bf4a19d550cc846 (diff)
parent000a8684bd109c3f9c9b5fabd95add4743b7f45a (diff)
downloadpexpect-master.tar.gz
Merge pull request #698 from stesser/masterHEADmaster
Make test_expect.py work on POSIX systems that are not Linux based
-rw-r--r--pexpect/bashrc.sh2
-rwxr-xr-xtests/test_expect.py6
-rw-r--r--tests/test_replwrap.py4
3 files changed, 8 insertions, 4 deletions
diff --git a/pexpect/bashrc.sh b/pexpect/bashrc.sh
index c734ac9..d75d1a5 100644
--- a/pexpect/bashrc.sh
+++ b/pexpect/bashrc.sh
@@ -14,3 +14,5 @@ PS1="$"
# Unset PROMPT_COMMAND, so that it can't change PS1 to something unexpected.
unset PROMPT_COMMAND
+
+bind 'set enable-bracketed-paste off'
diff --git a/tests/test_expect.py b/tests/test_expect.py
index c6d72da..c16e055 100755
--- a/tests/test_expect.py
+++ b/tests/test_expect.py
@@ -485,7 +485,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
def test_before_across_chunks(self):
# https://github.com/pexpect/pexpect/issues/478
child = pexpect.spawn(
- '''/bin/bash -c "openssl rand -base64 {} 2>/dev/null | head -500 | nl --number-format=rz --number-width=5 2>&1 ; echo 'PATTERN!!!'"'''.format(1024 * 1024 * 2),
+ '''/bin/sh -c "openssl rand -base64 {} 2>/dev/null | head -500 | nl -n rz -w 5 2>&1 ; echo 'PATTERN!!!'"'''.format(1024 * 1024 * 2),
searchwindowsize=128
)
child.expect(['PATTERN'])
@@ -530,7 +530,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
child = pexpect.spawn('cat', echo=False)
child.sendline('BEGIN')
for i in range(100):
- child.sendline('foo' * 100)
+ child.sendline('foo' * 10)
e = child.expect([b'xyzzy', pexpect.TIMEOUT],
searchwindowsize=10, timeout=0.001)
self.assertEqual(e, 1)
@@ -547,7 +547,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
child = pexpect.spawn('cat', echo=False)
child.sendline('BEGIN')
for i in range(100):
- child.sendline('foo' * 100)
+ child.sendline('foo' * 10)
e = child.expect([b'xyzzy', pexpect.TIMEOUT],
searchwindowsize=10, timeout=0.5)
self.assertEqual(e, 1)
diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py
index e29080d..9e95112 100644
--- a/tests/test_replwrap.py
+++ b/tests/test_replwrap.py
@@ -25,7 +25,7 @@ class REPLWrapTestCase(unittest.TestCase):
def test_bash(self):
bash = replwrap.bash()
- res = bash.run_command("alias")
+ res = bash.run_command("alias xyzzy=true; alias")
assert 'alias' in res, res
try:
@@ -92,7 +92,9 @@ class REPLWrapTestCase(unittest.TestCase):
"PS1='{0}' PS2='{1}' "
"PROMPT_COMMAND=''")
+ print(repl)
res = repl.run_command("echo $HOME")
+ print(res)
assert res.startswith('/'), res
def test_python(self):