Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

SwitchContextManager doesn't work with hierarchical switches #34

Open
mbox opened this issue Apr 2, 2012 · 1 comment
Open

SwitchContextManager doesn't work with hierarchical switches #34

mbox opened this issue Apr 2, 2012 · 1 comment

Comments

@mbox
Copy link

mbox commented Apr 2, 2012

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 added a commit to tellybug/gargoyle that referenced this issue Apr 2, 2012
…rchical 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
@acdha
Copy link

acdha commented Aug 27, 2012

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants