Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

SwitchContextManager doesn't work with hierarchical switches #34

Open
mbox opened this Issue · 1 comment

2 participants

@mbox

The syntax for SwitchContextManager is with switches(my_switch_name=True):, which requires my_switch_name to be a valid Python identifier.

Hierarchical switches use ":" to separate path components - which isn't a valid character in an identifier.

@mbox mbox referenced this issue from a commit in tellybug/gargoyle
@mbox mbox Fix for issue #34: SwitchContextManager doesn't work with hierarchica…
…l switches

Adds support for a "switches" kwarg on the decorator - if the switch name is
not a valid ID you can use @switches(switches={'test:a:hierarchy': True}) to set
the default value
376b9d6
@acdha

I just ran into this & ended up using mock.patch to force the values I needed:

@patch("gargoyle.gargoyle.is_active", return_value=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.