pytest-exasol-extension 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- exasol/pytest_extension/__init__.py +59 -50
- exasol/pytest_extension/py.typed +0 -0
- exasol/pytest_extension/version.py +6 -5
- {pytest_exasol_extension-0.2.1.dist-info → pytest_exasol_extension-0.2.3.dist-info}/METADATA +6 -5
- pytest_exasol_extension-0.2.3.dist-info/RECORD +7 -0
- {pytest_exasol_extension-0.2.1.dist-info → pytest_exasol_extension-0.2.3.dist-info}/WHEEL +1 -1
- pytest_exasol_extension-0.2.1.dist-info/RECORD +0 -6
- {pytest_exasol_extension-0.2.1.dist-info → pytest_exasol_extension-0.2.3.dist-info}/entry_points.txt +0 -0
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import random
|
|
4
4
|
import string
|
|
5
|
+
from typing import (
|
|
6
|
+
Any,
|
|
7
|
+
Callable,
|
|
8
|
+
)
|
|
5
9
|
from urllib.parse import urlparse
|
|
10
|
+
|
|
6
11
|
import pyexasol
|
|
7
12
|
import pytest
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
from exasol.pytest_backend import (
|
|
14
|
+
BACKEND_ONPREM,
|
|
15
|
+
BACKEND_SAAS,
|
|
16
|
+
)
|
|
10
17
|
from exasol.python_extension_common.cli.std_options import StdParams
|
|
11
18
|
from exasol.python_extension_common.connections.bucketfs_location import (
|
|
12
|
-
create_bucketfs_conn_object_onprem,
|
|
19
|
+
create_bucketfs_conn_object_onprem,
|
|
20
|
+
create_bucketfs_conn_object_saas,
|
|
21
|
+
)
|
|
13
22
|
|
|
14
23
|
|
|
15
24
|
@pytest.fixture(scope="session")
|
|
@@ -20,13 +29,13 @@ def db_schema_name() -> str:
|
|
|
20
29
|
useful when looking at the test results. Otherwise, the schema name will be a
|
|
21
30
|
randomly generated string.
|
|
22
31
|
"""
|
|
23
|
-
return
|
|
32
|
+
return "".join(random.choice(string.ascii_uppercase) for _ in range(12))
|
|
24
33
|
|
|
25
34
|
|
|
26
35
|
@pytest.fixture(scope="session")
|
|
27
|
-
def pyexasol_connection(
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
def pyexasol_connection(
|
|
37
|
+
backend_aware_database_params, db_schema_name
|
|
38
|
+
) -> pyexasol.ExaConnection:
|
|
30
39
|
"""
|
|
31
40
|
The fixture provides a database connection. It opens the test schema,
|
|
32
41
|
creating it if it doesn't exist. In the latter case the schema gets
|
|
@@ -45,11 +54,10 @@ def pyexasol_connection(backend_aware_database_params,
|
|
|
45
54
|
conn.execute(f'DROP SCHEMA "{db_schema_name}" CASCADE')
|
|
46
55
|
|
|
47
56
|
|
|
48
|
-
@pytest.fixture(scope=
|
|
49
|
-
def bucketfs_connection_factory(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
) -> Callable[[str, str | None], None]:
|
|
57
|
+
@pytest.fixture(scope="session")
|
|
58
|
+
def bucketfs_connection_factory(
|
|
59
|
+
backend, pyexasol_connection, backend_aware_bucketfs_params
|
|
60
|
+
) -> Callable[[str, str | None], None]:
|
|
53
61
|
"""
|
|
54
62
|
This is a factory fixture that creates a bucket-fs connection object in a database.
|
|
55
63
|
It takes the following parameters:
|
|
@@ -59,76 +67,79 @@ def bucketfs_connection_factory(backend,
|
|
|
59
67
|
|
|
60
68
|
It will override any existing object with the same name.
|
|
61
69
|
"""
|
|
70
|
+
|
|
62
71
|
def func(conn_name: str, path_in_bucket: str | None = None) -> None:
|
|
63
72
|
if path_in_bucket:
|
|
64
73
|
bucketfs_params = dict(backend_aware_bucketfs_params)
|
|
65
|
-
bucketfs_params[
|
|
74
|
+
bucketfs_params["path"] = path_in_bucket
|
|
66
75
|
else:
|
|
67
76
|
bucketfs_params = backend_aware_bucketfs_params
|
|
68
77
|
if backend == BACKEND_ONPREM:
|
|
69
|
-
create_bucketfs_conn_object_onprem(
|
|
78
|
+
create_bucketfs_conn_object_onprem(
|
|
79
|
+
pyexasol_connection, conn_name, bucketfs_params
|
|
80
|
+
)
|
|
70
81
|
elif backend == BACKEND_SAAS:
|
|
71
|
-
create_bucketfs_conn_object_saas(
|
|
82
|
+
create_bucketfs_conn_object_saas(
|
|
83
|
+
pyexasol_connection, conn_name, bucketfs_params
|
|
84
|
+
)
|
|
72
85
|
else:
|
|
73
|
-
raise ValueError(f
|
|
86
|
+
raise ValueError(f"Unsupported backend {backend}")
|
|
74
87
|
|
|
75
88
|
return func
|
|
76
89
|
|
|
77
90
|
|
|
78
91
|
@pytest.fixture(scope="session")
|
|
79
|
-
def onprem_database_std_params(
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
def onprem_database_std_params(
|
|
93
|
+
use_onprem, backend_aware_onprem_database, exasol_config
|
|
94
|
+
) -> dict[str, Any]:
|
|
82
95
|
if use_onprem:
|
|
83
96
|
return {
|
|
84
|
-
StdParams.dsn.name: f
|
|
97
|
+
StdParams.dsn.name: f"{exasol_config.host}:{exasol_config.port}",
|
|
85
98
|
StdParams.db_user.name: exasol_config.username,
|
|
86
99
|
StdParams.db_password.name: exasol_config.password,
|
|
87
|
-
StdParams.use_ssl_cert_validation.name: False
|
|
100
|
+
StdParams.use_ssl_cert_validation.name: False,
|
|
88
101
|
}
|
|
89
102
|
return {}
|
|
90
103
|
|
|
91
104
|
|
|
92
105
|
@pytest.fixture(scope="session")
|
|
93
|
-
def onprem_bucketfs_std_params(
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
def onprem_bucketfs_std_params(
|
|
107
|
+
use_onprem, backend_aware_onprem_database, bucketfs_config
|
|
108
|
+
) -> dict[str, Any]:
|
|
96
109
|
if use_onprem:
|
|
97
110
|
parsed_url = urlparse(bucketfs_config.url)
|
|
98
111
|
host, port = parsed_url.netloc.split(":")
|
|
99
112
|
return {
|
|
100
113
|
StdParams.bucketfs_host.name: host,
|
|
101
114
|
StdParams.bucketfs_port.name: port,
|
|
102
|
-
StdParams.bucketfs_use_https.name: parsed_url.scheme.lower() ==
|
|
115
|
+
StdParams.bucketfs_use_https.name: parsed_url.scheme.lower() == "https",
|
|
103
116
|
StdParams.bucketfs_user.name: bucketfs_config.username,
|
|
104
117
|
StdParams.bucketfs_password.name: bucketfs_config.password,
|
|
105
|
-
StdParams.bucketfs_name.name:
|
|
106
|
-
StdParams.bucket.name:
|
|
107
|
-
StdParams.use_ssl_cert_validation.name: False
|
|
118
|
+
StdParams.bucketfs_name.name: "bfsdefault",
|
|
119
|
+
StdParams.bucket.name: "default",
|
|
120
|
+
StdParams.use_ssl_cert_validation.name: False,
|
|
108
121
|
}
|
|
109
122
|
return {}
|
|
110
123
|
|
|
111
124
|
|
|
112
125
|
@pytest.fixture(scope="session")
|
|
113
|
-
def saas_std_params(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
saas_account_id,
|
|
117
|
-
backend_aware_saas_database_id) -> dict[str, Any]:
|
|
126
|
+
def saas_std_params(
|
|
127
|
+
use_saas, saas_host, saas_pat, saas_account_id, backend_aware_saas_database_id
|
|
128
|
+
) -> dict[str, Any]:
|
|
118
129
|
if use_saas:
|
|
119
130
|
return {
|
|
120
131
|
StdParams.saas_url.name: saas_host,
|
|
121
132
|
StdParams.saas_account_id.name: saas_account_id,
|
|
122
133
|
StdParams.saas_database_id.name: backend_aware_saas_database_id,
|
|
123
|
-
StdParams.saas_token.name: saas_pat
|
|
134
|
+
StdParams.saas_token.name: saas_pat,
|
|
124
135
|
}
|
|
125
136
|
return {}
|
|
126
137
|
|
|
127
138
|
|
|
128
139
|
@pytest.fixture(scope="session")
|
|
129
|
-
def database_std_params(
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
def database_std_params(
|
|
141
|
+
backend, onprem_database_std_params, saas_std_params
|
|
142
|
+
) -> dict[str, Any]:
|
|
132
143
|
"""
|
|
133
144
|
This is a collection of StdParams parameters required to open a
|
|
134
145
|
database connection for either DockerDB or SaaS test database.
|
|
@@ -137,14 +148,13 @@ def database_std_params(backend,
|
|
|
137
148
|
return onprem_database_std_params
|
|
138
149
|
elif backend == BACKEND_SAAS:
|
|
139
150
|
return saas_std_params
|
|
140
|
-
|
|
141
|
-
ValueError(f'Unknown backend {backend}')
|
|
151
|
+
raise ValueError(f"Unknown backend {backend}")
|
|
142
152
|
|
|
143
153
|
|
|
144
154
|
@pytest.fixture(scope="session")
|
|
145
|
-
def bucketfs_std_params(
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
def bucketfs_std_params(
|
|
156
|
+
backend, onprem_bucketfs_std_params, saas_std_params
|
|
157
|
+
) -> dict[str, Any]:
|
|
148
158
|
"""
|
|
149
159
|
This is a collection of StdParams parameters required to connect
|
|
150
160
|
to the BucketFS on either DockerDB or SaaS test database.
|
|
@@ -153,8 +163,7 @@ def bucketfs_std_params(backend,
|
|
|
153
163
|
return onprem_bucketfs_std_params
|
|
154
164
|
elif backend == BACKEND_SAAS:
|
|
155
165
|
return saas_std_params
|
|
156
|
-
|
|
157
|
-
ValueError(f'Unknown backend {backend}')
|
|
166
|
+
raise ValueError(f"Unknown backend {backend}")
|
|
158
167
|
|
|
159
168
|
|
|
160
169
|
def _cli_params_to_args(cli_params) -> str:
|
|
@@ -162,13 +171,13 @@ def _cli_params_to_args(cli_params) -> str:
|
|
|
162
171
|
# This should have been implemented as a method of StdParams.
|
|
163
172
|
k = k.replace("_", "-")
|
|
164
173
|
if isinstance(v, bool):
|
|
165
|
-
return f
|
|
174
|
+
return f"--{k}" if v else f"--no-{k}"
|
|
166
175
|
return f'--{k} "{v}"'
|
|
167
176
|
|
|
168
|
-
return
|
|
177
|
+
return " ".join(arg_string(k, v) for k, v in cli_params.items())
|
|
169
178
|
|
|
170
179
|
|
|
171
|
-
@pytest.fixture(scope=
|
|
180
|
+
@pytest.fixture(scope="session")
|
|
172
181
|
def database_cli_args(database_std_params) -> str:
|
|
173
182
|
"""
|
|
174
183
|
CLI argument string for testing a command that involves connecting to the database.
|
|
@@ -176,7 +185,7 @@ def database_cli_args(database_std_params) -> str:
|
|
|
176
185
|
return _cli_params_to_args(database_std_params)
|
|
177
186
|
|
|
178
187
|
|
|
179
|
-
@pytest.fixture(scope=
|
|
188
|
+
@pytest.fixture(scope="session")
|
|
180
189
|
def bucketfs_cli_args(bucketfs_std_params) -> str:
|
|
181
190
|
"""
|
|
182
191
|
CLI argument string for testing a command that involves connecting to the BucketFS .
|
|
@@ -184,7 +193,7 @@ def bucketfs_cli_args(bucketfs_std_params) -> str:
|
|
|
184
193
|
return _cli_params_to_args(bucketfs_std_params)
|
|
185
194
|
|
|
186
195
|
|
|
187
|
-
@pytest.fixture(scope=
|
|
196
|
+
@pytest.fixture(scope="session")
|
|
188
197
|
def cli_args(database_std_params, bucketfs_std_params):
|
|
189
198
|
"""
|
|
190
199
|
CLI argument string for testing a command that involves connecting to both
|
|
File without changes
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# ATTENTION:
|
|
2
|
-
# This file is generated by exasol/toolbox/
|
|
3
|
-
# * either "poetry run nox -s fix"
|
|
4
|
-
# * or "poetry run version
|
|
2
|
+
# This file is generated by exasol/toolbox/nox/_package_version.py when using:
|
|
3
|
+
# * either "poetry run -- nox -s project:fix"
|
|
4
|
+
# * or "poetry run -- nox version:check -- --fix"
|
|
5
5
|
# Do not edit this file manually!
|
|
6
|
-
# If you need to change the version, do so in the
|
|
6
|
+
# If you need to change the version, do so in the pyproject.toml, e.g. by using `poetry version X.Y.Z`.
|
|
7
7
|
MAJOR = 0
|
|
8
8
|
MINOR = 2
|
|
9
|
-
PATCH =
|
|
9
|
+
PATCH = 3
|
|
10
10
|
VERSION = f"{MAJOR}.{MINOR}.{PATCH}"
|
|
11
|
+
__version__ = VERSION
|
{pytest_exasol_extension-0.2.1.dist-info → pytest_exasol_extension-0.2.3.dist-info}/METADATA
RENAMED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: pytest-exasol-extension
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Mikhail Beck
|
|
6
6
|
Author-email: mikhail.beck@exasol.com
|
|
7
|
-
Requires-Python: >=3.10,<4
|
|
7
|
+
Requires-Python: >=3.10,<4.0
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: exasol-python-extension-common (>=0.10.0,<1)
|
|
13
14
|
Requires-Dist: pyexasol (>=0.26.0,<1)
|
|
14
15
|
Requires-Dist: pytest (>=7,<9)
|
|
15
|
-
Requires-Dist: pytest-exasol-backend (>=0.
|
|
16
|
+
Requires-Dist: pytest-exasol-backend (>=0.4.0)
|
|
16
17
|
Description-Content-Type: text/markdown
|
|
17
18
|
|
|
18
19
|
# pytest-exasol-extension Plugin
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
exasol/pytest_extension/__init__.py,sha256=KBGNn4wMFkKLEavlbwn5pvEvayXXebYej7p__2HNfsY,6873
|
|
2
|
+
exasol/pytest_extension/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
exasol/pytest_extension/version.py,sha256=bbcvixK4pr3Vhy_ovR4VEjg8AuN6H5yhFYkxFID54sQ,419
|
|
4
|
+
pytest_exasol_extension-0.2.3.dist-info/METADATA,sha256=fOfOKSyqQqBhNsiLxyDWlYYUtDKeBCTFiZR-zsz_zh8,3910
|
|
5
|
+
pytest_exasol_extension-0.2.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
6
|
+
pytest_exasol_extension-0.2.3.dist-info/entry_points.txt,sha256=7OAFswb2haZ4in-vuf3tRBHb0GAZSZZ2BJn-DStsfys,40
|
|
7
|
+
pytest_exasol_extension-0.2.3.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
exasol/pytest_extension/__init__.py,sha256=ZBm0ym9pg8dAukT9xXE--bD2km_FQJWfFd0noOMKXgw,7196
|
|
2
|
-
exasol/pytest_extension/version.py,sha256=XK25Ues5rzeUJrL8LCfXPzxcB5WKUS9Za-GhQ645dUU,404
|
|
3
|
-
pytest_exasol_extension-0.2.1.dist-info/METADATA,sha256=6gu4gKa0zexn25SHHXDDvHqQ9asyO8Ryx3zzz4w86Nc,3856
|
|
4
|
-
pytest_exasol_extension-0.2.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
5
|
-
pytest_exasol_extension-0.2.1.dist-info/entry_points.txt,sha256=7OAFswb2haZ4in-vuf3tRBHb0GAZSZZ2BJn-DStsfys,40
|
|
6
|
-
pytest_exasol_extension-0.2.1.dist-info/RECORD,,
|
{pytest_exasol_extension-0.2.1.dist-info → pytest_exasol_extension-0.2.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|