Testable triggers for SouthPaw Tactic.
The last six months have been spent working on a project based around the recently open-sourced Tactic. One issue we came up against during the project was being able to easily develop and test custom triggers.
Custom triggers are simply python scripts that have a couple of extra magic variables (server, input), ignoring the fact that the input variable is actually shadowing a builtin the fact we have magic variables makes this a little more difficult there is however a rather simple approach that gets around this problem.
def main(server, input_data): pass if __name__ == '__builtin__': main(server, input) elif __name__ == '__main__': pass # Create server instance and input dictionary for testing.
This of course is very similar to the standard way of making a module either usable within a program or from the command line.
In addition to this code we have developed a library for importing and exporting triggers, scripts etc from Tactic which we are likely to release back to the community in the near future.