From d22d13f027163c767ca0ff0f0a05141a948e50f9 Mon Sep 17 00:00:00 2001 From: Krzysztof Kalinowski Date: Tue, 19 Dec 2023 13:41:22 +0400 Subject: [PATCH] Revert "Removing apiver from autocomplete tests" This reverts commit 8f0be0d9a15b14a3f98fe9fdf2548cce023fe54e. --- test/integration/test_autocomplete.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/integration/test_autocomplete.py b/test/integration/test_autocomplete.py index 363fcd045..c877943e3 100644 --- a/test/integration/test_autocomplete.py +++ b/test/integration/test_autocomplete.py @@ -34,19 +34,24 @@ def bashrc(homedir): @pytest.fixture(scope="module") -def autocomplete_installed(env, homedir, bashrc, is_running_on_docker): +def cli_command(request) -> str: + return request.config.getoption('--sut') + + +@pytest.fixture(scope="module") +def autocomplete_installed(env, homedir, bashrc, cli_version, cli_command, is_running_on_docker): if is_running_on_docker: return shell = pexpect.spawn( - 'bash -i -c "b2 install-autocomplete"', env=env, logfile=sys.stderr.buffer + f'bash -i -c "{cli_command} install-autocomplete"', env=env, logfile=sys.stderr.buffer ) try: shell.expect_exact('Autocomplete successfully installed for bash', timeout=TIMEOUT) finally: shell.close() shell.wait() - assert (homedir / '.bash_completion.d' / 'b2').is_file() + assert (homedir / '.bash_completion.d' / cli_version).is_file() assert bashrc.read_text().startswith(BASHRC_CONTENT) @@ -59,20 +64,20 @@ def shell(env): @skip_on_windows -def test_autocomplete_b2_commands(autocomplete_installed, is_running_on_docker, shell): +def test_autocomplete_b2_commands(autocomplete_installed, is_running_on_docker, shell, cli_version): if is_running_on_docker: pytest.skip('Not supported on Docker') - shell.send('b2 \t\t') + shell.send(f'{cli_version} \t\t') shell.expect_exact(["authorize-account", "download-file", "get-bucket"], timeout=TIMEOUT) @skip_on_windows def test_autocomplete_b2_only_matching_commands( - autocomplete_installed, is_running_on_docker, shell + autocomplete_installed, is_running_on_docker, shell, cli_version ): if is_running_on_docker: pytest.skip('Not supported on Docker') - shell.send('b2 delete-\t\t') + shell.send(f'{cli_version} delete-\t\t') shell.expect_exact("file", timeout=TIMEOUT) # common part of remaining cmds is autocompleted with pytest.raises(pexpect.exceptions.TIMEOUT): # no other commands are suggested @@ -87,11 +92,12 @@ def test_autocomplete_b2__download_file__b2uri( bucket_name, file_name, is_running_on_docker, + cli_version, ): """Test that autocomplete suggests bucket names and file names.""" if is_running_on_docker: pytest.skip('Not supported on Docker') - shell.send('b2 download_file \t\t') + shell.send(f'{cli_version} download_file \t\t') shell.expect_exact("b2://", timeout=TIMEOUT) shell.send('b2://\t\t') shell.expect_exact(bucket_name, timeout=TIMEOUT)