Why are you pulling test out of kwargs? if test=True is set for the state run it will not show up in kwargs like this.