eventsourcing 9.3.2__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.

Files changed (129) hide show
  1. eventsourcing/postgres.py +2 -1
  2. eventsourcing/system.py +3 -1
  3. {eventsourcing-9.3.2.dist-info → eventsourcing-9.3.4.dist-info}/METADATA +3 -8
  4. eventsourcing-9.3.4.dist-info/RECORD +24 -0
  5. eventsourcing/examples/__init__.py +0 -0
  6. eventsourcing/examples/aggregate1/__init__.py +0 -0
  7. eventsourcing/examples/aggregate1/application.py +0 -27
  8. eventsourcing/examples/aggregate1/domainmodel.py +0 -16
  9. eventsourcing/examples/aggregate1/test_application.py +0 -37
  10. eventsourcing/examples/aggregate2/__init__.py +0 -0
  11. eventsourcing/examples/aggregate2/application.py +0 -27
  12. eventsourcing/examples/aggregate2/domainmodel.py +0 -22
  13. eventsourcing/examples/aggregate2/test_application.py +0 -37
  14. eventsourcing/examples/aggregate3/__init__.py +0 -0
  15. eventsourcing/examples/aggregate3/application.py +0 -27
  16. eventsourcing/examples/aggregate3/domainmodel.py +0 -38
  17. eventsourcing/examples/aggregate3/test_application.py +0 -37
  18. eventsourcing/examples/aggregate4/__init__.py +0 -0
  19. eventsourcing/examples/aggregate4/application.py +0 -27
  20. eventsourcing/examples/aggregate4/domainmodel.py +0 -114
  21. eventsourcing/examples/aggregate4/test_application.py +0 -38
  22. eventsourcing/examples/aggregate5/__init__.py +0 -0
  23. eventsourcing/examples/aggregate5/application.py +0 -27
  24. eventsourcing/examples/aggregate5/domainmodel.py +0 -131
  25. eventsourcing/examples/aggregate5/test_application.py +0 -38
  26. eventsourcing/examples/aggregate6/__init__.py +0 -0
  27. eventsourcing/examples/aggregate6/application.py +0 -30
  28. eventsourcing/examples/aggregate6/domainmodel.py +0 -123
  29. eventsourcing/examples/aggregate6/test_application.py +0 -38
  30. eventsourcing/examples/aggregate6a/__init__.py +0 -0
  31. eventsourcing/examples/aggregate6a/application.py +0 -40
  32. eventsourcing/examples/aggregate6a/domainmodel.py +0 -149
  33. eventsourcing/examples/aggregate6a/test_application.py +0 -45
  34. eventsourcing/examples/aggregate7/__init__.py +0 -0
  35. eventsourcing/examples/aggregate7/application.py +0 -48
  36. eventsourcing/examples/aggregate7/domainmodel.py +0 -144
  37. eventsourcing/examples/aggregate7/persistence.py +0 -57
  38. eventsourcing/examples/aggregate7/test_application.py +0 -38
  39. eventsourcing/examples/aggregate7/test_compression_and_encryption.py +0 -45
  40. eventsourcing/examples/aggregate7/test_snapshotting_intervals.py +0 -67
  41. eventsourcing/examples/aggregate7a/__init__.py +0 -0
  42. eventsourcing/examples/aggregate7a/application.py +0 -56
  43. eventsourcing/examples/aggregate7a/domainmodel.py +0 -170
  44. eventsourcing/examples/aggregate7a/test_application.py +0 -46
  45. eventsourcing/examples/aggregate7a/test_compression_and_encryption.py +0 -45
  46. eventsourcing/examples/aggregate8/__init__.py +0 -0
  47. eventsourcing/examples/aggregate8/application.py +0 -47
  48. eventsourcing/examples/aggregate8/domainmodel.py +0 -65
  49. eventsourcing/examples/aggregate8/persistence.py +0 -57
  50. eventsourcing/examples/aggregate8/test_application.py +0 -37
  51. eventsourcing/examples/aggregate8/test_compression_and_encryption.py +0 -44
  52. eventsourcing/examples/aggregate8/test_snapshotting_intervals.py +0 -38
  53. eventsourcing/examples/bankaccounts/__init__.py +0 -0
  54. eventsourcing/examples/bankaccounts/application.py +0 -70
  55. eventsourcing/examples/bankaccounts/domainmodel.py +0 -56
  56. eventsourcing/examples/bankaccounts/test.py +0 -173
  57. eventsourcing/examples/cargoshipping/__init__.py +0 -0
  58. eventsourcing/examples/cargoshipping/application.py +0 -126
  59. eventsourcing/examples/cargoshipping/domainmodel.py +0 -330
  60. eventsourcing/examples/cargoshipping/interface.py +0 -143
  61. eventsourcing/examples/cargoshipping/test.py +0 -231
  62. eventsourcing/examples/contentmanagement/__init__.py +0 -0
  63. eventsourcing/examples/contentmanagement/application.py +0 -118
  64. eventsourcing/examples/contentmanagement/domainmodel.py +0 -69
  65. eventsourcing/examples/contentmanagement/test.py +0 -180
  66. eventsourcing/examples/contentmanagement/utils.py +0 -26
  67. eventsourcing/examples/contentmanagementsystem/__init__.py +0 -0
  68. eventsourcing/examples/contentmanagementsystem/application.py +0 -54
  69. eventsourcing/examples/contentmanagementsystem/postgres.py +0 -17
  70. eventsourcing/examples/contentmanagementsystem/sqlite.py +0 -17
  71. eventsourcing/examples/contentmanagementsystem/system.py +0 -14
  72. eventsourcing/examples/contentmanagementsystem/test_system.py +0 -180
  73. eventsourcing/examples/searchablecontent/__init__.py +0 -0
  74. eventsourcing/examples/searchablecontent/application.py +0 -45
  75. eventsourcing/examples/searchablecontent/persistence.py +0 -23
  76. eventsourcing/examples/searchablecontent/postgres.py +0 -118
  77. eventsourcing/examples/searchablecontent/sqlite.py +0 -136
  78. eventsourcing/examples/searchablecontent/test_application.py +0 -110
  79. eventsourcing/examples/searchablecontent/test_recorder.py +0 -68
  80. eventsourcing/examples/searchabletimestamps/__init__.py +0 -0
  81. eventsourcing/examples/searchabletimestamps/application.py +0 -32
  82. eventsourcing/examples/searchabletimestamps/persistence.py +0 -20
  83. eventsourcing/examples/searchabletimestamps/postgres.py +0 -110
  84. eventsourcing/examples/searchabletimestamps/sqlite.py +0 -99
  85. eventsourcing/examples/searchabletimestamps/test_searchabletimestamps.py +0 -94
  86. eventsourcing/examples/test_invoice.py +0 -176
  87. eventsourcing/examples/test_parking_lot.py +0 -206
  88. eventsourcing/tests/application_tests/__init__.py +0 -0
  89. eventsourcing/tests/application_tests/test_application_with_automatic_snapshotting.py +0 -55
  90. eventsourcing/tests/application_tests/test_application_with_popo.py +0 -22
  91. eventsourcing/tests/application_tests/test_application_with_postgres.py +0 -75
  92. eventsourcing/tests/application_tests/test_application_with_sqlite.py +0 -72
  93. eventsourcing/tests/application_tests/test_cache.py +0 -134
  94. eventsourcing/tests/application_tests/test_event_sourced_log.py +0 -162
  95. eventsourcing/tests/application_tests/test_notificationlog.py +0 -232
  96. eventsourcing/tests/application_tests/test_notificationlogreader.py +0 -126
  97. eventsourcing/tests/application_tests/test_processapplication.py +0 -110
  98. eventsourcing/tests/application_tests/test_processingpolicy.py +0 -109
  99. eventsourcing/tests/application_tests/test_repository.py +0 -504
  100. eventsourcing/tests/application_tests/test_snapshotting.py +0 -68
  101. eventsourcing/tests/application_tests/test_upcasting.py +0 -459
  102. eventsourcing/tests/docs_tests/__init__.py +0 -0
  103. eventsourcing/tests/docs_tests/test_docs.py +0 -293
  104. eventsourcing/tests/domain_tests/__init__.py +0 -0
  105. eventsourcing/tests/domain_tests/test_aggregate.py +0 -1200
  106. eventsourcing/tests/domain_tests/test_aggregate_decorators.py +0 -1604
  107. eventsourcing/tests/domain_tests/test_domainevent.py +0 -80
  108. eventsourcing/tests/interface_tests/__init__.py +0 -0
  109. eventsourcing/tests/interface_tests/test_remotenotificationlog.py +0 -258
  110. eventsourcing/tests/persistence_tests/__init__.py +0 -0
  111. eventsourcing/tests/persistence_tests/test_aes.py +0 -93
  112. eventsourcing/tests/persistence_tests/test_connection_pool.py +0 -722
  113. eventsourcing/tests/persistence_tests/test_eventstore.py +0 -72
  114. eventsourcing/tests/persistence_tests/test_infrastructure_factory.py +0 -21
  115. eventsourcing/tests/persistence_tests/test_mapper.py +0 -113
  116. eventsourcing/tests/persistence_tests/test_noninterleaving_notification_ids.py +0 -69
  117. eventsourcing/tests/persistence_tests/test_popo.py +0 -124
  118. eventsourcing/tests/persistence_tests/test_postgres.py +0 -1119
  119. eventsourcing/tests/persistence_tests/test_sqlite.py +0 -348
  120. eventsourcing/tests/persistence_tests/test_transcoder.py +0 -44
  121. eventsourcing/tests/system_tests/__init__.py +0 -0
  122. eventsourcing/tests/system_tests/test_runner.py +0 -935
  123. eventsourcing/tests/system_tests/test_system.py +0 -284
  124. eventsourcing/tests/utils_tests/__init__.py +0 -0
  125. eventsourcing/tests/utils_tests/test_utils.py +0 -226
  126. eventsourcing-9.3.2.dist-info/RECORD +0 -145
  127. {eventsourcing-9.3.2.dist-info → eventsourcing-9.3.4.dist-info}/AUTHORS +0 -0
  128. {eventsourcing-9.3.2.dist-info → eventsourcing-9.3.4.dist-info}/LICENSE +0 -0
  129. {eventsourcing-9.3.2.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