From cf0921be4ad01fc644358a3e99680be5f238bfa7 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Mon, 10 Jul 2023 14:39:58 +0200 Subject: [PATCH] #1248: Check for multiple patterns in functional tests --- tests/functional/plots.py | 12 +++++++----- tests/functional/test_bash.py | 2 +- tests/functional/test_zsh.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/functional/plots.py b/tests/functional/plots.py index 131e4c3..60c68a7 100644 --- a/tests/functional/plots.py +++ b/tests/functional/plots.py @@ -20,10 +20,12 @@ def with_confirmation(proc, TIMEOUT): assert proc.expect([TIMEOUT, u'test']) -def history_changed(proc, TIMEOUT, to): +def history_changed(proc, TIMEOUT, *to): """Ensures that history changed.""" proc.send('\033[A') - assert proc.expect([TIMEOUT, to]) + pattern = [TIMEOUT] + pattern.extend(to) + assert proc.expect(pattern) def history_not_changed(proc, TIMEOUT): @@ -44,14 +46,14 @@ def select_command_with_arrows(proc, TIMEOUT): proc.send('\033[B') assert proc.expect([TIMEOUT, u'git push']) proc.send('\033[B') - assert proc.expect([TIMEOUT, u'git help']) + assert proc.expect([TIMEOUT, u'git help', u'git hook']) proc.send('\033[A') assert proc.expect([TIMEOUT, u'git push']) proc.send('\033[B') - assert proc.expect([TIMEOUT, u'git help']) + assert proc.expect([TIMEOUT, u'git help', u'git hook']) proc.send('\n') - assert proc.expect([TIMEOUT, u'usage']) + assert proc.expect([TIMEOUT, u'usage', u'fatal: not a git repository']) def refuse_with_confirmation(proc, TIMEOUT): diff --git a/tests/functional/test_bash.py b/tests/functional/test_bash.py index 7fb988e..489ca25 100644 --- a/tests/functional/test_bash.py +++ b/tests/functional/test_bash.py @@ -45,7 +45,7 @@ def test_with_confirmation(proc, TIMEOUT): @pytest.mark.functional def test_select_command_with_arrows(proc, TIMEOUT): select_command_with_arrows(proc, TIMEOUT) - history_changed(proc, TIMEOUT, u'git help') + history_changed(proc, TIMEOUT, u'git help', u'git hook') @pytest.mark.functional diff --git a/tests/functional/test_zsh.py b/tests/functional/test_zsh.py index f267e24..a6c2733 100644 --- a/tests/functional/test_zsh.py +++ b/tests/functional/test_zsh.py @@ -43,7 +43,7 @@ def test_with_confirmation(proc, TIMEOUT): @pytest.mark.functional def test_select_command_with_arrows(proc, TIMEOUT): select_command_with_arrows(proc, TIMEOUT) - history_changed(proc, TIMEOUT, u'git help') + history_changed(proc, TIMEOUT, u'git help', u'git hook') @pytest.mark.functional