Hello, Fabric users: I'm attempting to write automated tests for an inherited 1.3.3 fabfile and am stuck on a problem involving execute() and the env.*host* variables.
The convoluted "top level" task adjusts the list of remote/target hosts based on user input and then calls a number of other subtasks via execute(). I am attempting to verify that the subtasks are executed on the expected hosts. It seems that both the parsing/merging of env.hosts/roles/roledefs is done in execute() as well as the spawning of subtask processes and I'm stumped on bypassing the spawning piece. Note that in this particular test, I don't care what the subtasks do, just that they're executed; their logic will be tested separately. The ideal test will also prevent any changes to the ordering of host lists in future Fabric releases from going unnoticed. The best testing solution I've come up with involves replacing the real subtasks with mocks that append their env.host to a file since that's easily shared between processes. My sample code is at https://gist.github.com/3753107. Any suggestions on how I can tell what hosts execute() is about to be called for without forking processes? Thanks! -- _______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
