|
From: | Chris Spencer |
Subject: | Re: [Fab-user] Clearing runs_once? |
Date: | Sat, 11 Mar 2017 12:43:14 -0500 |
Looks like fabric keeps a dictionary of found tasks in fabric.state.commands: https://github.com/fabric/fabric/ blob/1.13.1/fabric/state.py# L405 You could give this a try:```from fabric.state import commandsfor task in commands.values():if hasattr(task, 'return_value'):del task.return_value```On Fri, Mar 10, 2017 at 11:36 AM Chris Spencer <address@hidden> wrote:______________________________Is there an easier to to reset @runs_once globally?I'm trying to write unittests to check some Fabric-based functionality, and I'm running into some roadblocks with the @runs_once decorator. Some tests are failing when other tests call tasks decorated by @runs_once, since the decorator caches the very first return value.From inspecting the code, I see I can simply clear this by doing `del mytask.return_value`. However, to properly fix this in all tests, I'll have to track down every task that uses @runs_once and delete this, which will be tedious._________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
[Prev in Thread] | Current Thread | [Next in Thread] |