p1-taskqueue 0.1.3__tar.gz → 0.1.4__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.

Potentially problematic release.


This version of p1-taskqueue might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: p1-taskqueue
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: A Task Queue Wrapper for Dekoruma Backend
5
5
  Author-email: Chalvin <engineering@dekoruma.com>
6
6
  Project-URL: Homepage, https://github.com/Dekoruma/p1-taskqueue
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "p1-taskqueue"
7
7
  # DO NOT CHANGE THIS VERSION - it gets automatically replaced by CI/CD with the git tag version
8
- version = "0.1.3"
8
+ version = "0.1.4"
9
9
  description = "A Task Queue Wrapper for Dekoruma Backend"
10
10
  authors = [
11
11
  {name = "Chalvin", email = "engineering@dekoruma.com"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: p1-taskqueue
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: A Task Queue Wrapper for Dekoruma Backend
5
5
  Author-email: Chalvin <engineering@dekoruma.com>
6
6
  Project-URL: Homepage, https://github.com/Dekoruma/p1-taskqueue
@@ -12,4 +12,5 @@ src/taskqueue/libs/__init__.py
12
12
  src/taskqueue/libs/helper_test.py
13
13
  tests/test_celery_app.py
14
14
  tests/test_cmanager.py
15
+ tests/test_return_values.py
15
16
  tests/test_test_utils.py
@@ -209,7 +209,8 @@ def dynamic_function_executor(self, module_path, function_name, args=None, kwarg
209
209
  function = getattr(module, function_name)
210
210
  args = args or []
211
211
  kwargs = kwargs or {}
212
- return function(*args, **kwargs)
212
+ function(*args, **kwargs)
213
+ return None
213
214
  except Exception as e:
214
215
  current_retries = getattr(self.request, 'retries', 0) or 0
215
216
  max_retries = self.max_retries or K_MAX_RETRY_COUNT
@@ -235,7 +236,8 @@ def dynamic_class_method_executor(self, module_path, class_name, method_name, ar
235
236
  method = getattr(instance, method_name)
236
237
  args = args or []
237
238
  kwargs = kwargs or {}
238
- return method(*args, **kwargs)
239
+ method(*args, **kwargs)
240
+ return None
239
241
  except Exception as e:
240
242
  current_retries = getattr(self.request, 'retries', 0) or 0
241
243
  max_retries = self.max_retries or K_MAX_RETRY_COUNT
@@ -73,7 +73,7 @@ def celery_worker_burst(include_func_names: List[str], channel: str = "default")
73
73
  logger.info(
74
74
  f"Successfully executed task: {full_func_name}")
75
75
  else:
76
- logger.debug(
76
+ logger.info(
77
77
  f"Skipping: {full_func_name or task_name}")
78
78
  message.ack()
79
79
 
@@ -0,0 +1,83 @@
1
+ from taskqueue.cmanager import dynamic_class_method_executor
2
+ from taskqueue.cmanager import dynamic_function_executor
3
+
4
+
5
+ def function_that_returns_value():
6
+ return "function_return_value"
7
+
8
+
9
+ class TestClass:
10
+ def method_that_returns_value(self):
11
+ return "method_return_value"
12
+
13
+
14
+ class TestExecutorReturnValues:
15
+
16
+ def test_dynamic_function_executor_given_function_returns_value_expect_return_none(self):
17
+ result = dynamic_function_executor(
18
+ "tests.test_return_values",
19
+ "function_that_returns_value",
20
+ [],
21
+ {},
22
+ None
23
+ )
24
+
25
+ assert result is None
26
+
27
+ def test_dynamic_class_method_executor_given_method_returns_value_expect_return_none(self):
28
+ result = dynamic_class_method_executor(
29
+ "tests.test_return_values",
30
+ "TestClass",
31
+ "method_that_returns_value",
32
+ [],
33
+ {},
34
+ None
35
+ )
36
+
37
+ assert result is None
38
+
39
+ def test_dynamic_function_executor_given_function_with_side_effects_expect_function_executed_and_return_none(self):
40
+ global function_executed
41
+ function_executed = False
42
+
43
+ def function_with_side_effect():
44
+ global function_executed
45
+ function_executed = True
46
+ return "should_be_ignored"
47
+
48
+ import sys
49
+ sys.modules[__name__].function_with_side_effect = function_with_side_effect
50
+
51
+ result = dynamic_function_executor(
52
+ "tests.test_return_values",
53
+ "function_with_side_effect",
54
+ [],
55
+ {},
56
+ None
57
+ )
58
+
59
+ assert function_executed
60
+ assert result is None
61
+
62
+ def test_dynamic_class_method_executor_given_method_with_side_effects_expect_method_executed_and_return_none(self):
63
+ class TestClassWithSideEffect:
64
+ def __init__(self):
65
+ self.method_executed = False
66
+
67
+ def method_with_side_effect(self):
68
+ self.method_executed = True
69
+ return "should_be_ignored"
70
+
71
+ import sys
72
+ sys.modules[__name__].TestClassWithSideEffect = TestClassWithSideEffect
73
+
74
+ result = dynamic_class_method_executor(
75
+ "tests.test_return_values",
76
+ "TestClassWithSideEffect",
77
+ "method_with_side_effect",
78
+ [],
79
+ {},
80
+ None
81
+ )
82
+
83
+ assert result is None
File without changes
File without changes