eventsourcing 9.3.3__py3-none-any.whl → 9.3.4__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-9.3.3.dist-info → eventsourcing-9.3.4.dist-info}/METADATA +1 -1
- eventsourcing-9.3.4.dist-info/RECORD +24 -0
- eventsourcing/examples/__init__.py +0 -0
- eventsourcing/examples/aggregate1/__init__.py +0 -0
- eventsourcing/examples/aggregate1/application.py +0 -27
- eventsourcing/examples/aggregate1/domainmodel.py +0 -16
- eventsourcing/examples/aggregate1/test_application.py +0 -37
- eventsourcing/examples/aggregate2/__init__.py +0 -0
- eventsourcing/examples/aggregate2/application.py +0 -27
- eventsourcing/examples/aggregate2/domainmodel.py +0 -22
- eventsourcing/examples/aggregate2/test_application.py +0 -37
- eventsourcing/examples/aggregate3/__init__.py +0 -0
- eventsourcing/examples/aggregate3/application.py +0 -27
- eventsourcing/examples/aggregate3/domainmodel.py +0 -38
- eventsourcing/examples/aggregate3/test_application.py +0 -37
- eventsourcing/examples/aggregate4/__init__.py +0 -0
- eventsourcing/examples/aggregate4/application.py +0 -27
- eventsourcing/examples/aggregate4/domainmodel.py +0 -114
- eventsourcing/examples/aggregate4/test_application.py +0 -38
- eventsourcing/examples/aggregate5/__init__.py +0 -0
- eventsourcing/examples/aggregate5/application.py +0 -27
- eventsourcing/examples/aggregate5/domainmodel.py +0 -131
- eventsourcing/examples/aggregate5/test_application.py +0 -38
- eventsourcing/examples/aggregate6/__init__.py +0 -0
- eventsourcing/examples/aggregate6/application.py +0 -30
- eventsourcing/examples/aggregate6/domainmodel.py +0 -123
- eventsourcing/examples/aggregate6/test_application.py +0 -38
- eventsourcing/examples/aggregate6a/__init__.py +0 -0
- eventsourcing/examples/aggregate6a/application.py +0 -40
- eventsourcing/examples/aggregate6a/domainmodel.py +0 -149
- eventsourcing/examples/aggregate6a/test_application.py +0 -45
- eventsourcing/examples/aggregate7/__init__.py +0 -0
- eventsourcing/examples/aggregate7/application.py +0 -53
- eventsourcing/examples/aggregate7/domainmodel.py +0 -142
- eventsourcing/examples/aggregate7/persistence.py +0 -57
- eventsourcing/examples/aggregate7/test_application.py +0 -45
- eventsourcing/examples/aggregate7/test_compression_and_encryption.py +0 -45
- eventsourcing/examples/aggregate7/test_snapshotting_intervals.py +0 -67
- eventsourcing/examples/aggregate7a/__init__.py +0 -0
- eventsourcing/examples/aggregate7a/application.py +0 -56
- eventsourcing/examples/aggregate7a/domainmodel.py +0 -168
- eventsourcing/examples/aggregate7a/test_application.py +0 -46
- eventsourcing/examples/aggregate7a/test_compression_and_encryption.py +0 -45
- eventsourcing/examples/aggregate8/__init__.py +0 -0
- eventsourcing/examples/aggregate8/application.py +0 -47
- eventsourcing/examples/aggregate8/domainmodel.py +0 -71
- eventsourcing/examples/aggregate8/persistence.py +0 -57
- eventsourcing/examples/aggregate8/test_application.py +0 -44
- eventsourcing/examples/aggregate8/test_compression_and_encryption.py +0 -44
- eventsourcing/examples/aggregate8/test_snapshotting_intervals.py +0 -38
- eventsourcing/examples/bankaccounts/__init__.py +0 -0
- eventsourcing/examples/bankaccounts/application.py +0 -70
- eventsourcing/examples/bankaccounts/domainmodel.py +0 -56
- eventsourcing/examples/bankaccounts/test.py +0 -173
- eventsourcing/examples/cargoshipping/__init__.py +0 -0
- eventsourcing/examples/cargoshipping/application.py +0 -126
- eventsourcing/examples/cargoshipping/domainmodel.py +0 -330
- eventsourcing/examples/cargoshipping/interface.py +0 -143
- eventsourcing/examples/cargoshipping/test.py +0 -231
- eventsourcing/examples/contentmanagement/__init__.py +0 -0
- eventsourcing/examples/contentmanagement/application.py +0 -118
- eventsourcing/examples/contentmanagement/domainmodel.py +0 -69
- eventsourcing/examples/contentmanagement/test.py +0 -180
- eventsourcing/examples/contentmanagement/utils.py +0 -26
- eventsourcing/examples/contentmanagementsystem/__init__.py +0 -0
- eventsourcing/examples/contentmanagementsystem/application.py +0 -54
- eventsourcing/examples/contentmanagementsystem/postgres.py +0 -17
- eventsourcing/examples/contentmanagementsystem/sqlite.py +0 -17
- eventsourcing/examples/contentmanagementsystem/system.py +0 -14
- eventsourcing/examples/contentmanagementsystem/test_system.py +0 -180
- eventsourcing/examples/searchablecontent/__init__.py +0 -0
- eventsourcing/examples/searchablecontent/application.py +0 -45
- eventsourcing/examples/searchablecontent/persistence.py +0 -23
- eventsourcing/examples/searchablecontent/postgres.py +0 -118
- eventsourcing/examples/searchablecontent/sqlite.py +0 -136
- eventsourcing/examples/searchablecontent/test_application.py +0 -110
- eventsourcing/examples/searchablecontent/test_recorder.py +0 -68
- eventsourcing/examples/searchabletimestamps/__init__.py +0 -0
- eventsourcing/examples/searchabletimestamps/application.py +0 -32
- eventsourcing/examples/searchabletimestamps/persistence.py +0 -20
- eventsourcing/examples/searchabletimestamps/postgres.py +0 -110
- eventsourcing/examples/searchabletimestamps/sqlite.py +0 -99
- eventsourcing/examples/searchabletimestamps/test_searchabletimestamps.py +0 -94
- eventsourcing/examples/test_invoice.py +0 -176
- eventsourcing/examples/test_parking_lot.py +0 -206
- eventsourcing/tests/application_tests/__init__.py +0 -0
- eventsourcing/tests/application_tests/test_application_with_automatic_snapshotting.py +0 -55
- eventsourcing/tests/application_tests/test_application_with_popo.py +0 -22
- eventsourcing/tests/application_tests/test_application_with_postgres.py +0 -75
- eventsourcing/tests/application_tests/test_application_with_sqlite.py +0 -72
- eventsourcing/tests/application_tests/test_cache.py +0 -134
- eventsourcing/tests/application_tests/test_event_sourced_log.py +0 -162
- eventsourcing/tests/application_tests/test_notificationlog.py +0 -232
- eventsourcing/tests/application_tests/test_notificationlogreader.py +0 -126
- eventsourcing/tests/application_tests/test_processapplication.py +0 -110
- eventsourcing/tests/application_tests/test_processingpolicy.py +0 -109
- eventsourcing/tests/application_tests/test_repository.py +0 -504
- eventsourcing/tests/application_tests/test_snapshotting.py +0 -68
- eventsourcing/tests/application_tests/test_upcasting.py +0 -459
- eventsourcing/tests/docs_tests/__init__.py +0 -0
- eventsourcing/tests/docs_tests/test_docs.py +0 -293
- eventsourcing/tests/domain_tests/__init__.py +0 -0
- eventsourcing/tests/domain_tests/test_aggregate.py +0 -1200
- eventsourcing/tests/domain_tests/test_aggregate_decorators.py +0 -1604
- eventsourcing/tests/domain_tests/test_domainevent.py +0 -80
- eventsourcing/tests/interface_tests/__init__.py +0 -0
- eventsourcing/tests/interface_tests/test_remotenotificationlog.py +0 -258
- eventsourcing/tests/persistence_tests/__init__.py +0 -0
- eventsourcing/tests/persistence_tests/test_aes.py +0 -93
- eventsourcing/tests/persistence_tests/test_connection_pool.py +0 -722
- eventsourcing/tests/persistence_tests/test_eventstore.py +0 -72
- eventsourcing/tests/persistence_tests/test_infrastructure_factory.py +0 -21
- eventsourcing/tests/persistence_tests/test_mapper.py +0 -113
- eventsourcing/tests/persistence_tests/test_noninterleaving_notification_ids.py +0 -69
- eventsourcing/tests/persistence_tests/test_popo.py +0 -124
- eventsourcing/tests/persistence_tests/test_postgres.py +0 -1120
- eventsourcing/tests/persistence_tests/test_sqlite.py +0 -348
- eventsourcing/tests/persistence_tests/test_transcoder.py +0 -44
- eventsourcing/tests/system_tests/__init__.py +0 -0
- eventsourcing/tests/system_tests/test_runner.py +0 -935
- eventsourcing/tests/system_tests/test_system.py +0 -284
- eventsourcing/tests/utils_tests/__init__.py +0 -0
- eventsourcing/tests/utils_tests/test_utils.py +0 -226
- eventsourcing-9.3.3.dist-info/RECORD +0 -145
- {eventsourcing-9.3.3.dist-info → eventsourcing-9.3.4.dist-info}/AUTHORS +0 -0
- {eventsourcing-9.3.3.dist-info → eventsourcing-9.3.4.dist-info}/LICENSE +0 -0
- {eventsourcing-9.3.3.dist-info → eventsourcing-9.3.4.dist-info}/WHEEL +0 -0
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import contextlib
|
|
2
|
-
import os
|
|
3
|
-
import sys
|
|
4
|
-
from os.path import dirname, join
|
|
5
|
-
from subprocess import PIPE, Popen
|
|
6
|
-
from tempfile import NamedTemporaryFile
|
|
7
|
-
from unittest.case import TestCase
|
|
8
|
-
|
|
9
|
-
import eventsourcing
|
|
10
|
-
from eventsourcing.postgres import PostgresDatastore
|
|
11
|
-
from eventsourcing.tests.persistence import tmpfile_uris
|
|
12
|
-
from eventsourcing.tests.postgres_utils import drop_postgres_table
|
|
13
|
-
from eventsourcing.utils import clear_topic_cache
|
|
14
|
-
|
|
15
|
-
base_dir = dirname(dirname(os.path.abspath(eventsourcing.__file__)))
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class TestDocs(TestCase):
|
|
19
|
-
def setUp(self) -> None:
|
|
20
|
-
super().setUp()
|
|
21
|
-
self.uris = tmpfile_uris()
|
|
22
|
-
|
|
23
|
-
with PostgresDatastore(
|
|
24
|
-
"eventsourcing",
|
|
25
|
-
"127.0.0.1",
|
|
26
|
-
"5432",
|
|
27
|
-
"eventsourcing",
|
|
28
|
-
"eventsourcing",
|
|
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
|
-
|
|
34
|
-
def tearDown(self) -> None:
|
|
35
|
-
self.clean_env()
|
|
36
|
-
|
|
37
|
-
def clean_env(self):
|
|
38
|
-
clear_topic_cache()
|
|
39
|
-
with PostgresDatastore(
|
|
40
|
-
"eventsourcing",
|
|
41
|
-
"127.0.0.1",
|
|
42
|
-
"5432",
|
|
43
|
-
"eventsourcing",
|
|
44
|
-
"eventsourcing",
|
|
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
|
-
|
|
50
|
-
keys = [
|
|
51
|
-
"PERSISTENCE_MODULE",
|
|
52
|
-
"IS_SNAPSHOTTING_ENABLED",
|
|
53
|
-
"POSTGRES_DBNAME",
|
|
54
|
-
"POSTGRES_HOST",
|
|
55
|
-
"POSTGRES_PORT",
|
|
56
|
-
"POSTGRES_USER",
|
|
57
|
-
"POSTGRES_PASSWORD",
|
|
58
|
-
"POSTGRES_CONN_MAX_AGE",
|
|
59
|
-
"POSTGRES_PRE_PING",
|
|
60
|
-
"POSTGRES_LOCK_TIMEOUT",
|
|
61
|
-
"POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT",
|
|
62
|
-
"SQLITE_DBNAME",
|
|
63
|
-
"SQLITE_LOCK_TIMEOUT",
|
|
64
|
-
"CIPHER_TOPIC",
|
|
65
|
-
"CIPHER_KEY",
|
|
66
|
-
"COMPRESSOR_TOPIC",
|
|
67
|
-
"AGGREGATE_CACHE_MAXSIZE",
|
|
68
|
-
]
|
|
69
|
-
for key in keys:
|
|
70
|
-
with contextlib.suppress(KeyError):
|
|
71
|
-
del os.environ[key]
|
|
72
|
-
|
|
73
|
-
def test_readme(self):
|
|
74
|
-
self._out = ""
|
|
75
|
-
|
|
76
|
-
path = join(base_dir, "README.md")
|
|
77
|
-
if not os.path.exists(path):
|
|
78
|
-
self.skipTest(f"Skipped test, README file not found: {path}")
|
|
79
|
-
|
|
80
|
-
try:
|
|
81
|
-
self.check_code_snippets_in_file(path)
|
|
82
|
-
finally:
|
|
83
|
-
os.remove("dog-school.db")
|
|
84
|
-
|
|
85
|
-
# path = join(base_dir, "README_example_with_axon.md")
|
|
86
|
-
# if not os.path.exists(path):
|
|
87
|
-
# self.skipTest("Skipped test, README file not found: {}".format(path))
|
|
88
|
-
# self.check_code_snippets_in_file(path)
|
|
89
|
-
|
|
90
|
-
def test_docs(self):
|
|
91
|
-
skipped = [
|
|
92
|
-
# 'deployment.rst'
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
self._out = ""
|
|
96
|
-
docs_path = os.path.join(base_dir, "docs")
|
|
97
|
-
|
|
98
|
-
if not os.path.exists(docs_path):
|
|
99
|
-
self.skipTest(f"Skipped test, docs folder not found: {docs_path}")
|
|
100
|
-
|
|
101
|
-
file_paths = []
|
|
102
|
-
for dirpath, _, filenames in os.walk(docs_path):
|
|
103
|
-
for name in filenames:
|
|
104
|
-
if name in skipped:
|
|
105
|
-
continue
|
|
106
|
-
if name.endswith(".rst"):
|
|
107
|
-
# if (
|
|
108
|
-
# name.endswith("persistence.rst")
|
|
109
|
-
# or name.endswith("domain.rst")
|
|
110
|
-
# or name.endswith("application.rst")
|
|
111
|
-
# or name.endswith("system.rst")
|
|
112
|
-
# or name.endswith("examples.rst")
|
|
113
|
-
# ):
|
|
114
|
-
# if name.endswith('part4.rst'):
|
|
115
|
-
# if name.endswith('aggregates_in_ddd.rst'):
|
|
116
|
-
# if name.endswith('example_application.rst'):
|
|
117
|
-
# if name.endswith('everything.rst'):
|
|
118
|
-
# if name.endswith('infrastructure.rst'):
|
|
119
|
-
# if name.endswith('application.rst'):
|
|
120
|
-
# if name.endswith('snapshotting.rst'):
|
|
121
|
-
# if name.endswith('notifications.rst'):
|
|
122
|
-
# if name.endswith('projections.rst'):
|
|
123
|
-
# if name.endswith('deployment.rst'):
|
|
124
|
-
# if name.endswith('process.rst'):
|
|
125
|
-
file_paths.append(os.path.join(docs_path, dirpath, name))
|
|
126
|
-
|
|
127
|
-
file_paths = sorted(file_paths)
|
|
128
|
-
failures = []
|
|
129
|
-
passed = []
|
|
130
|
-
failed = []
|
|
131
|
-
print("Testing code snippets in docs:")
|
|
132
|
-
for path in file_paths:
|
|
133
|
-
print(path)
|
|
134
|
-
print("")
|
|
135
|
-
for path in file_paths:
|
|
136
|
-
# print("Testing code snippets in file: {}".format(path))
|
|
137
|
-
try:
|
|
138
|
-
self.check_code_snippets_in_file(path)
|
|
139
|
-
except self.failureException as e: # noqa: PERF203
|
|
140
|
-
failures.append(e)
|
|
141
|
-
failed.append(path)
|
|
142
|
-
print(str(e).strip("\n"))
|
|
143
|
-
print("FAIL")
|
|
144
|
-
print("")
|
|
145
|
-
else:
|
|
146
|
-
passed.append(path)
|
|
147
|
-
print("PASS")
|
|
148
|
-
print("")
|
|
149
|
-
finally:
|
|
150
|
-
self.clean_env()
|
|
151
|
-
|
|
152
|
-
print(f"{len(failed)} failed, {len(passed)} passed")
|
|
153
|
-
|
|
154
|
-
if failures:
|
|
155
|
-
raise failures[0]
|
|
156
|
-
|
|
157
|
-
def check_code_snippets_in_file(self, doc_path):
|
|
158
|
-
# Extract lines of Python code from the README.md file.
|
|
159
|
-
|
|
160
|
-
lines = []
|
|
161
|
-
num_code_lines = 0
|
|
162
|
-
num_code_lines_in_block = 0
|
|
163
|
-
is_code = False
|
|
164
|
-
is_md = False
|
|
165
|
-
is_rst = False
|
|
166
|
-
last_line = ""
|
|
167
|
-
is_literalinclude = False
|
|
168
|
-
module = ""
|
|
169
|
-
with open(doc_path) as doc_file:
|
|
170
|
-
for line_index, orig_line in enumerate(doc_file):
|
|
171
|
-
# print("Line index:", line_index)
|
|
172
|
-
# print("Orig line:", orig_line)
|
|
173
|
-
# print("Last line:", last_line)
|
|
174
|
-
|
|
175
|
-
line = orig_line.strip("\n")
|
|
176
|
-
if line.startswith("```python"):
|
|
177
|
-
# Start markdown code block.
|
|
178
|
-
if is_rst:
|
|
179
|
-
self.fail(
|
|
180
|
-
"Markdown code block found after restructured text block "
|
|
181
|
-
"in same file."
|
|
182
|
-
)
|
|
183
|
-
is_code = True
|
|
184
|
-
is_md = True
|
|
185
|
-
line = ""
|
|
186
|
-
num_code_lines_in_block = 0
|
|
187
|
-
elif is_code and is_md and line.startswith("```"):
|
|
188
|
-
# Finish markdown code block.
|
|
189
|
-
if not num_code_lines_in_block:
|
|
190
|
-
self.fail(f"No lines of code in block: {line_index + 1}")
|
|
191
|
-
is_code = False
|
|
192
|
-
line = ""
|
|
193
|
-
elif is_code and is_rst and line.startswith("```"):
|
|
194
|
-
# Can't finish restructured text block with markdown.
|
|
195
|
-
self.fail(
|
|
196
|
-
"Restructured text block terminated with markdown format '```'"
|
|
197
|
-
)
|
|
198
|
-
elif line.startswith(".. code-block:: python") or (
|
|
199
|
-
line.strip() == ".." and "include-when-testing" in last_line
|
|
200
|
-
):
|
|
201
|
-
# Start restructured text code block.
|
|
202
|
-
if is_md:
|
|
203
|
-
self.fail(
|
|
204
|
-
"Restructured text code block found after markdown block "
|
|
205
|
-
"in same file."
|
|
206
|
-
)
|
|
207
|
-
is_code = True
|
|
208
|
-
is_rst = True
|
|
209
|
-
line = ""
|
|
210
|
-
num_code_lines_in_block = 0
|
|
211
|
-
elif line.startswith(".. literalinclude::"):
|
|
212
|
-
is_literalinclude = True
|
|
213
|
-
module = line.strip().split(" ")[-1] # get the file path
|
|
214
|
-
module = module[:-3] # remove the '.py' from the end
|
|
215
|
-
module = module.lstrip("./") # remove all the ../../..
|
|
216
|
-
module = module.replace("/", ".") # swap dots for slashes
|
|
217
|
-
line = ""
|
|
218
|
-
|
|
219
|
-
elif is_literalinclude:
|
|
220
|
-
if "pyobject" in line:
|
|
221
|
-
# Assume ".. literalinclude:: ../../xxx/xx.py"
|
|
222
|
-
# Or ".. literalinclude:: ../xxx/xx.py"
|
|
223
|
-
# Assume " :pyobject: xxxxxx"
|
|
224
|
-
pyobject = line.strip().split(" ")[-1]
|
|
225
|
-
statement = f"from {module} import {pyobject}"
|
|
226
|
-
line = statement
|
|
227
|
-
elif not line.strip():
|
|
228
|
-
is_literalinclude = False
|
|
229
|
-
module = ""
|
|
230
|
-
|
|
231
|
-
elif is_code and is_rst and line and not line.startswith(" "):
|
|
232
|
-
# Finish restructured text code block.
|
|
233
|
-
if not num_code_lines_in_block:
|
|
234
|
-
self.fail(f"No lines of code in block: {line_index + 1}")
|
|
235
|
-
is_code = False
|
|
236
|
-
line = ""
|
|
237
|
-
elif ":emphasize-lines:" in line:
|
|
238
|
-
line = ""
|
|
239
|
-
elif is_code:
|
|
240
|
-
# Process line in code block. Restructured code block normally
|
|
241
|
-
# indented with four spaces.
|
|
242
|
-
if is_rst and len(line.strip()):
|
|
243
|
-
if not line.startswith(" "):
|
|
244
|
-
self.fail(
|
|
245
|
-
"Code line needs 4-char indent: {}: {}".format(
|
|
246
|
-
repr(line), doc_path
|
|
247
|
-
)
|
|
248
|
-
)
|
|
249
|
-
# Strip four chars of indentation.
|
|
250
|
-
line = line[4:]
|
|
251
|
-
|
|
252
|
-
if len(line.strip()):
|
|
253
|
-
num_code_lines_in_block += 1
|
|
254
|
-
num_code_lines += 1
|
|
255
|
-
else:
|
|
256
|
-
line = ""
|
|
257
|
-
lines.append(line)
|
|
258
|
-
# if orig_line.strip():
|
|
259
|
-
last_line = orig_line
|
|
260
|
-
|
|
261
|
-
print(f"{num_code_lines} lines of code in {doc_path}")
|
|
262
|
-
|
|
263
|
-
source = "\n".join(lines) + "\n"
|
|
264
|
-
|
|
265
|
-
# Write the code into a temp file.
|
|
266
|
-
tempfile = NamedTemporaryFile("w+")
|
|
267
|
-
temp_path = tempfile.name
|
|
268
|
-
tempfile.writelines(source)
|
|
269
|
-
tempfile.flush()
|
|
270
|
-
|
|
271
|
-
# Run the code and catch errors.
|
|
272
|
-
p = Popen(
|
|
273
|
-
[sys.executable, temp_path], # noqa: S603
|
|
274
|
-
stdout=PIPE,
|
|
275
|
-
stderr=PIPE,
|
|
276
|
-
env={"PYTHONPATH": base_dir},
|
|
277
|
-
)
|
|
278
|
-
out, err = p.communicate()
|
|
279
|
-
out = out.decode("utf8")
|
|
280
|
-
err = err.decode("utf8")
|
|
281
|
-
out = out.replace(temp_path, doc_path)
|
|
282
|
-
err = err.replace(temp_path, doc_path)
|
|
283
|
-
exit_status = p.wait()
|
|
284
|
-
|
|
285
|
-
print(out)
|
|
286
|
-
print(err)
|
|
287
|
-
|
|
288
|
-
# Check for errors running the code.
|
|
289
|
-
if exit_status:
|
|
290
|
-
self.fail(out + err)
|
|
291
|
-
|
|
292
|
-
# Close (deletes) the tempfile.
|
|
293
|
-
tempfile.close()
|
|
File without changes
|