SEBA-79 hooks for synchronizer testing;
allow steps with "test" in the middle of the filename
Change-Id: I148c9a522ddb73acd00cfddaadf8fcda911be248
diff --git a/xos/synchronizers/new_base/backend.py b/xos/synchronizers/new_base/backend.py
index ea33c9b..04cd41f 100644
--- a/xos/synchronizers/new_base/backend.py
+++ b/xos/synchronizers/new_base/backend.py
@@ -51,7 +51,7 @@
for fn in os.listdir(step_dir):
pathname = os.path.join(step_dir,fn)
- if os.path.isfile(pathname) and fn.endswith(".py") and (fn!="__init__.py") and not "test" in fn:
+ if os.path.isfile(pathname) and fn.endswith(".py") and (fn!="__init__.py") and (not fn.startswith("test")):
# we need to extend the path to load modules in the step_dir
sys_path_save = sys.path
diff --git a/xos/synchronizers/new_base/event_loop.py b/xos/synchronizers/new_base/event_loop.py
index 1a1a4f4..54d3fef 100644
--- a/xos/synchronizers/new_base/event_loop.py
+++ b/xos/synchronizers/new_base/event_loop.py
@@ -239,6 +239,12 @@
model_accessor.journal_object(o, "syncstep.call.save_update")
o.save(update_fields=['enacted', 'backend_status',
'backend_register', 'backend_code'])
+
+ if hasattr(step, "after_sync_save"):
+ step.log = log.bind(step=step)
+ step.after_sync_save(o)
+ step.log = self.log
+
log.info("Saved sync object, new enacted", enacted=new_enacted)
""" This function needs a cleanup. FIXME: Rethink backend_status, backend_register """
diff --git a/xos/synchronizers/new_base/model_policy_loop.py b/xos/synchronizers/new_base/model_policy_loop.py
index 7977690..b6f5ec4 100644
--- a/xos/synchronizers/new_base/model_policy_loop.py
+++ b/xos/synchronizers/new_base/model_policy_loop.py
@@ -144,6 +144,9 @@
instance.policy_status = "done"
instance.policy_code = 1
instance.save(update_fields=['policed', 'policy_status', 'policy_code'])
+
+ if hasattr(policy, "after_policy_save"):
+ policy().after_policy_save(instance)
except:
log.exception('MODEL POLICY: Object failed to update policed timestamp', instance =instance)