plexus-python-pulse-common 1.1.88__tar.gz → 1.1.89__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.
Files changed (95) hide show
  1. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/PKG-INFO +1 -1
  2. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/apiutils.py +22 -5
  3. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus_python_pulse_common.egg-info/PKG-INFO +1 -1
  4. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/apiutils_test.py +39 -11
  5. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/ormutils_test.py +3 -3
  6. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/.editorconfig +0 -0
  7. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/.github/workflows/pr.yml +0 -0
  8. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/.github/workflows/push.yml +0 -0
  9. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/.gitignore +0 -0
  10. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/MANIFEST.in +0 -0
  11. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/README.md +0 -0
  12. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/VERSION +0 -0
  13. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/pyproject.toml +0 -0
  14. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/jsonutils/dummy.0.jsonl +0 -0
  15. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/jsonutils/dummy.1.jsonl +0 -0
  16. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/jsonutils/dummy.2.jsonl +0 -0
  17. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/0-dummy +0 -0
  18. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/1-dummy +0 -0
  19. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/2-dummy +0 -0
  20. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.0.0.jsonl +0 -0
  21. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.0.0.vol-0.jsonl +0 -0
  22. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.0.jsonl +0 -0
  23. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.1.1.jsonl +0 -0
  24. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.1.1.vol-1.jsonl +0 -0
  25. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.1.jsonl +0 -0
  26. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.2.2.jsonl +0 -0
  27. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.2.2.vol-2.jsonl +0 -0
  28. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.2.jsonl +0 -0
  29. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.csv.part0 +0 -0
  30. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.csv.part1 +0 -0
  31. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.csv.part2 +0 -0
  32. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/pathutils/dummy.txt +0 -0
  33. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.baz/file.bar.baz +0 -0
  34. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.baz/file.foo.bar +0 -0
  35. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.baz/file.foo.baz +0 -0
  36. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
  37. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
  38. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
  39. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
  40. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/file.bar +0 -0
  41. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/file.baz +0 -0
  42. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils/dir.foo/file.foo +0 -0
  43. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils_archive/archive.compressed.zip +0 -0
  44. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/resources/unittest/s3utils_archive/archive.uncompressed.zip +0 -0
  45. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/setup.cfg +0 -0
  46. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/setup.py +0 -0
  47. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/__init__.py +0 -0
  48. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/carto/OSMFile.py +0 -0
  49. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/carto/OSMNode.py +0 -0
  50. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/carto/OSMTags.py +0 -0
  51. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/carto/OSMWay.py +0 -0
  52. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/carto/__init__.py +0 -0
  53. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/resources/__init__.py +0 -0
  54. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/resources/tags/__init__.py +0 -0
  55. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/resources/tags/unittest-1.0.0.tagset.yaml +0 -0
  56. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/resources/tags/universal-1.0.0.tagset.yaml +0 -0
  57. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/__init__.py +0 -0
  58. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/bagutils.py +0 -0
  59. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/config.py +0 -0
  60. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/datautils.py +0 -0
  61. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/dockerutils.py +0 -0
  62. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/flowutils.py +0 -0
  63. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/gisutils.py +0 -0
  64. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/jsonutils.py +0 -0
  65. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/ormutils.py +0 -0
  66. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/pathutils.py +0 -0
  67. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/s3utils.py +0 -0
  68. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/sqlutils.py +0 -0
  69. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/strutils.py +0 -0
  70. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/tagutils.py +0 -0
  71. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus/pulse/common/utils/testutils.py +0 -0
  72. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus_python_pulse_common.egg-info/SOURCES.txt +0 -0
  73. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus_python_pulse_common.egg-info/dependency_links.txt +0 -0
  74. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus_python_pulse_common.egg-info/not-zip-safe +0 -0
  75. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus_python_pulse_common.egg-info/requires.txt +0 -0
  76. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/src/plexus_python_pulse_common.egg-info/top_level.txt +0 -0
  77. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/__init__.py +0 -0
  78. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/__init__.py +0 -0
  79. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/__init__.py +0 -0
  80. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/carto/__init__.py +0 -0
  81. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/carto/osm_file_test.py +0 -0
  82. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/carto/osm_tags_test.py +0 -0
  83. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/__init__.py +0 -0
  84. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/bagutils_test.py +0 -0
  85. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/datautils_test.py +0 -0
  86. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/dockerutils_test.py +0 -0
  87. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/flowutils_test.py +0 -0
  88. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/gisutils_test.py +0 -0
  89. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/jsonutils_test.py +0 -0
  90. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/pathutils_test.py +0 -0
  91. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/s3utils_test.py +0 -0
  92. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/strutils_test.py +0 -0
  93. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/tagutils_test.py +0 -0
  94. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/plexus_tests/pulse/common/utils/testutils_test.py +0 -0
  95. {plexus_python_pulse_common-1.1.88 → plexus_python_pulse_common-1.1.89}/test/testenv.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plexus-python-pulse-common
3
- Version: 1.1.88
3
+ Version: 1.1.89
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.12
6
6
  Classifier: Programming Language :: Python :: 3.13
@@ -1,3 +1,4 @@
1
+ from collections.abc import Callable, Mapping
1
2
  from contextlib import AbstractContextManager
2
3
 
3
4
  import sqlalchemy.orm as sa_orm
@@ -5,14 +6,21 @@ from fastapi import HTTPException
5
6
  from plexus.common.utils import logger
6
7
 
7
8
  __all__ = [
8
- "managed_db_session",
9
+ "database_transaction",
9
10
  ]
10
11
 
11
12
 
12
- class DBSessionExceptionManager(AbstractContextManager):
13
- def __init__(self, db: sa_orm.Session, commit_on_exit: bool):
13
+ class DBTransactionManager(AbstractContextManager):
14
+ def __init__(
15
+ self,
16
+ db: sa_orm.Session,
17
+ *,
18
+ commit_on_exit: bool,
19
+ redirect: Mapping[type[Exception], Callable[[Exception], HTTPException]] | None = None,
20
+ ):
14
21
  self.db = db
15
22
  self.commit_on_exit = commit_on_exit
23
+ self.redirect = redirect
16
24
 
17
25
  def __enter__(self):
18
26
  return self
@@ -39,9 +47,18 @@ class DBSessionExceptionManager(AbstractContextManager):
39
47
  if isinstance(exc_value, HTTPException) or not isinstance(exc_value, Exception):
40
48
  return
41
49
 
50
+ for exception_type, make_response in (self.redirect or {}).items():
51
+ if isinstance(exc_value, exception_type):
52
+ raise make_response(exc_value) from exc_value
53
+
42
54
  logger.error("Database session failed", exc_info=(type(exc_value), exc_value, exc_value.__traceback__))
43
55
  raise HTTPException(status_code=500, detail="Internal server error") from exc_value
44
56
 
45
57
 
46
- def managed_db_session(db: sa_orm.Session, commit_on_exit: bool = True) -> DBSessionExceptionManager:
47
- return DBSessionExceptionManager(db, commit_on_exit)
58
+ def database_transaction(
59
+ db: sa_orm.Session,
60
+ *,
61
+ commit_on_exit: bool = True,
62
+ redirect: Mapping[type[Exception], Callable[[Exception], HTTPException]] | None = None,
63
+ ) -> DBTransactionManager:
64
+ return DBTransactionManager(db, commit_on_exit=commit_on_exit, redirect=redirect)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plexus-python-pulse-common
3
- Version: 1.1.88
3
+ Version: 1.1.89
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.12
6
6
  Classifier: Programming Language :: Python :: 3.13
@@ -3,30 +3,30 @@ from unittest.mock import Mock, patch
3
3
 
4
4
  from fastapi import HTTPException
5
5
 
6
- from plexus.pulse.common.utils.apiutils import managed_db_session
6
+ from plexus.pulse.common.utils.apiutils import database_transaction
7
7
 
8
8
 
9
9
  class ApiUtilsTest(unittest.TestCase):
10
- def test_managed_db_session__success(self):
10
+ def test_database_transaction__success(self):
11
11
  for commit_on_exit in (True, False):
12
12
  with self.subTest(commit_on_exit=commit_on_exit):
13
13
  db = Mock()
14
- with managed_db_session(db, commit_on_exit):
14
+ with database_transaction(db, commit_on_exit=commit_on_exit):
15
15
  pass
16
16
  self.assertEqual(db.commit.call_count, int(commit_on_exit))
17
17
  db.rollback.assert_not_called()
18
18
 
19
- def test_managed_db_session__http_exception(self):
19
+ def test_database_transaction__http_exception(self):
20
20
  db = Mock()
21
21
  error = HTTPException(404, "Missing", headers={"X-Reason": "missing"})
22
22
  with self.assertRaises(HTTPException) as caught:
23
- with managed_db_session(db):
23
+ with database_transaction(db):
24
24
  raise error
25
25
  self.assertIs(caught.exception, error)
26
26
  db.rollback.assert_called_once_with()
27
27
  db.commit.assert_not_called()
28
28
 
29
- def test_managed_db_session__body_and_commit_errors_are_sanitized(self):
29
+ def test_database_transaction__body_and_commit_errors_are_sanitized(self):
30
30
  for during_commit in (False, True):
31
31
  with self.subTest(during_commit=during_commit):
32
32
  db = Mock()
@@ -35,7 +35,7 @@ class ApiUtilsTest(unittest.TestCase):
35
35
  db.commit.side_effect = error
36
36
  with patch("plexus.pulse.common.utils.apiutils.logger") as logger:
37
37
  with self.assertRaises(HTTPException) as caught:
38
- with managed_db_session(db):
38
+ with database_transaction(db):
39
39
  if not during_commit:
40
40
  raise error
41
41
  logger.error.assert_called_once()
@@ -44,7 +44,7 @@ class ApiUtilsTest(unittest.TestCase):
44
44
  self.assertIs(caught.exception.__cause__, error)
45
45
  db.rollback.assert_called_once_with()
46
46
 
47
- def test_managed_db_session__process_control_exceptions_are_preserved(self):
47
+ def test_database_transaction__process_control_exceptions_are_preserved(self):
48
48
  for error_type in (KeyboardInterrupt, SystemExit):
49
49
  for during_commit in (False, True):
50
50
  with self.subTest(error_type=error_type, during_commit=during_commit):
@@ -53,19 +53,47 @@ class ApiUtilsTest(unittest.TestCase):
53
53
  if during_commit:
54
54
  db.commit.side_effect = error
55
55
  with self.assertRaises(error_type) as caught:
56
- with managed_db_session(db):
56
+ with database_transaction(db):
57
57
  if not during_commit:
58
58
  raise error
59
59
  self.assertIs(caught.exception, error)
60
60
  db.rollback.assert_called_once_with()
61
61
 
62
- def test_managed_db_session__rollback_failure_preserves_original_http_exception(self):
62
+ def test_database_transaction__rollback_failure_preserves_original_http_exception(self):
63
63
  db = Mock()
64
64
  db.rollback.side_effect = RuntimeError("Rollback failed")
65
65
  error = HTTPException(409, "Conflict")
66
66
  with patch("plexus.pulse.common.utils.apiutils.logger") as logger:
67
67
  with self.assertRaises(HTTPException) as caught:
68
- with managed_db_session(db):
68
+ with database_transaction(db):
69
69
  raise error
70
70
  logger.exception.assert_called_once()
71
71
  self.assertIs(caught.exception, error)
72
+
73
+ def test_database_transaction__redirects_body_and_commit_errors(self):
74
+ for during_commit in (False, True):
75
+ with self.subTest(during_commit=during_commit):
76
+ db = Mock()
77
+ error = ValueError("invalid value")
78
+ response = HTTPException(422, "Invalid value")
79
+ make_response = Mock(return_value=response)
80
+ if during_commit:
81
+ db.commit.side_effect = error
82
+ with self.assertRaises(HTTPException) as caught:
83
+ with database_transaction(db, redirect={ValueError: make_response}):
84
+ if not during_commit:
85
+ raise error
86
+ self.assertIs(caught.exception, response)
87
+ self.assertIs(caught.exception.__cause__, error)
88
+ make_response.assert_called_once_with(error)
89
+ db.rollback.assert_called_once_with()
90
+
91
+ def test_database_transaction__http_exception_skips_redirect(self):
92
+ db = Mock()
93
+ error = HTTPException(404, "Missing")
94
+ make_response = Mock()
95
+ with self.assertRaises(HTTPException) as caught:
96
+ with database_transaction(db, redirect={Exception: make_response}):
97
+ raise error
98
+ self.assertIs(caught.exception, error)
99
+ make_response.assert_not_called()
@@ -15,7 +15,7 @@ from plexus.common.utils.jsonutils import JsonType
15
15
  from plexus.common.utils.randutils import randomizer
16
16
  from sqlmodel import Field, SQLModel
17
17
 
18
- from plexus.pulse.common.utils.apiutils import managed_db_session
18
+ from plexus.pulse.common.utils.apiutils import database_transaction
19
19
  from plexus.pulse.common.utils.ormutils import (
20
20
  changing_model_mixin,
21
21
  make_base_model,
@@ -1085,7 +1085,7 @@ def test_make_snapshot_model_trigger(fixture_postgresql_test_proc, fixture_postg
1085
1085
  dummy_json=rng.random_json_object(5),
1086
1086
  )
1087
1087
 
1088
- with maker.make_session() as session, managed_db_session(session):
1088
+ with maker.make_session() as session, database_transaction(session):
1089
1089
  session.execute(sa.sql.text("SET TIMEZONE TO 'UTC'"))
1090
1090
  session.commit()
1091
1091
 
@@ -1171,7 +1171,7 @@ def test_make_revision_model_trigger(fixture_postgresql_test_proc, fixture_postg
1171
1171
  dummy_json=rng.random_json_object(5),
1172
1172
  )
1173
1173
 
1174
- with maker.make_session() as session, managed_db_session(session):
1174
+ with maker.make_session() as session, database_transaction(session):
1175
1175
  session.execute(sa.sql.text("SET TIMEZONE TO 'UTC'"))
1176
1176
  session.commit()
1177
1177