openmodule-test 13.5.0__tar.gz → 14.0.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 (33) hide show
  1. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/ChangeLog +12 -18
  2. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/PKG-INFO +1 -1
  3. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/interrupt.py +0 -1
  4. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/openmodule_test.egg-info/PKG-INFO +1 -1
  5. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/openmodule_test.egg-info/SOURCES.txt +1 -0
  6. openmodule_test-14.0.0/openmodule_test.egg-info/pbr.json +1 -0
  7. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/openmodule_test.egg-info/requires.txt +0 -1
  8. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/requirements.txt +0 -1
  9. openmodule_test-14.0.0/sentry.py +65 -0
  10. openmodule_test-14.0.0/utils.py +36 -0
  11. openmodule_test-13.5.0/openmodule_test.egg-info/pbr.json +0 -1
  12. openmodule_test-13.5.0/utils.py +0 -9
  13. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/AUTHORS +0 -0
  14. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/__init__.py +0 -0
  15. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/alert.py +0 -0
  16. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/connection_status.py +0 -0
  17. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/core.py +0 -0
  18. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/database.py +0 -0
  19. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/eventlistener.py +0 -0
  20. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/files.py +0 -0
  21. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/gate.py +0 -0
  22. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/health.py +0 -0
  23. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/io_simulator.py +0 -0
  24. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/openmodule_test.egg-info/dependency_links.txt +0 -0
  25. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/openmodule_test.egg-info/not-zip-safe +0 -0
  26. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/openmodule_test.egg-info/top_level.txt +0 -0
  27. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/package_reader.py +0 -0
  28. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/presence.py +0 -0
  29. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/rpc.py +0 -0
  30. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/settings.py +0 -0
  31. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/setup.cfg +0 -0
  32. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/setup.py +0 -0
  33. {openmodule_test-13.5.0 → openmodule_test-14.0.0}/zeromq.py +0 -0
@@ -1,6 +1,18 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ v14.0.0
5
+ -------
6
+
7
+ * Add breaking changes to docs
8
+ * OM-693 Openmodule sentry v2
9
+ * Update known\_issues.md [skip ci]
10
+
11
+ v13.6.0
12
+ -------
13
+
14
+ * OM-697 OpenModule Verbesserungen
15
+
4
16
  v13.5.0
5
17
  -------
6
18
 
@@ -147,8 +159,6 @@ v12.0.0.rc0
147
159
  * SettingsProvider docs
148
160
  * SettingsProvider docs
149
161
  * added settings\_models requirement, marking Test\* classes that are not tests with \_\_test\_\_ = False
150
- * AAAAAAAABBBBBBBBBBBBBBMerge branch 'master' into DEV-5415
151
- * [skip ci] Broken until settings\_model pip package is fixed. Removed deprecated features for v12. Using settings\_models in SettingsProvider
152
162
 
153
163
  v11.1.1
154
164
  -------
@@ -159,11 +169,6 @@ v11.1.0
159
169
  -------
160
170
 
161
171
  * 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
172
  * removed mock rpcs from schema
168
173
 
169
174
  v11.0.3
@@ -204,14 +209,3 @@ v10.0.2
204
209
  -------
205
210
 
206
211
  * touching a filer, since the tag's job is skipped because the commit mentioned 'sk\_ip ci'
207
-
208
- v10.0.2.rc2
209
- -----------
210
-
211
- * added more documentation [skip ci]
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_test
3
- Version: 13.5.0
3
+ Version: 14.0.0
4
4
  Summary: Libraries for testing openmodule services
5
5
  Home-page: https://gitlab.com/arivo-public/device-python/openmodule.git
6
6
  Author: ARIVO
@@ -4,7 +4,6 @@ import queue
4
4
  import sys
5
5
  import time
6
6
  import traceback
7
- import warnings
8
7
  from multiprocessing import Process, Event
9
8
  from signal import SIGINT, SIGKILL
10
9
  from textwrap import dedent
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openmodule-test
3
- Version: 13.5.0
3
+ Version: 14.0.0
4
4
  Summary: Libraries for testing openmodule services
5
5
  Home-page: https://gitlab.com/arivo-public/device-python/openmodule.git
6
6
  Author: ARIVO
@@ -17,6 +17,7 @@ setup.py
17
17
  ./package_reader.py
18
18
  ./presence.py
19
19
  ./rpc.py
20
+ ./sentry.py
20
21
  ./settings.py
21
22
  ./utils.py
22
23
  ./zeromq.py
@@ -0,0 +1 @@
1
+ {"git_version": "bdd61c9", "is_release": true}
@@ -1,3 +1,2 @@
1
1
  multiprocessing_logging
2
- fakeredis==1.7.6
3
2
  freezegun
@@ -1,3 +1,2 @@
1
1
  multiprocessing_logging
2
- fakeredis==1.7.6
3
2
  freezegun
@@ -0,0 +1,65 @@
1
+ from typing import List
2
+ from unittest import TestCase, mock
3
+
4
+ import sentry_sdk
5
+ from sentry_sdk.envelope import Envelope
6
+
7
+ from openmodule import sentry
8
+ from openmodule_test.utils import wait_for_value
9
+
10
+
11
+ class SentryTestTransport(sentry_sdk.transport.Transport):
12
+ """
13
+ Custom transport for testing that stores envelopes in a list.
14
+ """
15
+
16
+ def __init__(self, options=None):
17
+ super().__init__(options)
18
+ self.envelopes: List[Envelope] = []
19
+
20
+ def capture_envelope(self, envelope: Envelope):
21
+ self.envelopes.append(envelope)
22
+
23
+ def get_envelopes(self, clear: bool = True) -> List[Envelope]:
24
+ envelopes = self.envelopes
25
+ if clear:
26
+ self.envelopes = []
27
+ return envelopes
28
+
29
+
30
+ class SentryTestMixin(TestCase):
31
+ """
32
+ Test mixin for testing with sentry. It patches the sentry transport to store envelopes in a list.
33
+ Provides the get_sent_envelopes method to get the stored envelopes.
34
+ """
35
+ _sentry_transport_patch: mock._patch
36
+
37
+ @classmethod
38
+ def setUpClass(cls) -> None:
39
+ cls._sentry_transport_patch = mock.patch("openmodule.sentry.StoringTransport", SentryTestTransport)
40
+ cls._sentry_transport_patch.start()
41
+ super().setUpClass()
42
+
43
+ def tearDown(self) -> None:
44
+ super().tearDown()
45
+ sentry.deinit_sentry()
46
+
47
+ @classmethod
48
+ def tearDownClass(cls) -> None:
49
+ super().tearDownClass()
50
+ cls._sentry_transport_patch.stop()
51
+
52
+ @property
53
+ def sentry_transport(self) -> SentryTestTransport:
54
+ transport = sentry_sdk.get_global_scope().client.transport
55
+ self.assertIsInstance(transport, SentryTestTransport)
56
+ return transport
57
+
58
+ def _get_envelopes(self) -> List[Envelope]:
59
+ return self.sentry_transport.envelopes
60
+
61
+ def get_sent_envelopes(self, timeout: float = 0, clear: bool = True) -> List[Envelope]:
62
+ envelopes = wait_for_value(self._get_envelopes, target=[], invert_target=True, timeout=timeout)
63
+ if clear:
64
+ self.sentry_transport.envelopes = []
65
+ return envelopes
@@ -0,0 +1,36 @@
1
+ import time
2
+ from typing import Optional, Callable, TypeVar
3
+
4
+ T = TypeVar("T")
5
+ NoTarget = object()
6
+
7
+
8
+ class DeveloperError(Exception):
9
+ """
10
+ An exception which indicates a developer error. This is used instead of assertions in testcases because if
11
+ one were to check for AssertionErrors and an assertion is raised not because of a tested condition, but
12
+ because the test-utils were used incorrectly, then there is no way to distinguish between those.
13
+
14
+ Use only in testcases, use normal assertions for service code. you can still use assertions in
15
+ setUp(), tearDown(), setUpClass(), tearDownClass() code, because nobody would catch assertions there
16
+ """
17
+
18
+
19
+ def wait_for_value(getter: Callable[[], Optional[T]], target: Optional[T] = NoTarget, invert_target: bool = False,
20
+ timeout: float = 3, sleep_time: float = 0.01) -> T:
21
+ """
22
+ Waits until the getter returns the target value or the target value.
23
+ If no target is specified, waits until the getter returns a value different from the first value it returned.
24
+ WARNING: your code might be fast enough that the first value is already the 'changed' value, in that case
25
+ this function will wait for the timeout. If you want to avoid this, specify a target.
26
+ If invert_target is True, waits until the getter returns a value different from the target value.
27
+ """
28
+ start = current = getter()
29
+ end_time = time.time() + timeout
30
+ while (target is NoTarget and current == start) or (
31
+ target is not NoTarget and (current == target) == invert_target):
32
+ time.sleep(sleep_time)
33
+ current = getter()
34
+ if time.time() > end_time:
35
+ raise TimeoutError(f"Timeout waiting for value {target}. Current value: {current}")
36
+ return current
@@ -1 +0,0 @@
1
- {"git_version": "84be0cd", "is_release": true}
@@ -1,9 +0,0 @@
1
- class DeveloperError(Exception):
2
- """
3
- An exception which indicates a developer error. This is used instead of assertions in testcases because if
4
- one were to check for AssertionErrors and an assertion is raised not because of a tested condition, but
5
- because the test-utils were used incorrectly, then there is no way to distinguish between those.
6
-
7
- Use only in testcases, use normal assertions for service code. you can still use assertions in
8
- setUp(), tearDown(), setUpClass(), tearDownClass() code, because nobody would catch assertions there
9
- """