eventsourcing 9.3.0b1__py3-none-any.whl → 9.3.1__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.
Potentially problematic release.
This version of eventsourcing might be problematic. Click here for more details.
- eventsourcing/application.py +8 -1
- eventsourcing/examples/aggregate4/domainmodel.py +14 -28
- eventsourcing/examples/contentmanagementsystem/test_system.py +119 -113
- eventsourcing/examples/searchablecontent/test_application.py +4 -5
- eventsourcing/examples/searchablecontent/test_recorder.py +4 -5
- eventsourcing/examples/searchabletimestamps/test_searchabletimestamps.py +8 -5
- eventsourcing/postgres.py +28 -22
- eventsourcing/system.py +10 -0
- eventsourcing/tests/docs_tests/test_docs.py +10 -10
- eventsourcing/tests/domain_tests/test_aggregate.py +27 -0
- eventsourcing/tests/persistence.py +3 -0
- eventsourcing/tests/persistence_tests/test_postgres.py +104 -106
- eventsourcing/tests/system_tests/test_runner.py +17 -17
- eventsourcing/tests/system_tests/test_system.py +1 -4
- eventsourcing-9.3.1.dist-info/AUTHORS +10 -0
- {eventsourcing-9.3.0b1.dist-info → eventsourcing-9.3.1.dist-info}/METADATA +6 -5
- {eventsourcing-9.3.0b1.dist-info → eventsourcing-9.3.1.dist-info}/RECORD +19 -18
- {eventsourcing-9.3.0b1.dist-info → eventsourcing-9.3.1.dist-info}/WHEEL +1 -1
- {eventsourcing-9.3.0b1.dist-info → eventsourcing-9.3.1.dist-info}/LICENSE +0 -0
|
@@ -20,32 +20,32 @@ class TestDocs(TestCase):
|
|
|
20
20
|
super().setUp()
|
|
21
21
|
self.uris = tmpfile_uris()
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
with PostgresDatastore(
|
|
24
24
|
"eventsourcing",
|
|
25
25
|
"127.0.0.1",
|
|
26
26
|
"5432",
|
|
27
27
|
"eventsourcing",
|
|
28
28
|
"eventsourcing",
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
) as datastore:
|
|
30
|
+
drop_postgres_table(datastore, "dogschool_events")
|
|
31
|
+
drop_postgres_table(datastore, "counters_events")
|
|
32
|
+
drop_postgres_table(datastore, "counters_tracking")
|
|
33
33
|
|
|
34
34
|
def tearDown(self) -> None:
|
|
35
35
|
self.clean_env()
|
|
36
36
|
|
|
37
37
|
def clean_env(self):
|
|
38
38
|
clear_topic_cache()
|
|
39
|
-
|
|
39
|
+
with PostgresDatastore(
|
|
40
40
|
"eventsourcing",
|
|
41
41
|
"127.0.0.1",
|
|
42
42
|
"5432",
|
|
43
43
|
"eventsourcing",
|
|
44
44
|
"eventsourcing",
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
) as datastore:
|
|
46
|
+
drop_postgres_table(datastore, "dogschool_events")
|
|
47
|
+
drop_postgres_table(datastore, "counters_events")
|
|
48
|
+
drop_postgres_table(datastore, "counters_tracking")
|
|
49
49
|
|
|
50
50
|
keys = [
|
|
51
51
|
"PERSISTENCE_MODULE",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import inspect
|
|
2
|
+
import warnings
|
|
2
3
|
from dataclasses import _DataclassParams, dataclass
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
from decimal import Decimal
|
|
5
6
|
from unittest.case import TestCase
|
|
6
7
|
from uuid import NAMESPACE_URL, UUID, uuid4, uuid5
|
|
7
8
|
|
|
9
|
+
from eventsourcing.application import AggregateNotFound, AggregateNotFoundError
|
|
8
10
|
from eventsourcing.domain import (
|
|
9
11
|
Aggregate,
|
|
10
12
|
AggregateCreated,
|
|
@@ -1171,3 +1173,28 @@ class TestBankAccount(TestCase):
|
|
|
1171
1173
|
# Collect pending events.
|
|
1172
1174
|
pending = account.collect_events()
|
|
1173
1175
|
self.assertEqual(len(pending), 7)
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
class TestAggregateNotFound(TestCase):
|
|
1179
|
+
def test(self):
|
|
1180
|
+
# Verify deprecation warning.
|
|
1181
|
+
with warnings.catch_warnings(record=True) as w:
|
|
1182
|
+
AggregateNotFound()
|
|
1183
|
+
|
|
1184
|
+
self.assertEqual(len(w), 1)
|
|
1185
|
+
self.assertIs(w[-1].category, DeprecationWarning)
|
|
1186
|
+
self.assertEqual(
|
|
1187
|
+
"AggregateNotFound is deprecated, use AggregateNotFoundError instead",
|
|
1188
|
+
w[-1].message.args[0],
|
|
1189
|
+
)
|
|
1190
|
+
|
|
1191
|
+
# Verify no deprecation warning.
|
|
1192
|
+
with warnings.catch_warnings(record=True) as w:
|
|
1193
|
+
AggregateNotFoundError()
|
|
1194
|
+
self.assertEqual(len(w), 0)
|
|
1195
|
+
|
|
1196
|
+
# Check we didn't break any code.
|
|
1197
|
+
try:
|
|
1198
|
+
raise AggregateNotFoundError
|
|
1199
|
+
except AggregateNotFound:
|
|
1200
|
+
pass
|
|
@@ -839,6 +839,9 @@ class InfrastructureFactoryTestCase(ABC, TestCase):
|
|
|
839
839
|
self.transcoder.register(DecimalAsStr())
|
|
840
840
|
self.transcoder.register(DatetimeAsISO())
|
|
841
841
|
|
|
842
|
+
def tearDown(self):
|
|
843
|
+
self.factory.close()
|
|
844
|
+
|
|
842
845
|
def test_createmapper(self):
|
|
843
846
|
# Want to construct:
|
|
844
847
|
# - application recorder
|
|
@@ -53,26 +53,26 @@ class TestPostgresDatastore(TestCase):
|
|
|
53
53
|
self.assertTrue(psycopg.Pipeline.is_supported())
|
|
54
54
|
|
|
55
55
|
def test_has_connection_pool(self):
|
|
56
|
-
|
|
56
|
+
with PostgresDatastore(
|
|
57
57
|
dbname="eventsourcing",
|
|
58
58
|
host="127.0.0.1",
|
|
59
59
|
port="5432",
|
|
60
60
|
user="eventsourcing",
|
|
61
61
|
password="eventsourcing", # noqa: S106
|
|
62
|
-
)
|
|
63
|
-
|
|
62
|
+
) as datastore:
|
|
63
|
+
self.assertIsInstance(datastore.pool, ConnectionPool)
|
|
64
64
|
|
|
65
65
|
def test_get_connection(self):
|
|
66
|
-
|
|
66
|
+
with PostgresDatastore(
|
|
67
67
|
dbname="eventsourcing",
|
|
68
68
|
host="127.0.0.1",
|
|
69
69
|
port="5432",
|
|
70
70
|
user="eventsourcing",
|
|
71
71
|
password="eventsourcing", # noqa: S106
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
) as datastore:
|
|
73
|
+
conn: Connection
|
|
74
|
+
with datastore.get_connection() as conn:
|
|
75
|
+
self.assertIsInstance(conn, Connection)
|
|
76
76
|
|
|
77
77
|
def test_context_manager_converts_exceptions_and_conditionally_calls_close(self):
|
|
78
78
|
cases = [
|
|
@@ -88,31 +88,30 @@ class TestPostgresDatastore(TestCase):
|
|
|
88
88
|
(TypeError, TypeError(), True),
|
|
89
89
|
(TypeError, TypeError, True),
|
|
90
90
|
]
|
|
91
|
-
|
|
91
|
+
with PostgresDatastore(
|
|
92
92
|
dbname="eventsourcing",
|
|
93
93
|
host="127.0.0.1",
|
|
94
94
|
port="5432",
|
|
95
95
|
user="eventsourcing",
|
|
96
96
|
password="eventsourcing", # noqa: S106
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
) as datastore:
|
|
98
|
+
for expected_exc_type, raised_exc, expect_conn_closed in cases:
|
|
99
|
+
with self.assertRaises(expected_exc_type):
|
|
100
|
+
conn: Connection
|
|
101
|
+
with datastore.get_connection() as conn:
|
|
102
|
+
self.assertFalse(conn.closed)
|
|
103
|
+
raise raised_exc
|
|
104
|
+
self.assertTrue(conn.closed is expect_conn_closed, raised_exc)
|
|
105
105
|
|
|
106
106
|
def test_transaction_from_datastore(self):
|
|
107
|
-
|
|
107
|
+
with PostgresDatastore(
|
|
108
108
|
dbname="eventsourcing",
|
|
109
109
|
host="127.0.0.1",
|
|
110
110
|
port="5432",
|
|
111
111
|
user="eventsourcing",
|
|
112
112
|
password="eventsourcing", # noqa: S106
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
with datastore.transaction(commit=False) as curs:
|
|
113
|
+
) as datastore, datastore.transaction(commit=False) as curs:
|
|
114
|
+
# As a convenience, we can use the transaction() method.
|
|
116
115
|
curs.execute("SELECT 1")
|
|
117
116
|
self.assertEqual(curs.fetchall(), [{"?column?": 1}])
|
|
118
117
|
|
|
@@ -128,15 +127,14 @@ class TestPostgresDatastore(TestCase):
|
|
|
128
127
|
with self.assertRaises(OperationalError), datastore.get_connection():
|
|
129
128
|
pass
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
with PostgresDatastore(
|
|
132
131
|
dbname="eventsourcing",
|
|
133
132
|
host="127.0.0.1",
|
|
134
133
|
port="987654321", # bad value
|
|
135
134
|
user="eventsourcing",
|
|
136
135
|
password="eventsourcing", # noqa: S106
|
|
137
136
|
pool_open_timeout=2,
|
|
138
|
-
)
|
|
139
|
-
with self.assertRaises(OperationalError), datastore.get_connection():
|
|
137
|
+
) as datastore, self.assertRaises(OperationalError), datastore.get_connection():
|
|
140
138
|
pass
|
|
141
139
|
|
|
142
140
|
@skipIf(
|
|
@@ -146,7 +144,7 @@ class TestPostgresDatastore(TestCase):
|
|
|
146
144
|
def test_pre_ping(self):
|
|
147
145
|
# Define method to open and close a connection, and then execute a statement.
|
|
148
146
|
def open_close_execute(*, pre_ping: bool):
|
|
149
|
-
|
|
147
|
+
with PostgresDatastore(
|
|
150
148
|
dbname="eventsourcing",
|
|
151
149
|
host="127.0.0.1",
|
|
152
150
|
port="5432",
|
|
@@ -154,28 +152,28 @@ class TestPostgresDatastore(TestCase):
|
|
|
154
152
|
password="eventsourcing", # noqa: S106
|
|
155
153
|
pool_size=1,
|
|
156
154
|
pre_ping=pre_ping,
|
|
157
|
-
)
|
|
155
|
+
) as datastore:
|
|
158
156
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
# Create a connection.
|
|
158
|
+
conn: Connection
|
|
159
|
+
with datastore.get_connection() as conn, conn.cursor() as curs:
|
|
160
|
+
curs.execute("SELECT 1")
|
|
161
|
+
self.assertEqual(curs.fetchall(), [{"?column?": 1}])
|
|
164
162
|
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
# Close all connections via separate connection.
|
|
164
|
+
pg_close_all_connections()
|
|
167
165
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
# Check the connection doesn't think it's closed.
|
|
167
|
+
self.assertTrue(datastore.pool._pool)
|
|
168
|
+
self.assertFalse(datastore.pool._pool[0].closed)
|
|
171
169
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
# Get a closed connection.
|
|
171
|
+
conn: Connection
|
|
172
|
+
with datastore.get_connection() as conn:
|
|
173
|
+
self.assertFalse(conn.closed)
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
with conn.cursor() as curs:
|
|
176
|
+
curs.execute("SELECT 1")
|
|
179
177
|
|
|
180
178
|
# Check using the closed connection gives an error.
|
|
181
179
|
with self.assertRaises(OperationalError):
|
|
@@ -185,60 +183,62 @@ class TestPostgresDatastore(TestCase):
|
|
|
185
183
|
open_close_execute(pre_ping=True)
|
|
186
184
|
|
|
187
185
|
def test_idle_in_transaction_session_timeout(self):
|
|
188
|
-
|
|
186
|
+
with PostgresDatastore(
|
|
189
187
|
dbname="eventsourcing",
|
|
190
188
|
host="127.0.0.1",
|
|
191
189
|
port="5432",
|
|
192
190
|
user="eventsourcing",
|
|
193
191
|
password="eventsourcing", # noqa: S106
|
|
194
192
|
idle_in_transaction_session_timeout=1,
|
|
195
|
-
)
|
|
193
|
+
) as datastore:
|
|
196
194
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
commit
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
curs
|
|
210
|
-
|
|
211
|
-
|
|
195
|
+
# Error on commit is raised.
|
|
196
|
+
with self.assertRaises(
|
|
197
|
+
OperationalError
|
|
198
|
+
), datastore.get_connection() as curs:
|
|
199
|
+
curs.execute("BEGIN")
|
|
200
|
+
curs.execute("SELECT 1")
|
|
201
|
+
self.assertFalse(curs.closed)
|
|
202
|
+
sleep(2)
|
|
203
|
+
|
|
204
|
+
# Error on commit is raised.
|
|
205
|
+
with self.assertRaises(OperationalError), datastore.transaction(
|
|
206
|
+
commit=True
|
|
207
|
+
) as curs:
|
|
208
|
+
# curs.execute("BEGIN")
|
|
209
|
+
curs.execute("SELECT 1")
|
|
210
|
+
self.assertFalse(curs.closed)
|
|
211
|
+
sleep(2)
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
# Force rollback. Error is ignored.
|
|
214
|
+
with datastore.transaction(commit=False) as curs:
|
|
215
|
+
# curs.execute("BEGIN")
|
|
216
|
+
curs.execute("SELECT 1")
|
|
217
|
+
self.assertFalse(curs.closed)
|
|
218
|
+
sleep(2)
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
# Autocommit mode - transaction is commited in time.
|
|
221
|
+
with datastore.get_connection() as curs:
|
|
222
|
+
curs.execute("SELECT 1")
|
|
223
|
+
self.assertFalse(curs.closed)
|
|
224
|
+
sleep(2)
|
|
225
225
|
|
|
226
226
|
def test_get_password_func(self):
|
|
227
227
|
# Check correct password is required, wrong password causes operational error.
|
|
228
|
-
|
|
228
|
+
with PostgresDatastore(
|
|
229
229
|
dbname="eventsourcing",
|
|
230
230
|
host="127.0.0.1",
|
|
231
231
|
port="5432",
|
|
232
232
|
user="eventsourcing",
|
|
233
233
|
password="wrong", # noqa: S106
|
|
234
234
|
pool_size=1,
|
|
235
|
-
)
|
|
235
|
+
) as datastore:
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
237
|
+
conn: Connection
|
|
238
|
+
with self.assertRaises(
|
|
239
|
+
OperationalError
|
|
240
|
+
), datastore.get_connection() as conn, conn.cursor() as curs:
|
|
241
|
+
curs.execute("SELECT 1")
|
|
242
242
|
|
|
243
243
|
# Define a "get password" function, with a generator that returns
|
|
244
244
|
# wrong password a few times first.
|
|
@@ -253,7 +253,7 @@ class TestPostgresDatastore(TestCase):
|
|
|
253
253
|
return next(password_generator)
|
|
254
254
|
|
|
255
255
|
# Construct datastore with "get password" function.
|
|
256
|
-
|
|
256
|
+
with PostgresDatastore(
|
|
257
257
|
dbname="eventsourcing",
|
|
258
258
|
host="127.0.0.1",
|
|
259
259
|
port="5432",
|
|
@@ -262,11 +262,9 @@ class TestPostgresDatastore(TestCase):
|
|
|
262
262
|
pool_size=1,
|
|
263
263
|
get_password_func=get_password_func,
|
|
264
264
|
connect_timeout=10,
|
|
265
|
-
)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
# retrying attempt to connect, should call "get password" twice).
|
|
269
|
-
with datastore.get_connection() as conn, conn.cursor() as curs:
|
|
265
|
+
) as datastore, datastore.get_connection() as conn, conn.cursor() as curs:
|
|
266
|
+
# Create a connection, and check it works (this test depends on psycopg
|
|
267
|
+
# retrying attempt to connect, should call "get password" twice).
|
|
270
268
|
curs.execute("SELECT 1")
|
|
271
269
|
self.assertEqual(curs.fetchall(), [{"?column?": 1}])
|
|
272
270
|
|
|
@@ -781,15 +779,15 @@ class TestPostgresInfrastructureFactory(InfrastructureFactoryTestCase):
|
|
|
781
779
|
super().tearDown()
|
|
782
780
|
|
|
783
781
|
def drop_tables(self):
|
|
784
|
-
|
|
782
|
+
with PostgresDatastore(
|
|
785
783
|
"eventsourcing",
|
|
786
784
|
"127.0.0.1",
|
|
787
785
|
"5432",
|
|
788
786
|
"eventsourcing",
|
|
789
787
|
"eventsourcing",
|
|
790
|
-
)
|
|
791
|
-
|
|
792
|
-
|
|
788
|
+
) as datastore:
|
|
789
|
+
drop_postgres_table(datastore, "testcase_events")
|
|
790
|
+
drop_postgres_table(datastore, "testcase_tracking")
|
|
793
791
|
|
|
794
792
|
def test_close(self):
|
|
795
793
|
factory = Factory(self.env)
|
|
@@ -820,16 +818,16 @@ class TestPostgresInfrastructureFactory(InfrastructureFactoryTestCase):
|
|
|
820
818
|
self.assertEqual(self.factory.datastore.pool.min_size, 5)
|
|
821
819
|
|
|
822
820
|
def test_max_overflow_is_ten_by_default(self):
|
|
823
|
-
self.assertTrue(Factory.
|
|
821
|
+
self.assertTrue(Factory.POSTGRES_MAX_OVERFLOW not in self.env)
|
|
824
822
|
self.factory = Factory(self.env)
|
|
825
823
|
self.assertEqual(self.factory.datastore.pool.max_size, 15)
|
|
826
824
|
|
|
827
|
-
self.env[Factory.
|
|
825
|
+
self.env[Factory.POSTGRES_MAX_OVERFLOW] = ""
|
|
828
826
|
self.factory = Factory(self.env)
|
|
829
827
|
self.assertEqual(self.factory.datastore.pool.max_size, 15)
|
|
830
828
|
|
|
831
829
|
def test_max_overflow_is_set(self):
|
|
832
|
-
self.env[Factory.
|
|
830
|
+
self.env[Factory.POSTGRES_MAX_OVERFLOW] = "7"
|
|
833
831
|
self.factory = Factory(self.env)
|
|
834
832
|
self.assertEqual(self.factory.datastore.pool.max_size, 12)
|
|
835
833
|
|
|
@@ -838,31 +836,31 @@ class TestPostgresInfrastructureFactory(InfrastructureFactoryTestCase):
|
|
|
838
836
|
self.factory = Factory(self.env)
|
|
839
837
|
self.assertEqual(self.factory.datastore.pool.min_size, 6)
|
|
840
838
|
|
|
841
|
-
def
|
|
839
|
+
def test_connect_timeout_is_thirty_by_default(self):
|
|
842
840
|
self.assertTrue(Factory.POSTGRES_CONNECT_TIMEOUT not in self.env)
|
|
843
841
|
self.factory = Factory(self.env)
|
|
844
|
-
self.assertEqual(self.factory.datastore.pool.timeout,
|
|
842
|
+
self.assertEqual(self.factory.datastore.pool.timeout, 30)
|
|
845
843
|
|
|
846
844
|
self.env[Factory.POSTGRES_CONNECT_TIMEOUT] = ""
|
|
847
845
|
self.factory = Factory(self.env)
|
|
848
|
-
self.assertEqual(self.factory.datastore.pool.timeout,
|
|
846
|
+
self.assertEqual(self.factory.datastore.pool.timeout, 30)
|
|
849
847
|
|
|
850
848
|
def test_connect_timeout_is_set(self):
|
|
851
849
|
self.env[Factory.POSTGRES_CONNECT_TIMEOUT] = "8"
|
|
852
850
|
self.factory = Factory(self.env)
|
|
853
851
|
self.assertEqual(self.factory.datastore.pool.timeout, 8)
|
|
854
852
|
|
|
855
|
-
def
|
|
856
|
-
self.assertTrue(Factory.
|
|
853
|
+
def test_max_waiting_is_0_by_default(self):
|
|
854
|
+
self.assertTrue(Factory.POSTGRES_MAX_WAITING not in self.env)
|
|
857
855
|
self.factory = Factory(self.env)
|
|
858
|
-
self.assertEqual(self.factory.datastore.pool.max_waiting,
|
|
856
|
+
self.assertEqual(self.factory.datastore.pool.max_waiting, 0)
|
|
859
857
|
|
|
860
|
-
self.env[Factory.
|
|
858
|
+
self.env[Factory.POSTGRES_MAX_WAITING] = ""
|
|
861
859
|
self.factory = Factory(self.env)
|
|
862
|
-
self.assertEqual(self.factory.datastore.pool.max_waiting,
|
|
860
|
+
self.assertEqual(self.factory.datastore.pool.max_waiting, 0)
|
|
863
861
|
|
|
864
|
-
def
|
|
865
|
-
self.env[Factory.
|
|
862
|
+
def test_max_waiting_is_set(self):
|
|
863
|
+
self.env[Factory.POSTGRES_MAX_WAITING] = "8"
|
|
866
864
|
self.factory = Factory(self.env)
|
|
867
865
|
self.assertEqual(self.factory.datastore.pool.max_waiting, 8)
|
|
868
866
|
|
|
@@ -945,14 +943,14 @@ class TestPostgresInfrastructureFactory(InfrastructureFactoryTestCase):
|
|
|
945
943
|
"is invalid. If set, an integer or empty string is expected: 'abc'",
|
|
946
944
|
)
|
|
947
945
|
|
|
948
|
-
def
|
|
949
|
-
self.env[Factory.
|
|
946
|
+
def test_environment_error_raised_when_max_waiting_not_an_integer(self):
|
|
947
|
+
self.env[Factory.POSTGRES_MAX_WAITING] = "abc"
|
|
950
948
|
with self.assertRaises(EnvironmentError) as cm:
|
|
951
949
|
Factory(self.env)
|
|
952
950
|
self.assertEqual(
|
|
953
951
|
cm.exception.args[0],
|
|
954
|
-
"Postgres environment value for key '
|
|
955
|
-
"is invalid. If set,
|
|
952
|
+
"Postgres environment value for key 'POSTGRES_MAX_WAITING' "
|
|
953
|
+
"is invalid. If set, an integer or empty string is expected: 'abc'",
|
|
956
954
|
)
|
|
957
955
|
|
|
958
956
|
def test_environment_error_raised_when_lock_timeout_not_an_integer(self):
|
|
@@ -976,12 +974,12 @@ class TestPostgresInfrastructureFactory(InfrastructureFactoryTestCase):
|
|
|
976
974
|
)
|
|
977
975
|
|
|
978
976
|
def test_environment_error_raised_when_max_conn_not_an_integer(self):
|
|
979
|
-
self.env[Factory.
|
|
977
|
+
self.env[Factory.POSTGRES_MAX_OVERFLOW] = "abc"
|
|
980
978
|
with self.assertRaises(EnvironmentError) as cm:
|
|
981
979
|
Factory(self.env)
|
|
982
980
|
self.assertEqual(
|
|
983
981
|
cm.exception.args[0],
|
|
984
|
-
"Postgres environment value for key '
|
|
982
|
+
"Postgres environment value for key 'POSTGRES_MAX_OVERFLOW' "
|
|
985
983
|
"is invalid. If set, an integer or empty string is expected: 'abc'",
|
|
986
984
|
)
|
|
987
985
|
|
|
@@ -738,28 +738,28 @@ class TestMultiThreadedRunnerWithPostgres(TestMultiThreadedRunner):
|
|
|
738
738
|
os.environ["POSTGRES_USER"] = "eventsourcing"
|
|
739
739
|
os.environ["POSTGRES_PASSWORD"] = "eventsourcing" # noqa: S105
|
|
740
740
|
|
|
741
|
-
|
|
741
|
+
with PostgresDatastore(
|
|
742
742
|
os.getenv("POSTGRES_DBNAME"),
|
|
743
743
|
os.getenv("POSTGRES_HOST"),
|
|
744
744
|
os.getenv("POSTGRES_PORT"),
|
|
745
745
|
os.getenv("POSTGRES_USER"),
|
|
746
746
|
os.getenv("POSTGRES_PASSWORD"),
|
|
747
|
-
)
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
747
|
+
) as datastore:
|
|
748
|
+
drop_postgres_table(datastore, f"{BankAccounts.name.lower()}_events")
|
|
749
|
+
drop_postgres_table(datastore, f"{EmailProcess.name.lower()}_events")
|
|
750
|
+
drop_postgres_table(datastore, f"{EmailProcess.name.lower()}_tracking")
|
|
751
|
+
drop_postgres_table(datastore, f"{EmailProcess.name.lower()}2_events")
|
|
752
|
+
drop_postgres_table(datastore, f"{EmailProcess.name.lower()}2_tracking")
|
|
753
|
+
drop_postgres_table(datastore, "brokenprocessing_events")
|
|
754
|
+
drop_postgres_table(datastore, "brokenprocessing_tracking")
|
|
755
|
+
drop_postgres_table(datastore, "brokenconverting_events")
|
|
756
|
+
drop_postgres_table(datastore, "brokenconverting_tracking")
|
|
757
|
+
drop_postgres_table(datastore, "brokenpulling_events")
|
|
758
|
+
drop_postgres_table(datastore, "brokenpulling_tracking")
|
|
759
|
+
drop_postgres_table(datastore, "commands_events")
|
|
760
|
+
drop_postgres_table(datastore, "commands_tracking")
|
|
761
|
+
drop_postgres_table(datastore, "results_events")
|
|
762
|
+
drop_postgres_table(datastore, "results_tracking")
|
|
763
763
|
|
|
764
764
|
os.environ["PERSISTENCE_MODULE"] = "eventsourcing.postgres"
|
|
765
765
|
|
|
@@ -155,10 +155,7 @@ class TestSystem(TestCase):
|
|
|
155
155
|
|
|
156
156
|
def test_system_has_topic_if_defined_as_module_attribute(self):
|
|
157
157
|
system_topic = system_defined_as_global.topic
|
|
158
|
-
self.
|
|
159
|
-
system_topic,
|
|
160
|
-
"eventsourcing.tests.system_tests.test_system:system_defined_as_global",
|
|
161
|
-
)
|
|
158
|
+
self.assertTrue(system_topic.endswith("test_system:system_defined_as_global"))
|
|
162
159
|
self.assertEqual(resolve_topic(system_topic), system_defined_as_global)
|
|
163
160
|
|
|
164
161
|
def test_system_topic_is_none_if_defined_in_function_body(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: eventsourcing
|
|
3
|
-
Version: 9.3.
|
|
3
|
+
Version: 9.3.1
|
|
4
4
|
Summary: Event sourcing in Python
|
|
5
5
|
Home-page: https://github.com/pyeventsourcing/eventsourcing
|
|
6
6
|
License: BSD 3-Clause
|
|
@@ -8,7 +8,7 @@ Keywords: event sourcing,event store,domain driven design,domain-driven design,d
|
|
|
8
8
|
Author: John Bywater
|
|
9
9
|
Author-email: john.bywater@appropriatesoftware.net
|
|
10
10
|
Requires-Python: >=3.8,<4.0
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Intended Audience :: Education
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -22,6 +22,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
26
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
27
|
Provides-Extra: crypto
|
|
27
28
|
Provides-Extra: docs
|
|
@@ -29,11 +30,11 @@ Provides-Extra: postgres
|
|
|
29
30
|
Requires-Dist: Sphinx ; extra == "docs"
|
|
30
31
|
Requires-Dist: backports.zoneinfo ; python_version < "3.9"
|
|
31
32
|
Requires-Dist: orjson ; extra == "docs"
|
|
32
|
-
Requires-Dist: psycopg[c,pool] (<=3.
|
|
33
|
-
Requires-Dist: pycryptodome (
|
|
33
|
+
Requires-Dist: psycopg[c,pool] (<=3.2.1) ; (python_full_version <= "3.12.999999") and (extra == "postgres")
|
|
34
|
+
Requires-Dist: pycryptodome (>=3.20,<3.21) ; extra == "crypto"
|
|
34
35
|
Requires-Dist: pydantic ; extra == "docs"
|
|
35
36
|
Requires-Dist: sphinx_rtd_theme ; extra == "docs"
|
|
36
|
-
Requires-Dist: typing_extensions
|
|
37
|
+
Requires-Dist: typing_extensions
|
|
37
38
|
Project-URL: Repository, https://github.com/pyeventsourcing/eventsourcing
|
|
38
39
|
Description-Content-Type: text/markdown
|
|
39
40
|
|