Skip to content

Commit

Permalink
Trying to ensure that no part of autocomplete is run on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
kkalinowski-reef committed Dec 18, 2023
1 parent ab4d142 commit d883298
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/integration/test_autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit d883298

Please sign in to comment.