pytest-exasol-extension 0.2.1__tar.gz → 0.2.3__tar.gz

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.
@@ -1,18 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: pytest-exasol-extension
3
- Version: 0.2.1
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
- Requires-Dist: exasol-python-extension-common (>=0.7.0,<1)
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.2.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
@@ -1,15 +1,24 @@
1
1
  from __future__ import annotations
2
- from typing import Any, Callable
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
- from exasol.pytest_backend import BACKEND_ONPREM, BACKEND_SAAS
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, create_bucketfs_conn_object_saas)
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 ''.join(random.choice(string.ascii_uppercase) for _ in range(12))
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(backend_aware_database_params,
28
- db_schema_name
29
- ) -> pyexasol.ExaConnection:
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='session')
49
- def bucketfs_connection_factory(backend,
50
- pyexasol_connection,
51
- backend_aware_bucketfs_params
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['path'] = path_in_bucket
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(pyexasol_connection, conn_name, bucketfs_params)
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(pyexasol_connection, conn_name, bucketfs_params)
82
+ create_bucketfs_conn_object_saas(
83
+ pyexasol_connection, conn_name, bucketfs_params
84
+ )
72
85
  else:
73
- raise ValueError(f'Unsupported backend {backend}')
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(use_onprem,
80
- backend_aware_onprem_database,
81
- exasol_config) -> dict[str, Any]:
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'{exasol_config.host}:{exasol_config.port}',
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(use_onprem,
94
- backend_aware_onprem_database,
95
- bucketfs_config) -> dict[str, Any]:
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() == 'https',
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: 'bfsdefault',
106
- StdParams.bucket.name: 'default',
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(use_saas,
114
- saas_host,
115
- saas_pat,
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(backend,
130
- onprem_database_std_params,
131
- saas_std_params) -> dict[str, Any]:
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
- else:
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(backend,
146
- onprem_bucketfs_std_params,
147
- saas_std_params) -> dict[str, Any]:
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
- else:
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'--{k}' if v else f'--no-{k}'
174
+ return f"--{k}" if v else f"--no-{k}"
166
175
  return f'--{k} "{v}"'
167
176
 
168
- return ' '.join(arg_string(k, v) for k, v in cli_params.items())
177
+ return " ".join(arg_string(k, v) for k, v in cli_params.items())
169
178
 
170
179
 
171
- @pytest.fixture(scope='session')
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='session')
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='session')
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
@@ -0,0 +1,11 @@
1
+ # ATTENTION:
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
+ # Do not edit this file manually!
6
+ # If you need to change the version, do so in the pyproject.toml, e.g. by using `poetry version X.Y.Z`.
7
+ MAJOR = 0
8
+ MINOR = 2
9
+ PATCH = 3
10
+ VERSION = f"{MAJOR}.{MINOR}.{PATCH}"
11
+ __version__ = VERSION
@@ -1,28 +1,33 @@
1
- [tool.poetry]
1
+ [project]
2
2
  name = "pytest-exasol-extension"
3
- version = "0.2.1"
3
+ version = "0.2.3"
4
+ requires-python = ">=3.10,<4.0"
4
5
  description = ""
5
- authors = ["Mikhail Beck <mikhail.beck@exasol.com>"]
6
+ authors = [
7
+ {name="Mikhail Beck", email="mikhail.beck@exasol.com"}
8
+ ]
6
9
  readme = "README.md"
10
+
11
+ [tool.poetry]
12
+ requires-poetry = ">=2.1.0"
7
13
  packages = [{include = "exasol"}]
8
14
 
9
15
  [tool.poetry.dependencies]
10
- python = ">=3.10,<4"
11
16
  pytest = ">=7,<9"
12
- pytest-exasol-backend = ">=0.2.0"
17
+ pytest-exasol-backend = ">=0.4.0"
13
18
  pyexasol = ">=0.26.0,<1"
14
- exasol-python-extension-common = ">=0.7.0,<1"
19
+ exasol-python-extension-common = ">=0.10.0,<1"
15
20
 
16
21
  [tool.poetry.plugins.pytest11]
17
22
  ext = "exasol.pytest_extension"
18
23
 
19
24
  [tool.poetry.group.dev.dependencies]
20
- exasol-toolbox = ">=0.15.0,<1"
21
- exasol-bucketfs = ">=0.13.0,<1"
25
+ exasol-toolbox = "^1.3.0"
26
+ exasol-bucketfs = ">=1.0.0"
22
27
  click = "^8.1.7"
23
28
 
24
29
  [build-system]
25
- requires = ["poetry-core"]
30
+ requires = ["poetry_core>=2.0.0"]
26
31
  build-backend = "poetry.core.masonry.api"
27
32
 
28
33
  [tool.coverage.run]
@@ -47,7 +52,7 @@ force_grid_wrap = 2
47
52
 
48
53
 
49
54
  [tool.pylint.master]
50
- fail-under = 8.1
55
+ fail-under = 6.7
51
56
  output-format = "colorized,json:.lint.json,text:.lint.txt"
52
57
 
53
58
  [tool.pylint.format]
@@ -59,7 +64,7 @@ max-module-lines = 800
59
64
  module = [
60
65
  "test.unit.*",
61
66
  "test.integration.*",
62
- "exasol.toolbox.*",
67
+ "exasol.pytest_backend.*",
63
68
  "pyexasol.*",
64
69
  ]
65
70
  ignore_errors = true
@@ -1,10 +0,0 @@
1
- # ATTENTION:
2
- # This file is generated by exasol/toolbox/pre_commit_hooks/package_version.py when using:
3
- # * either "poetry run nox -s fix"
4
- # * or "poetry run version-check <path/version.py> --fix"
5
- # Do not edit this file manually!
6
- # If you need to change the version, do so in the project.toml, e.g. by using `poetry version X.Y.Z`.
7
- MAJOR = 0
8
- MINOR = 2
9
- PATCH = 1
10
- VERSION = f"{MAJOR}.{MINOR}.{PATCH}"