diff --git a/test/integration/test_autocomplete.py b/test/integration/test_autocomplete.py index 7650e838b..07a598653 100644 --- a/test/integration/test_autocomplete.py +++ b/test/integration/test_autocomplete.py @@ -34,10 +34,17 @@ def bashrc(homedir): @pytest.fixture(scope="module") -def autocomplete_installed(request, env, homedir, bashrc, cli_version): - command = request.config.getoption('--sut') +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( - f'bash -i -c "{command} 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) @@ -66,11 +73,11 @@ def test_autocomplete_b2_commands(autocomplete_installed, is_running_on_docker, @skip_on_windows def test_autocomplete_b2_only_matching_commands( - autocomplete_installed, is_running_on_docker, shell, cli_version + autocomplete_installed, is_running_on_docker, shell, cli_command ): if is_running_on_docker: pytest.skip('Not supported on Docker') - shell.send(f'{cli_version} delete-\t\t') + shell.send(f'{cli_command} 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 @@ -85,12 +92,12 @@ def test_autocomplete_b2__download_file__b2uri( bucket_name, file_name, is_running_on_docker, - cli_version, + cli_command, ): """Test that autocomplete suggests bucket names and file names.""" if is_running_on_docker: pytest.skip('Not supported on Docker') - shell.send(f'{cli_version} download_file \t\t') + shell.send(f'{cli_command} download_file \t\t') shell.expect_exact("b2://", timeout=TIMEOUT) shell.send('b2://\t\t') shell.expect_exact(bucket_name, timeout=TIMEOUT)