Skip to content

Commit

Permalink
Make can_connect private
Browse files Browse the repository at this point in the history
  • Loading branch information
jl-wynen committed Jan 19, 2024
1 parent c637477 commit d34272c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/scitacean/testing/sftp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,13 @@ def test_sftp_upload(
IgnorePolicy,
SFTPAccess,
SFTPUser,
can_connect,
configure,
local_access,
wait_until_sftp_server_is_live,
)

__all__ = [
"add_pytest_option",
"can_connect",
"configure",
"local_access",
"sftp_enabled",
Expand Down
6 changes: 3 additions & 3 deletions src/scitacean/testing/sftp/_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def configure(target_dir: Union[Path, str]) -> Path:
return config_target


def can_connect(sftp_access: SFTPAccess) -> bool:
def _can_connect(sftp_access: SFTPAccess) -> bool:
try:
_make_client(sftp_access)
except paramiko.SSHException:
Expand All @@ -121,10 +121,10 @@ def wait_until_sftp_server_is_live(
) -> None:
# The container takes a while to be fully live.
for _ in range(n_tries):
if can_connect(sftp_access):
if _can_connect(sftp_access):
return
time.sleep(max_time / n_tries)
if not can_connect(sftp_access):
if not _can_connect(sftp_access):
raise RuntimeError("Cannot connect to SFTP server")


Expand Down
2 changes: 0 additions & 2 deletions src/scitacean/testing/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,13 @@ def test_ssh_upload(
IgnorePolicy,
SSHAccess,
SSHUser,
can_connect,
configure,
local_access,
wait_until_ssh_server_is_live,
)

__all__ = [
"add_pytest_option",
"can_connect",
"configure",
"local_access",
"ssh_enabled",
Expand Down
6 changes: 3 additions & 3 deletions src/scitacean/testing/ssh/_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def configure(target_dir: Union[Path, str]) -> Path:
return config_target


def can_connect(ssh_access: SSHAccess) -> bool:
def _can_connect(ssh_access: SSHAccess) -> bool:
try:
_make_client(ssh_access)
except paramiko.SSHException:
Expand All @@ -111,10 +111,10 @@ def wait_until_ssh_server_is_live(
) -> None:
# The container takes a while to be fully live.
for _ in range(n_tries):
if can_connect(ssh_access):
if _can_connect(ssh_access):
return
time.sleep(max_time / n_tries)
if not can_connect(ssh_access):
if not _can_connect(ssh_access):
raise RuntimeError("Cannot connect to SSH server")


Expand Down

0 comments on commit d34272c

Please sign in to comment.