schrodinger.test.decorate_fflag module¶
Enable or disable a feature flag in a specific situation. Can be used as a decorator for a TestCase class or a test function, or as a context manager. See nose_plugin_test.py for examples. Multiple feature flag toggling decorators/contexts can be nested to define desired feature flag environment.
@copyright: (c) Schrodinger, LLC All rights reserved.
-
class
schrodinger.test.decorate_fflag.enable_feature_flag(flag)[source]¶ Bases:
contextlib.ContextDecoratorProvides a decorator/context manager for enabling feature flags. Methods are named to allow this to be used the same ways as Mock’s patches:
As context manager
As function or test class decorator
Explicit start and stop.
-
on= 1¶
-
class
schrodinger.test.decorate_fflag.disable_feature_flag(flag)[source]¶ Bases:
schrodinger.test.decorate_fflag.enable_feature_flagDisable a feature flag as either a context manager or a decorator for a unittest.TestCase or a test function. :type flag: str :param flag: Name of the feature flag to be disabled.
-
on= 0¶
-
__init__(flag)¶ Initialize self. See help(type(self)) for accurate signature.
-
start()¶ Starts the patching. Used both in the decorator and the context manager.
-
stop()¶ Stops the patching. Used both in the decorator context and the context manager context.
-