pytest-exasol-extension 0.2.3__py3-none-any.whl → 0.2.5__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.
@@ -5,6 +5,7 @@ import string
5
5
  from typing import (
6
6
  Any,
7
7
  Callable,
8
+ Iterable,
8
9
  )
9
10
  from urllib.parse import urlparse
10
11
 
@@ -19,6 +20,9 @@ from exasol.python_extension_common.connections.bucketfs_location import (
19
20
  create_bucketfs_conn_object_onprem,
20
21
  create_bucketfs_conn_object_saas,
21
22
  )
23
+ from tenacity import retry
24
+ from tenacity.stop import stop_after_attempt
25
+ from tenacity.wait import wait_exponential
22
26
 
23
27
 
24
28
  @pytest.fixture(scope="session")
@@ -32,26 +36,39 @@ def db_schema_name() -> str:
32
36
  return "".join(random.choice(string.ascii_uppercase) for _ in range(12))
33
37
 
34
38
 
39
+ @retry(
40
+ reraise=True,
41
+ wait=wait_exponential(multiplier=1, min=5, max=15),
42
+ stop=stop_after_attempt(5),
43
+ )
44
+ def _open_pyexasol_connection(
45
+ database_params: dict[str, Any],
46
+ ) -> pyexasol.ExaConnection:
47
+ return pyexasol.connect(**database_params, compression=True)
48
+
49
+
35
50
  @pytest.fixture(scope="session")
36
51
  def pyexasol_connection(
37
52
  backend_aware_database_params, db_schema_name
38
- ) -> pyexasol.ExaConnection:
53
+ ) -> Iterable[pyexasol.ExaConnection]:
39
54
  """
40
55
  The fixture provides a database connection. It opens the test schema,
41
56
  creating it if it doesn't exist. In the latter case the schema gets
42
57
  deleted and the end of the fixture's life span.
43
58
  """
44
- with pyexasol.connect(**backend_aware_database_params, compression=True) as conn:
59
+ conn = _open_pyexasol_connection(backend_aware_database_params)
60
+ use_temp_schema = False
61
+ try:
45
62
  sql = f"SELECT * FROM SYS.EXA_SCHEMAS WHERE SCHEMA_NAME = '{db_schema_name}'"
46
63
  use_temp_schema = len(conn.execute(sql).fetchall()) == 0
47
64
  if use_temp_schema:
48
65
  conn.execute(f'CREATE SCHEMA "{db_schema_name}"')
49
66
  conn.execute(f'OPEN SCHEMA "{db_schema_name}"')
50
- try:
51
- yield conn
52
- finally:
53
- if use_temp_schema:
54
- conn.execute(f'DROP SCHEMA "{db_schema_name}" CASCADE')
67
+ yield conn
68
+ finally:
69
+ if use_temp_schema:
70
+ conn.execute(f'DROP SCHEMA IF EXISTS "{db_schema_name}" CASCADE')
71
+ conn.close()
55
72
 
56
73
 
57
74
  @pytest.fixture(scope="session")
@@ -1,11 +1,15 @@
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`.
1
+ """
2
+ ATTENTION:
3
+ This file is generated by exasol/toolbox/nox/_package_version.py when using:
4
+ * either "poetry run -- nox -s project:fix"
5
+ * or "poetry run -- nox -s version:check -- --fix"
6
+ Do not edit this file manually!
7
+ If you need to change the version, do so in the pyproject.toml, e.g. by using
8
+ `poetry version X.Y.Z`.
9
+ """
10
+
7
11
  MAJOR = 0
8
12
  MINOR = 2
9
- PATCH = 3
13
+ PATCH = 5
10
14
  VERSION = f"{MAJOR}.{MINOR}.{PATCH}"
11
15
  __version__ = VERSION
@@ -1,19 +1,20 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-exasol-extension
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary:
5
5
  Author: Mikhail Beck
6
6
  Author-email: mikhail.beck@exasol.com
7
- Requires-Python: >=3.10,<4.0
7
+ Requires-Python: >=3.10,<3.14
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
13
  Requires-Dist: exasol-python-extension-common (>=0.10.0,<1)
14
- Requires-Dist: pyexasol (>=0.26.0,<1)
14
+ Requires-Dist: exasol-saas-api (>=2.3,<3)
15
+ Requires-Dist: pyexasol (>1,<2)
15
16
  Requires-Dist: pytest (>=7,<9)
16
- Requires-Dist: pytest-exasol-backend (>=0.4.0)
17
+ Requires-Dist: pytest-exasol-backend (>=1.1,<2)
17
18
  Description-Content-Type: text/markdown
18
19
 
19
20
  # pytest-exasol-extension Plugin
@@ -0,0 +1,7 @@
1
+ exasol/pytest_extension/__init__.py,sha256=WyfmJ5yNELy6OYqvpndCqatVw1RMSLLOcnPYcHx5oKM,7313
2
+ exasol/pytest_extension/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ exasol/pytest_extension/version.py,sha256=Hs4xKCAOrRTZd0yeYB1GoQEqeHxSSMrn_FOmFvWKhg0,435
4
+ pytest_exasol_extension-0.2.5.dist-info/METADATA,sha256=ARgrbeRmT2TtXMg2RLV-2DdnBQWzKmexkQWX3DSaC30,3948
5
+ pytest_exasol_extension-0.2.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
6
+ pytest_exasol_extension-0.2.5.dist-info/entry_points.txt,sha256=7OAFswb2haZ4in-vuf3tRBHb0GAZSZZ2BJn-DStsfys,40
7
+ pytest_exasol_extension-0.2.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.2
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
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,,