pytest-exasol-extension 0.2.4__tar.gz → 0.2.5__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,10 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-exasol-extension
3
- Version: 0.2.4
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
@@ -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")
@@ -10,6 +10,6 @@ If you need to change the version, do so in the pyproject.toml, e.g. by using
10
10
 
11
11
  MAJOR = 0
12
12
  MINOR = 2
13
- PATCH = 4
13
+ PATCH = 5
14
14
  VERSION = f"{MAJOR}.{MINOR}.{PATCH}"
15
15
  __version__ = VERSION
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "pytest-exasol-extension"
3
- version = "0.2.4"
4
- requires-python = ">=3.10,<4.0"
3
+ version = "0.2.5"
4
+ requires-python = ">=3.10,<3.14"
5
5
  description = ""
6
6
  authors = [
7
7
  {name="Mikhail Beck", email="mikhail.beck@exasol.com"}
@@ -23,7 +23,7 @@ exasol-saas-api = ">=2.3,<3"
23
23
  ext = "exasol.pytest_extension"
24
24
 
25
25
  [tool.poetry.group.dev.dependencies]
26
- exasol-toolbox = "^1.6.0"
26
+ exasol-toolbox = "^3.0.0"
27
27
  exasol-bucketfs = ">=1.0.0"
28
28
  click = "^8.1.7"
29
29
 
@@ -60,6 +60,15 @@ output-format = "colorized,json:.lint.json,text:.lint.txt"
60
60
  max-line-length = 88
61
61
  max-module-lines = 800
62
62
 
63
+ [tool.ruff.lint]
64
+ extend-ignore = [
65
+ "E", # Syntax errors
66
+ "F", # Pyflakes rules (excluding F401)
67
+ "UP", # pyupgrade rules
68
+ "D", # Docstring rules
69
+ ]
70
+ extend-select = ["F401"]
71
+ unfixable = []
63
72
 
64
73
  [[tool.mypy.overrides]]
65
74
  module = [
@@ -74,3 +83,4 @@ ignore_missing_imports = true
74
83
  projectKey = "com.exasol:pytest-extension"
75
84
  hostUrl = "https://sonarcloud.io"
76
85
  organization = "exasol"
86
+ exclusions = "exasol/pytest_extension/version.py"