openmodule 13.5.0__tar.gz → 13.6.0__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 (247) hide show
  1. {openmodule-13.5.0 → openmodule-13.6.0}/ChangeLog +5 -10
  2. {openmodule-13.5.0/openmodule.egg-info → openmodule-13.6.0}/PKG-INFO +1 -1
  3. {openmodule-13.5.0 → openmodule-13.6.0}/docs/migrations.md +8 -1
  4. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/core.py +3 -2
  5. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/dispatcher.py +21 -10
  6. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/logging.py +3 -2
  7. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/messaging.py +16 -5
  8. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/base.py +1 -7
  9. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/rpc/server.py +3 -11
  10. {openmodule-13.5.0 → openmodule-13.6.0/openmodule.egg-info}/PKG-INFO +1 -1
  11. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule.egg-info/SOURCES.txt +1 -0
  12. openmodule-13.6.0/openmodule.egg-info/pbr.json +1 -0
  13. openmodule-13.6.0/tests/test_core.py +104 -0
  14. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database.py +23 -0
  15. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_dispatcher.py +14 -4
  16. openmodule-13.6.0/tests/test_logging.py +29 -0
  17. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_messaging.py +10 -4
  18. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_rpc.py +2 -4
  19. openmodule-13.5.0/openmodule.egg-info/pbr.json +0 -1
  20. openmodule-13.5.0/tests/test_core.py +0 -48
  21. {openmodule-13.5.0 → openmodule-13.6.0}/.gitlab-ci.yml +0 -0
  22. {openmodule-13.5.0 → openmodule-13.6.0}/AUTHORS +0 -0
  23. {openmodule-13.5.0 → openmodule-13.6.0}/LICENSE +0 -0
  24. {openmodule-13.5.0 → openmodule-13.6.0}/README.md +0 -0
  25. {openmodule-13.5.0 → openmodule-13.6.0}/docs/access_service.md +0 -0
  26. {openmodule-13.5.0 → openmodule-13.6.0}/docs/anonymization.md +0 -0
  27. {openmodule-13.5.0 → openmodule-13.6.0}/docs/cleanup.md +0 -0
  28. {openmodule-13.5.0 → openmodule-13.6.0}/docs/coding_standard.md +0 -0
  29. {openmodule-13.5.0 → openmodule-13.6.0}/docs/commands.md +0 -0
  30. {openmodule-13.5.0 → openmodule-13.6.0}/docs/connection_status_listener.md +0 -0
  31. {openmodule-13.5.0 → openmodule-13.6.0}/docs/csv_export.md +0 -0
  32. {openmodule-13.5.0 → openmodule-13.6.0}/docs/database.md +0 -0
  33. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated.md +0 -0
  34. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/README.md +0 -0
  35. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/access_service/openmodule/models/access_service.py +0 -0
  36. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/access_service/openmodule/utils/access_service.py +0 -0
  37. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/access_service/openmodule_test/access_service.py +0 -0
  38. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/access_service/tests/test_utils_access_service.py +0 -0
  39. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/api/openmodule/utils/api.py +0 -0
  40. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/api/openmodule_test/api.py +0 -0
  41. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/api/tests/test_utils_api.py +0 -0
  42. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/package_reader/openmodule/utils/package_reader.py +0 -0
  43. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/package_reader/openmodule_test/fake_package_creator.py +0 -0
  44. {openmodule-13.5.0 → openmodule-13.6.0}/docs/deprecated_code/package_reader/tests/test_package_reader.py +0 -0
  45. {openmodule-13.5.0 → openmodule-13.6.0}/docs/event_sending.md +0 -0
  46. {openmodule-13.5.0 → openmodule-13.6.0}/docs/getting_started.md +0 -0
  47. {openmodule-13.5.0 → openmodule-13.6.0}/docs/health.md +0 -0
  48. {openmodule-13.5.0 → openmodule-13.6.0}/docs/images/broker.drawio.png +0 -0
  49. {openmodule-13.5.0 → openmodule-13.6.0}/docs/known_issues.md +0 -0
  50. {openmodule-13.5.0 → openmodule-13.6.0}/docs/package_reader.md +0 -0
  51. {openmodule-13.5.0 → openmodule-13.6.0}/docs/rpc.md +0 -0
  52. {openmodule-13.5.0 → openmodule-13.6.0}/docs/settings.md +0 -0
  53. {openmodule-13.5.0 → openmodule-13.6.0}/docs/settings_provider.md +0 -0
  54. {openmodule-13.5.0 → openmodule-13.6.0}/docs/testing.md +0 -0
  55. {openmodule-13.5.0 → openmodule-13.6.0}/docs/translation.md +0 -0
  56. {openmodule-13.5.0 → openmodule-13.6.0}/docs/utils.md +0 -0
  57. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/__init__.py +0 -0
  58. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/alert.py +0 -0
  59. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/config.py +0 -0
  60. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/connection_status.py +0 -0
  61. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/database/custom_types.py +0 -0
  62. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/database/database.py +0 -0
  63. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/database/env.py +0 -0
  64. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/database/migration.py +0 -0
  65. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/health.py +0 -0
  66. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/__init__.py +0 -0
  67. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/access_service.py +0 -0
  68. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/alert.py +0 -0
  69. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/io.py +0 -0
  70. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/kv_store.py +0 -0
  71. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/presence.py +0 -0
  72. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/privacy.py +0 -0
  73. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/rpc.py +0 -0
  74. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/settings.py +0 -0
  75. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/validation.py +0 -0
  76. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/models/vehicle.py +0 -0
  77. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/rpc/__init__.py +0 -0
  78. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/rpc/client.py +0 -0
  79. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/rpc/common.py +0 -0
  80. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/sentry.py +0 -0
  81. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/threading.py +0 -0
  82. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/__init__.py +0 -0
  83. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/access_service.py +0 -0
  84. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/charset.py +0 -0
  85. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/cleanup.py +0 -0
  86. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/csv_export.py +0 -0
  87. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/databox.py +0 -0
  88. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/db_helper.py +0 -0
  89. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/eventlog.py +0 -0
  90. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/io.py +0 -0
  91. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/kv_store.py +0 -0
  92. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/matching.py +0 -0
  93. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/misc_functions.py +0 -0
  94. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/package_reader.py +0 -0
  95. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/presence.py +0 -0
  96. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/schema.py +0 -0
  97. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/settings.py +0 -0
  98. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/translation.py +0 -0
  99. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule/utils/validation.py +0 -0
  100. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule.egg-info/dependency_links.txt +0 -0
  101. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule.egg-info/not-zip-safe +0 -0
  102. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule.egg-info/requires.txt +0 -0
  103. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule.egg-info/top_level.txt +0 -0
  104. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_commands/__init__.py +0 -0
  105. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_commands/setup.cfg +0 -0
  106. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_commands/setup.py +0 -0
  107. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_commands/translate.py +0 -0
  108. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/__init__.py +0 -0
  109. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/alert.py +0 -0
  110. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/connection_status.py +0 -0
  111. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/core.py +0 -0
  112. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/database.py +0 -0
  113. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/eventlistener.py +0 -0
  114. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/files.py +0 -0
  115. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/gate.py +0 -0
  116. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/health.py +0 -0
  117. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/interrupt.py +0 -0
  118. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/io_simulator.py +0 -0
  119. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/package_reader.py +0 -0
  120. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/presence.py +0 -0
  121. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/requirements.txt +0 -0
  122. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/rpc.py +0 -0
  123. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/settings.py +0 -0
  124. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/setup.cfg +0 -0
  125. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/setup.py +0 -0
  126. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/utils.py +0 -0
  127. {openmodule-13.5.0 → openmodule-13.6.0}/openmodule_test/zeromq.py +0 -0
  128. {openmodule-13.5.0 → openmodule-13.6.0}/requirements.txt +0 -0
  129. {openmodule-13.5.0 → openmodule-13.6.0}/setup.cfg +0 -0
  130. {openmodule-13.5.0 → openmodule-13.6.0}/setup.py +0 -0
  131. {openmodule-13.5.0 → openmodule-13.6.0}/test-requirements.txt +0 -0
  132. {openmodule-13.5.0 → openmodule-13.6.0}/tests/__init__.py +0 -0
  133. {openmodule-13.5.0 → openmodule-13.6.0}/tests/config.py +0 -0
  134. {openmodule-13.5.0 → openmodule-13.6.0}/tests/database_models_migration.py +0 -0
  135. {openmodule-13.5.0 → openmodule-13.6.0}/tests/database_models_test.py +0 -0
  136. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/alembic/README +0 -0
  137. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/alembic/__init__.py +0 -0
  138. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/alembic/env.py +0 -0
  139. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/alembic/script.py.mako +0 -0
  140. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/alembic/versions/ff26e54332f9_datetime_models.py +0 -0
  141. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/alembic.ini +0 -0
  142. {openmodule-13.5.0 → openmodule-13.6.0}/tests/invalid_database/makemigration.sh +0 -0
  143. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/alembic/__init__.py +0 -0
  144. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/alembic/env.py +0 -0
  145. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/alembic/script.py.mako +0 -0
  146. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/alembic/versions/812a3e5b8517_initial.py +0 -0
  147. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/alembic/versions/a7ea100a784f_key_error.py +0 -0
  148. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/alembic.ini +0 -0
  149. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_double_column_delete_error/makemigration.sh +0 -0
  150. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/alembic/__init__.py +0 -0
  151. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/alembic/env.py +0 -0
  152. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/alembic/script.py.mako +0 -0
  153. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/alembic/versions/812a3e5b8517_initial.py +0 -0
  154. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/alembic/versions/a7ea100a784f_no_such_table_error.py +0 -0
  155. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/alembic.ini +0 -0
  156. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_no_such_table_error/makemigration.sh +0 -0
  157. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/__init__.py +0 -0
  158. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic/__init__.py +0 -0
  159. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic/env.py +0 -0
  160. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic/script.py.mako +0 -0
  161. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic/versions/19789aa5361c_initial.py +0 -0
  162. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic/versions/19d887929ae7_alter.py +0 -0
  163. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic/versions/__init__.py +0 -0
  164. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic.ini +0 -0
  165. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/alembic_migration_test_database.sqlite3 +0 -0
  166. {openmodule-13.5.0 → openmodule-13.6.0}/tests/migration_test_database/makemigration.sh +0 -0
  167. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/configs/config.py +0 -0
  168. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/configs/test_config.py +0 -0
  169. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/configs/test_config_1.py +0 -0
  170. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/standard_schemes/DEFAULT-10.yml +0 -0
  171. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/standard_schemes/DEFAULT-20.yml +0 -0
  172. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/standard_schemes/LEGACY-0.yml +0 -0
  173. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/translation/locale/de/LC_MESSAGES/translation.mo +0 -0
  174. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/translation/locale/de/LC_MESSAGES/translation.po +0 -0
  175. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/translation/locale/en/LC_MESSAGES/translation.mo +0 -0
  176. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/translation/locale/en/LC_MESSAGES/translation.po +0 -0
  177. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/translation/locale/translation.pot +0 -0
  178. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/translation/translate.sh +0 -0
  179. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/A-10.yml +0 -0
  180. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/A-20.yml +0 -0
  181. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/DEFAULT-10.yml +0 -0
  182. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/DEFAULT-20.yml +0 -0
  183. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/DEFAULT-30.yml +0 -0
  184. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/LEGACY-0.yml +0 -0
  185. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/TEST-10.yml +0 -0
  186. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/TEST-20.yml +0 -0
  187. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/TEST-30.yml +0 -0
  188. {openmodule-13.5.0 → openmodule-13.6.0}/tests/resources/utils_matching/TEST-40.yml +0 -0
  189. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic/__init__.py +0 -0
  190. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic/env.py +0 -0
  191. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic/script.py.mako +0 -0
  192. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic/versions/7bd4fcd38fde_removed_nfc_and_pin.py +0 -0
  193. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic/versions/9ca98a2e5674_added_parksettings_id.py +0 -0
  194. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic/versions/c821971f9230_initial.py +0 -0
  195. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/alembic.ini +0 -0
  196. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_access_service_database/makemigration.sh +0 -0
  197. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_alembic_migrations.py +0 -0
  198. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_alert.py +0 -0
  199. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_checks.py +0 -0
  200. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_config.py +0 -0
  201. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_connection_status.py +0 -0
  202. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database/alembic/__init__.py +0 -0
  203. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database/alembic/env.py +0 -0
  204. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database/alembic/script.py.mako +0 -0
  205. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database/alembic/versions/32b8c728abbf_initial.py +0 -0
  206. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database/alembic.ini +0 -0
  207. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_database/makemigration.sh +0 -0
  208. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_health.py +0 -0
  209. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_interrupt.py +0 -0
  210. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_io_listen.py +0 -0
  211. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/alembic/__init__.py +0 -0
  212. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/alembic/env.py +0 -0
  213. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/alembic/script.py.mako +0 -0
  214. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/alembic/versions/9c5c944221f4_deprecated_kv_entry_example.py +0 -0
  215. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/alembic/versions/c55a69026a25_initial.py +0 -0
  216. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/alembic.ini +0 -0
  217. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_database/makemigration.sh +0 -0
  218. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/alembic/README +0 -0
  219. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/alembic/__init__.py +0 -0
  220. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/alembic/env.py +0 -0
  221. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/alembic/script.py.mako +0 -0
  222. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/alembic/versions/cdb3214131a9_initial.py +0 -0
  223. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/alembic.ini +0 -0
  224. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_kv_store_multiple_database/makemigration.sh +0 -0
  225. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_mockrpcclient.py +0 -0
  226. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_model.py +0 -0
  227. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_schema.py +0 -0
  228. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_sentry.py +0 -0
  229. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_test_alert.py +0 -0
  230. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_test_gate.py +0 -0
  231. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_test_zeromq.py +0 -0
  232. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_access_service.py +0 -0
  233. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_charset.py +0 -0
  234. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_cleanup.py +0 -0
  235. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_csv_export.py +0 -0
  236. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_databox.py +0 -0
  237. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_eventlog.py +0 -0
  238. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_kv_store.py +0 -0
  239. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_kv_store_multiple.py +0 -0
  240. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_matching.py +0 -0
  241. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_misc_functions.py +0 -0
  242. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_package_reader.py +0 -0
  243. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_presence.py +0 -0
  244. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_settings.py +0 -0
  245. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_validation.py +0 -0
  246. {openmodule-13.5.0 → openmodule-13.6.0}/tests/test_utils_vehicle.py +0 -0
  247. {openmodule-13.5.0 → openmodule-13.6.0}/tox.ini +0 -0
@@ -1,6 +1,11 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ v13.6.0
5
+ -------
6
+
7
+ * OM-697 OpenModule Verbesserungen
8
+
4
9
  v13.5.0
5
10
  -------
6
11
 
@@ -159,11 +164,6 @@ v11.1.0
159
164
  -------
160
165
 
161
166
  * csv export library, databox upload and schedule library tips
162
-
163
- v11.1.0.rc5
164
- -----------
165
-
166
- * again no language set in testing
167
167
  * removed mock rpcs from schema
168
168
 
169
169
  v11.0.3
@@ -210,8 +210,3 @@ v10.0.2.rc2
210
210
 
211
211
  * added more documentation [skip ci]
212
212
  * fixes an issue in the multiprocessing\_logging package in testcases
213
-
214
- v10.0.2.rc1
215
- -----------
216
-
217
- * Refactor for backend class for controller v2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openmodule
3
- Version: 13.5.0
3
+ Version: 13.6.0
4
4
  Summary: Libraries for developing the arivo openmodule
5
5
  Home-page: https://gitlab.com/arivo-public/device-python/openmodule.git
6
6
  Author: ARIVO
@@ -1,11 +1,18 @@
1
1
  # Breaking Version Changes
2
2
 
3
+ ## 13.6.0
4
+ * messaging:
5
+ * the `get_pub_socket` now raises an AssertionError because we no longer support multiple publishers.
6
+ This was done because pub sockets receive all subscriptions and queue them until the next message is sent.
7
+ This can lead to a memory leak.
8
+ * logging:
9
+ * logs will now be written to stdout instead of stderr
10
+
3
11
  ## 13.5.0:
4
12
  * changes in env.py of alembic: <br>
5
13
  `from openmodule.database.database import run_env_py` -> <br>
6
14
  `from openmodule.database.migration import run_env_py`
7
15
 
8
-
9
16
  ## 13.0.0
10
17
  * access_service:
11
18
  * changes in AccessCheckAccess (removed media field) and AccessCheckResponse (removed error field)
@@ -14,7 +14,8 @@ from openmodule.config import validate_config_module
14
14
  from openmodule.dispatcher import ZMQMessageDispatcher
15
15
  from openmodule.health import HealthHandlerType, Healthz, HealthPingMessage
16
16
  from openmodule.logging import init_logging
17
- from openmodule.messaging import get_pub_socket, get_sub_socket, receive_message_from_socket, wait_for_connection
17
+ from openmodule.messaging import _internal_get_pub_socket, get_sub_socket, receive_message_from_socket, \
18
+ wait_for_connection
18
19
  from openmodule.models.base import ZMQMessage
19
20
  from openmodule.sentry import init_sentry, should_activate_sentry, deinit_sentry
20
21
  from openmodule.threading import get_thread_wrapper
@@ -35,7 +36,7 @@ class OpenModuleCore(threading.Thread):
35
36
  self.pub_lock = threading.Lock()
36
37
  self.sub_lock = threading.Lock()
37
38
 
38
- self.pub_socket = get_pub_socket(self.context, self.config, linger=1000)
39
+ self.pub_socket = _internal_get_pub_socket(self.context, self.config, linger=1000)
39
40
  self.sub_socket = get_sub_socket(self.context, self.config)
40
41
  self.sub_socket_internal = get_sub_socket(self.context, self.config)
41
42
 
@@ -108,6 +108,8 @@ class MessageDispatcher:
108
108
  self.raise_validation_errors = raise_validation_errors
109
109
  self.raise_handler_errors = raise_handler_errors
110
110
  self.executor = executor or DummyExecutor()
111
+ self._shutdown = False
112
+ self._shutdown_lock = threading.Lock()
111
113
 
112
114
  @property
113
115
  def is_multi_threaded(self):
@@ -125,7 +127,9 @@ class MessageDispatcher:
125
127
  return True
126
128
 
127
129
  def shutdown(self, wait=True):
128
- self.executor.shutdown(wait=wait)
130
+ with self._shutdown_lock:
131
+ self._shutdown = True
132
+ self.executor.shutdown(wait=wait)
129
133
 
130
134
  def unregister_handler(self, listener: Listener):
131
135
  for topic, listeners in self.listeners.items():
@@ -180,15 +184,22 @@ class MessageDispatcher:
180
184
  return listener
181
185
 
182
186
  def dispatch(self, topic: str, message: Union[Dict, BaseModel]):
183
- assert isinstance(topic, str), "topic must be a string"
184
-
185
- if isinstance(message, BaseModel):
186
- message = message.dict()
187
-
188
- listeners = self.listeners.get(topic, [])
189
- for listener in listeners:
190
- if listener.matches(message):
191
- self.executor.submit(self.execute, listener, message)
187
+ with self._shutdown_lock:
188
+ if self._shutdown:
189
+ # We need to drop messages after shutdown somewhere.
190
+ # Cannot be done in the executor because it's a python builtin base class.
191
+ # Could also be done in core, but it's better here because messages and _messages_internal are
192
+ # both dispatched here.
193
+ return
194
+ assert isinstance(topic, str), "topic must be a string"
195
+
196
+ if isinstance(message, BaseModel):
197
+ message = message.dict()
198
+
199
+ listeners = self.listeners.get(topic, [])
200
+ for listener in listeners:
201
+ if listener.matches(message):
202
+ self.executor.submit(self.execute, listener, message)
192
203
 
193
204
  def execute(self, listener: Listener, message: Dict):
194
205
  try:
@@ -1,11 +1,12 @@
1
1
  import logging
2
+ import sys
2
3
 
3
4
 
4
5
  def init_logging(core):
5
6
  assert hasattr(core.config, "LOG_LEVEL"), (
6
- "LOG_LEVLE setting not found in your config. In order to use logging please add \n"
7
+ "LOG_LEVEL setting not found in your config. In order to use logging please add \n"
7
8
  "> LOG_LEVEL = config.log_level()\n"
8
9
  "to your config.py"
9
10
  )
10
- logging.basicConfig(level=core.config.LOG_LEVEL)
11
+ logging.basicConfig(level=core.config.LOG_LEVEL, stream=sys.stdout)
11
12
  logging.captureWarnings(True)
@@ -12,18 +12,29 @@ from openmodule.dispatcher import MessageDispatcher
12
12
  from openmodule.models.base import ZMQMessage
13
13
 
14
14
 
15
+ def _internal_get_pub_socket(context, config, linger=100) -> zmq.Socket:
16
+ socket: zmq.Socket = context.socket(zmq.PUB)
17
+ socket.setsockopt(zmq.LINGER, linger)
18
+ socket.setsockopt(zmq.TCP_KEEPALIVE, 1)
19
+ socket.setsockopt(zmq.TCP_KEEPALIVE_IDLE, 3600)
20
+ socket.connect(config.BROKER_SUB)
21
+ return socket
22
+
23
+
15
24
  def get_sub_socket(context, config, linger=0) -> zmq.Socket:
16
- socket = context.socket(zmq.SUB)
25
+ socket: zmq.Socket = context.socket(zmq.SUB)
17
26
  socket.setsockopt(zmq.LINGER, linger)
27
+ socket.setsockopt(zmq.TCP_KEEPALIVE, 1)
28
+ socket.setsockopt(zmq.TCP_KEEPALIVE_IDLE, 3600)
18
29
  socket.connect(config.BROKER_PUB)
19
30
  return socket
20
31
 
21
32
 
22
33
  def get_pub_socket(context, config, linger=100) -> zmq.Socket:
23
- socket = context.socket(zmq.PUB)
24
- socket.setsockopt(zmq.LINGER, linger)
25
- socket.connect(config.BROKER_SUB)
26
- return socket
34
+ raise AssertionError(
35
+ "This function must not be used. Use core().publish instead (OM-697, OM-700). This is because the pub_socket "
36
+ "receives all subscriptions which will result in a memory leak until a message is sent to the socket."
37
+ )
27
38
 
28
39
 
29
40
  def wait_for_connection(dispatcher: MessageDispatcher, pub_socket=None, pub_lock=None, timeout=100):
@@ -137,15 +137,9 @@ def datetime_to_timestamp(dt: datetime):
137
137
 
138
138
  class ZMQMessage(OpenModuleModel):
139
139
  timestamp: datetime = Field(default_factory=lambda: datetime.utcnow())
140
- name: str
140
+ name: str = Field(default_factory=lambda: settings.NAME)
141
141
  type: str
142
142
 
143
- def __init__(self, **kwargs):
144
- name = kwargs.pop("name", None)
145
- if name is None:
146
- name = settings.NAME
147
- super().__init__(name=name, **kwargs)
148
-
149
143
  _tz_timestamp = timezone_validator("timestamp")
150
144
 
151
145
  def publish_on_topic(self, pub_socket: zmq.Socket, topic: str):
@@ -10,8 +10,9 @@ from pydantic import ValidationError, BaseModel, parse_obj_as
10
10
  from pydantic.main import ROOT_KEY
11
11
 
12
12
  from openmodule.config import settings
13
+ from openmodule.core import core
13
14
  from openmodule.dispatcher import DummyExecutor
14
- from openmodule.messaging import get_sub_socket, get_pub_socket, receive_message_from_socket
15
+ from openmodule.messaging import get_sub_socket, receive_message_from_socket
15
16
  from openmodule.models.rpc import RPCResponse, RPCRequest, RPCServerError
16
17
  from openmodule.rpc.common import channel_to_request_topic, channel_to_response_topic
17
18
  from openmodule.threading import get_thread_wrapper
@@ -67,7 +68,6 @@ class RPCServer(object):
67
68
  config = config or settings
68
69
  self.name = config.NAME
69
70
  self.sub = get_sub_socket(context, config)
70
- self.pub = get_pub_socket(context, config)
71
71
  self.pub_lock = threading.Lock()
72
72
  self.handlers: Dict[Tuple[str, str], HandlerEntry] = {}
73
73
  self.filters = []
@@ -102,8 +102,6 @@ class RPCServer(object):
102
102
  if self.thread:
103
103
  self.thread.join(timeout=timeout)
104
104
  else:
105
- with self.pub_lock:
106
- self.pub.close()
107
105
  self.sub.close()
108
106
 
109
107
  def register_handler(self, channel: str, type: str,
@@ -237,11 +235,7 @@ class RPCServer(object):
237
235
  response=response,
238
236
  name=self.name
239
237
  )
240
- with self.pub_lock:
241
- result.publish_on_topic(
242
- self.pub,
243
- channel_to_response_topic(channel),
244
- )
238
+ core().publish(result, channel_to_response_topic(channel))
245
239
  except zmq.ContextTerminated:
246
240
  self.log.warning(
247
241
  "context terminated while RPC request was being processed. The result might not have been sent."
@@ -267,5 +261,3 @@ class RPCServer(object):
267
261
  pass
268
262
  finally:
269
263
  self.sub.close()
270
- with self.pub_lock:
271
- self.pub.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openmodule
3
- Version: 13.5.0
3
+ Version: 13.6.0
4
4
  Summary: Libraries for developing the arivo openmodule
5
5
  Home-page: https://gitlab.com/arivo-public/device-python/openmodule.git
6
6
  Author: ARIVO
@@ -136,6 +136,7 @@ tests/test_dispatcher.py
136
136
  tests/test_health.py
137
137
  tests/test_interrupt.py
138
138
  tests/test_io_listen.py
139
+ tests/test_logging.py
139
140
  tests/test_messaging.py
140
141
  tests/test_mockrpcclient.py
141
142
  tests/test_model.py
@@ -0,0 +1 @@
1
+ {"git_version": "973c6b2", "is_release": true}
@@ -0,0 +1,104 @@
1
+ import threading
2
+ from unittest import TestCase, mock
3
+
4
+ from openmodule.alert import AlertHandleType
5
+ from openmodule.config import override_settings
6
+ from openmodule.core import core, init_openmodule, shutdown_openmodule
7
+ from openmodule.models.base import ZMQMessage
8
+ from openmodule_test.alert import AlertTestMixin
9
+ from openmodule_test.health import HealthTestMixin
10
+
11
+
12
+ class OpenModuleCoreTest(AlertTestMixin, HealthTestMixin, TestCase):
13
+ topics = ["healthpong", "sentry", "alert", "test"]
14
+ protocol = "tcp://"
15
+
16
+ @override_settings(NAME="x123x")
17
+ def test_core_init_and_shutdown(self):
18
+ self.assertIsNone(core())
19
+
20
+ init_openmodule(self.zmq_config())
21
+ try:
22
+ self.assertIsNotNone(core())
23
+ self.wait_for_health(name="x123x")
24
+ finally:
25
+ shutdown_openmodule()
26
+
27
+ @override_settings(DEBUG=False, TESTING=False)
28
+ def test_core_sentry_error_logging(self):
29
+ # sentry is not active during unittests / debug
30
+ init_openmodule(self.zmq_config())
31
+ self.wait_for_health()
32
+
33
+ try:
34
+ core().log.error("some-error-message")
35
+ sentry_message = self.zmq_client.wait_for_message_on_topic("sentry")
36
+ self.assertIn("some-error-message", str(sentry_message))
37
+ finally:
38
+ shutdown_openmodule()
39
+
40
+ def test_core_alerts(self):
41
+ init_openmodule(self.zmq_config())
42
+ self.wait_for_health()
43
+
44
+ try:
45
+ core().alerts.send("some_type", AlertHandleType.state_change)
46
+ self.assertAlert(alert_type="some_type")
47
+ finally:
48
+ shutdown_openmodule()
49
+
50
+ def test_shutdown_wait_for_message_handling(self):
51
+ def handler(_):
52
+ nonlocal error
53
+ handler_started.set()
54
+ if shutdown_finished.wait(timeout=3):
55
+ error = "shutdown finished while message was still being handled"
56
+ return
57
+ if core().messages._shutdown:
58
+ error = "shutdown flag was set while message was still being handled"
59
+
60
+ error = ""
61
+ handler_started = threading.Event()
62
+ shutdown_finished = threading.Event()
63
+ init_openmodule(self.zmq_config())
64
+ self.wait_for_health()
65
+ core().messages.register_handler("test", ZMQMessage, handler, register_schema=False, match_type=False)
66
+ core().publish(ZMQMessage(type="test"), "test")
67
+ self.assertTrue(handler_started.wait(timeout=3))
68
+ try:
69
+ core().shutdown()
70
+ shutdown_finished.set()
71
+ self.assertEqual(error, "")
72
+ finally:
73
+ shutdown_openmodule()
74
+
75
+ def test_no_message_submit_after_shutdown(self):
76
+ def dispatch_wrapper(topic, message):
77
+ nonlocal error
78
+ dispatch_started.set()
79
+ if not shutdown_done.wait(timeout=3):
80
+ error = "shutdown did not finish when expected"
81
+ original_dispatch(topic, message)
82
+ dispatch_done.set()
83
+
84
+ error = ""
85
+ dispatch_started = threading.Event()
86
+ dispatch_done = threading.Event()
87
+ shutdown_done = threading.Event()
88
+ init_openmodule(self.zmq_config())
89
+ self.wait_for_health()
90
+ original_dispatch = core().messages.dispatch
91
+ handler = mock.MagicMock()
92
+ core().messages.dispatch = dispatch_wrapper
93
+
94
+ core().messages.register_handler("test", ZMQMessage, handler, register_schema=False, match_type=False)
95
+ core().publish(ZMQMessage(type="test"), "test")
96
+ self.assertTrue(dispatch_started.wait(timeout=3))
97
+ try:
98
+ with mock.patch("zmq.Context.term", side_effect=shutdown_done.set):
99
+ core().shutdown()
100
+ self.assertTrue(dispatch_done.wait(timeout=3))
101
+ self.assertFalse(handler.called)
102
+ self.assertEqual(error, "")
103
+ finally:
104
+ shutdown_openmodule()
@@ -23,6 +23,14 @@ from tests.database_models_test import DatabaseTestModel
23
23
  class DatabaseTest(SQLiteTestMixin, TestCase):
24
24
  alembic_path = "../tests/test_database"
25
25
 
26
+ @classmethod
27
+ def tearDownClass(cls):
28
+ super().tearDownClass()
29
+ try:
30
+ os.unlink(database_path(cls.get_database_folder(), "asdf"))
31
+ except FileNotFoundError:
32
+ pass
33
+
26
34
  def test_filter(self):
27
35
  data = [DatabaseTestModel(value1=x, value2=x % 3) for x in range(5)]
28
36
  with self.database as db:
@@ -257,6 +265,14 @@ class DatabaseTest(SQLiteTestMixin, TestCase):
257
265
  class ShutdownTestCase(TestCase):
258
266
  alembic_path = "../tests/test_database"
259
267
 
268
+ @classmethod
269
+ def tearDownClass(cls):
270
+ super().tearDownClass()
271
+ try:
272
+ os.unlink(database_path(settings.DATABASE_FOLDER, "shutdown"))
273
+ except FileNotFoundError:
274
+ pass
275
+
260
276
  def get_database(self):
261
277
  return Database(settings.DATABASE_FOLDER, name="shutdown", alembic_path=self.alembic_path)
262
278
 
@@ -409,6 +425,13 @@ class DowngradeMigrationSequenceNameTest(SQLiteTestMixin, TestCase):
409
425
 
410
426
 
411
427
  class DatabaseMigrationProcessFailTest(TestCase):
428
+ @classmethod
429
+ def tearDownClass(cls):
430
+ super().tearDownClass()
431
+ try:
432
+ os.unlink(database_path(cls.get_database_folder(), "database"))
433
+ except FileNotFoundError:
434
+ pass
412
435
 
413
436
  @classmethod
414
437
  def get_database_folder(cls):
@@ -2,7 +2,7 @@ from concurrent.futures.process import ProcessPoolExecutor
2
2
  from concurrent.futures.thread import ThreadPoolExecutor
3
3
  from functools import partial
4
4
  from typing import Any
5
- from unittest import TestCase
5
+ from unittest import TestCase, mock
6
6
 
7
7
  from openmodule.config import settings
8
8
  from openmodule.dispatcher import MessageDispatcher, SubscribingMessageDispatcher
@@ -15,7 +15,8 @@ class MessageDispatcherBaseTest(TestCase):
15
15
  dispatcher: MessageDispatcher
16
16
  message: Any
17
17
 
18
- def dummy_message(self, type="test", **kwargs):
18
+ @staticmethod
19
+ def dummy_message(type="test", **kwargs):
19
20
  return {"type": type, "name": "testclient", **kwargs}
20
21
 
21
22
  def _set_true_handler(self, message, var="message"):
@@ -120,10 +121,19 @@ class MessageDispatcherBasicsTestCase(MessageDispatcherBaseTest):
120
121
  self.dispatcher.register_handler("test", MessageWithoutType, self._set_true_handler, match_type=True)
121
122
  self.assertIn("class definition does not set a `type` field", str(e.exception))
122
123
 
124
+ def test_no_message_handling_after_shutdown(self):
125
+ handler = mock.MagicMock()
126
+ self.dispatcher.register_handler("test", ZMQMessage, handler, register_schema=False, match_type=False)
127
+ self.dispatcher.dispatch("test", {"type": "test"})
128
+ self.assertEqual(1, handler.call_count)
129
+ self.dispatcher.shutdown()
130
+ self.dispatcher.dispatch("test", {"type": "test"})
131
+ self.assertEqual(1, handler.call_count)
132
+
123
133
 
124
134
  class MessageDispatcherWithoutExecutorTestCase(MessageDispatcherBaseTest):
125
135
  def test_exception_in_handler(self):
126
- def raises_exception(message):
136
+ def raises_exception(_):
127
137
  raises_exception.register_schema = False
128
138
  raise Exception("something broke!")
129
139
 
@@ -133,7 +143,7 @@ class MessageDispatcherWithoutExecutorTestCase(MessageDispatcherBaseTest):
133
143
  self.assertIn("something broke!", cm.output[0])
134
144
 
135
145
  def test_validation_error(self):
136
- def handler(x):
146
+ def handler(_):
137
147
  pass
138
148
 
139
149
  handler.register_schema = False
@@ -0,0 +1,29 @@
1
+ import io
2
+ import logging
3
+ from unittest import TestCase, mock
4
+
5
+ import openmodule.logging
6
+
7
+
8
+ class LoggingTestCase(TestCase):
9
+ def test_logging_to_stdout(self):
10
+ logging.basicConfig(force=True) # reset logging
11
+ stdout = io.StringIO()
12
+ stderr = io.StringIO()
13
+ with mock.patch("sys.stdout.write", stdout.write), mock.patch("sys.stderr.write", stderr.write):
14
+ logging.warning("test")
15
+ self.assertNotIn("test", stdout.getvalue())
16
+ self.assertIn("test", stderr.getvalue())
17
+
18
+ core = mock.MagicMock()
19
+ core.config.LOG_LEVEL = logging.INFO
20
+ for h in logging.root.handlers[:]: # reset logging again
21
+ logging.root.removeHandler(h)
22
+ h.close()
23
+ openmodule.logging.init_logging(core)
24
+ stdout = io.StringIO()
25
+ stderr = io.StringIO()
26
+ with mock.patch("sys.stdout.write", stdout.write), mock.patch("sys.stderr.write", stderr.write):
27
+ logging.warning("test")
28
+ self.assertIn("test", stdout.getvalue())
29
+ self.assertNotIn("test", stderr.getvalue())
@@ -8,7 +8,8 @@ import orjson
8
8
  import zmq
9
9
 
10
10
  from openmodule.config import override_context
11
- from openmodule.messaging import get_pub_socket, get_sub_socket, receive_message_from_socket, wait_for_connection
11
+ from openmodule.messaging import get_sub_socket, receive_message_from_socket, wait_for_connection, \
12
+ _internal_get_pub_socket, get_pub_socket
12
13
  from openmodule_test.core import OpenModuleCoreTestMixin
13
14
  from openmodule_test.zeromq import TestBroker, fake_config, TestClient
14
15
 
@@ -29,7 +30,7 @@ class MessagingTest(TestCase):
29
30
  self.broker = TestBroker(sub, pub)
30
31
  self.broker.start()
31
32
 
32
- self.pub_socket = get_pub_socket(self.broker.context, fake_config(self.broker))
33
+ self.pub_socket = _internal_get_pub_socket(self.broker.context, fake_config(self.broker))
33
34
  self.sub_socket = get_sub_socket(self.broker.context, fake_config(self.broker))
34
35
  self.sub_socket.subscribe(b"topic")
35
36
 
@@ -102,6 +103,11 @@ class MessagingTest(TestCase):
102
103
  self.assertEqual(res, (None, None))
103
104
  self.assertIn("not a dict", str(cm.output))
104
105
 
106
+ def disallow_pub_socket_creation(self):
107
+ with self.assertRaises(AssertionError) as e:
108
+ get_pub_socket(self.broker.context, fake_config(self.broker))
109
+ self.assertIn("OM-697, OM-700", str(e.exception))
110
+
105
111
 
106
112
  class WaitForConnectionTestCase(OpenModuleCoreTestMixin, TestCase):
107
113
  protocol = "tcp://"
@@ -110,13 +116,13 @@ class WaitForConnectionTestCase(OpenModuleCoreTestMixin, TestCase):
110
116
  wait_for_connection(self.core.messages)
111
117
 
112
118
  def test_wait_for_connection(self):
113
- pub_socket = get_pub_socket(self.zmq_context(), self.zmq_config())
119
+ pub_socket = _internal_get_pub_socket(self.zmq_context(), self.zmq_config())
114
120
  wait_for_connection(self.core.messages, pub_socket)
115
121
 
116
122
  def test_wait_for_connection_timeout(self):
117
123
  try:
118
124
  with override_context(BROKER_SUB="tcp://127.0.0.1:900"):
119
- incorrect_pub_socket = get_pub_socket(self.zmq_context(), self.zmq_config())
125
+ incorrect_pub_socket = _internal_get_pub_socket(self.zmq_context(), self.zmq_config())
120
126
 
121
127
  with self.assertRaises(TimeoutError):
122
128
  wait_for_connection(self.core.messages, incorrect_pub_socket, timeout=3)
@@ -102,7 +102,7 @@ class RPCResponseWithStatus(OpenModuleModel):
102
102
  status = "bad"
103
103
 
104
104
 
105
- class RPCServerTestCase(RPCServerTestMixin):
105
+ class RPCServerTestCase(RPCServerTestMixin, OpenModuleCoreTestMixin):
106
106
  rpc_channels = ["channel", "channel2", "a", "ab"]
107
107
  topics = ["test"]
108
108
 
@@ -465,7 +465,7 @@ class RPCServerTestCase(RPCServerTestMixin):
465
465
  def publishing_handler(*_, **__):
466
466
  """test handler which publishes a message"""
467
467
  message = ZMQMessage(type="abc")
468
- message.publish_on_topic(self.server.pub, "test")
468
+ self.core.publish(message, "test")
469
469
 
470
470
  self.server.register_handler("channel", "test", EmptyModel, EmptyModel, publishing_handler)
471
471
  self.wait_for_rpc_server(self.server)
@@ -748,5 +748,3 @@ class RPCServerMultithreadingTest(OpenModuleCoreTestMixin, RPCServerTestMixin, T
748
748
  self.rpc_no_response("test", "test", EmptyModel())
749
749
  self.zmq_client.wait_for_message_on_topic("sentry")
750
750
  self.assertTrue(cm.output)
751
-
752
-
@@ -1 +0,0 @@
1
- {"git_version": "84be0cd", "is_release": true}
@@ -1,48 +0,0 @@
1
- from unittest import TestCase
2
-
3
- from openmodule_test.core import OpenModuleCoreTestMixin
4
-
5
- from openmodule.alert import AlertHandleType
6
- from openmodule.config import override_settings
7
- from openmodule.core import core, init_openmodule, shutdown_openmodule
8
- from openmodule_test.alert import AlertTestMixin
9
- from openmodule_test.health import HealthTestMixin
10
-
11
-
12
- class OpenModuleCoreTest(AlertTestMixin, HealthTestMixin, TestCase):
13
- topics = ["healthpong", "sentry", "alert"]
14
- protocol = "tcp://"
15
-
16
- @override_settings(NAME="x123x")
17
- def test_core_init_and_shutdown(self):
18
- self.assertIsNone(core())
19
-
20
- init_openmodule(self.zmq_config())
21
- try:
22
- self.assertIsNotNone(core())
23
- self.wait_for_health(name="x123x")
24
- finally:
25
- shutdown_openmodule()
26
-
27
- @override_settings(DEBUG=False, TESTING=False)
28
- def test_core_sentry_error_logging(self):
29
- # sentry is not active during unittests / debug
30
- init_openmodule(self.zmq_config())
31
- self.wait_for_health()
32
-
33
- try:
34
- core().log.error("some-error-message")
35
- sentry_message = self.zmq_client.wait_for_message_on_topic("sentry")
36
- self.assertIn("some-error-message", str(sentry_message))
37
- finally:
38
- shutdown_openmodule()
39
-
40
- def test_core_alerts(self):
41
- init_openmodule(self.zmq_config())
42
- self.wait_for_health()
43
-
44
- try:
45
- core().alerts.send("some_type", AlertHandleType.state_change)
46
- self.assertAlert(alert_type="some_type")
47
- finally:
48
- shutdown_openmodule()
File without changes
File without changes
File without changes
File without changes
File without changes