Skip to content

Commit

Permalink
#61 Added cli_args fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Oct 8, 2024
1 parent e5b282b commit c82b07e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions pytest-extension/exasol/pytest_extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,17 @@ def bucketfs_std_params(backend,
to the BucketFS on either DockerDB or SaaS test database.
"""
if backend == BACKEND_ONPREM:
return onprem_bucketfs_std_params
bfs_std_params = onprem_bucketfs_std_params
elif backend == BACKEND_SAAS:
return saas_std_params
bfs_std_params = saas_std_params
else:
ValueError(f'Unknown backend {backend}')

# Work around for the bug in PEC (Issue#78 - no default for the StdParams.path_in_bucket)
if StdParams.path_in_bucket.name not in bfs_std_params:
bfs_std_params[StdParams.path_in_bucket.name] = ''
return bfs_std_params


def _cli_params_to_args(cli_params) -> str:
def arg_string(k: str, v: Any):
Expand All @@ -180,8 +185,14 @@ def bucketfs_cli_args(bucketfs_std_params) -> str:
"""
CLI argument string for testing a command that involves connecting to the BucketFS .
"""
cli_args = _cli_params_to_args(bucketfs_std_params)
# Work around for the bug in PEC (Issue#78 - no default for the StdParams.path_in_bucket)
if StdParams.path_in_bucket not in bucketfs_std_params:
cli_args += f' --{StdParams.path_in_bucket.name.replace("_", "-")} ""'
return cli_args
return _cli_params_to_args(bucketfs_std_params)


def cli_args(database_std_params, bucketfs_std_params):
"""
CLI argument string for testing a command that involves connecting to both
the database and the BucketFS.
"""
std_params = dict(database_std_params)
std_params.update(bucketfs_std_params)
return _cli_params_to_args(database_std_params)

0 comments on commit c82b07e

Please sign in to comment.