Skip to content

Commit

Permalink
Remove support for python 3.8 (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasium authored Nov 5, 2024
1 parent dfbe83d commit a68bd98
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 25 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

3.0.0
-----

Breaking Changes
~~~~~~~~~~~~~~~~

- Removed support for Python 3.8

2.8.0
-----

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Please notice that sqlalchemy-hana isn't an official SAP product and isn't cover

Prerequisites
-------------
* Python 3.8+
* Python 3.9+
* SQLAlchemy 1.4 or 2.x
* `hdbcli <https://help.sap.com/viewer/f1b440ded6144a54ada97ff95dac7adf/latest/en-US/f3b8fabf34324302b123297cdbe710f0.html>`_

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"

[project]
name = "sqlalchemy-hana"
version = "2.8.0"
version = "3.0.0"
description = "SQLAlchemy dialect for SAP HANA"
keywords = ["sqlalchemy", "sap", "hana"]
requires-python = "~=3.8"
requires-python = "~=3.9"
readme = "README.rst"
authors = [{ name = "Christoph Heer", email = "[email protected]" }]
maintainers = [
Expand All @@ -20,7 +20,6 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
18 changes: 12 additions & 6 deletions test/ci_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ def setup(dburi: str) -> str:
# always fulfill the password policy
password = random_string(15) + "A1a"

with closing(
dbapi.connect(url.hostname, url.port, url.username, url.password)
) as connection, closing(connection.cursor()) as cursor:
with (
closing(
dbapi.connect(url.hostname, url.port, url.username, url.password)
) as connection,
closing(connection.cursor()) as cursor,
):
cursor.execute(
f'CREATE USER {user} PASSWORD "{password}" NO FORCE_FIRST_PASSWORD_CHANGE'
)
Expand All @@ -41,9 +44,12 @@ def teardown(dburi: str, test_dburi: str) -> None:
url = urlsplit(dburi)
test_user = urlsplit(test_dburi).username

with closing(
dbapi.connect(url.hostname, url.port, url.username, url.password)
) as connection, closing(connection.cursor()) as cursor:
with (
closing(
dbapi.connect(url.hostname, url.port, url.username, url.password)
) as connection,
closing(connection.cursor()) as cursor,
):
cursor.execute(f"DROP USER {test_user} CASCADE")


Expand Down
26 changes: 16 additions & 10 deletions test/test_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@ def test_do_rollback_to_savepoint_unrelated_error(self) -> None:
dialect = config.db.dialect
connection = Mock()

with mock.patch.object(
sys, "exc_info", return_value=(ValueError, ValueError(), Mock())
), mock.patch.object(
DefaultDialect, "do_rollback_to_savepoint"
) as super_rollback:
with (
mock.patch.object(
sys, "exc_info", return_value=(ValueError, ValueError(), Mock())
),
mock.patch.object(
DefaultDialect, "do_rollback_to_savepoint"
) as super_rollback,
):
dialect.do_rollback_to_savepoint(connection, "savepoint")
super_rollback.assert_called_once_with(connection, "savepoint")

Expand All @@ -209,11 +212,14 @@ def test_do_rollback_to_savepoint_ignores_error(self) -> None:
error = Error(133, "transaction rolled back: deadlock")
dbapi_error = DBAPIError(None, None, error)

with mock.patch.object(
sys, "exc_info", return_value=(DBAPIError, dbapi_error, Mock())
), mock.patch.object(
DefaultDialect, "do_rollback_to_savepoint"
) as super_rollback:
with (
mock.patch.object(
sys, "exc_info", return_value=(DBAPIError, dbapi_error, Mock())
),
mock.patch.object(
DefaultDialect, "do_rollback_to_savepoint"
) as super_rollback,
):
dialect.do_rollback_to_savepoint(connection, "savepoint")
super_rollback.assert_not_called()

Expand Down
14 changes: 9 additions & 5 deletions test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ class BooleanTest(_TypeBaseTest):
[(True, hana_types.BOOLEAN), (False, hana_types.TINYINT)],
)
def test_native_boolean(self, supports_native_boolean, type_):
with mock.patch.object(
testing.db.engine.dialect,
"supports_native_boolean",
supports_native_boolean,
), testing.db.connect() as connection, connection.begin():
with (
mock.patch.object(
testing.db.engine.dialect,
"supports_native_boolean",
supports_native_boolean,
),
testing.db.connect() as connection,
connection.begin(),
):
table = Table("t", self.metadata, Column("x", types.Boolean))
table.create(bind=connection)

Expand Down

0 comments on commit a68bd98

Please sign in to comment.