blob: 058cd51f4c4b55305af97391ea170f2f4f3217ba [file] [log] [blame]
def set_b(val):
# Can touch vars from a function called from 'exec' context.
shared_vars.b.set(val)
shared_vars = struct(
a = lucicfg.var(),
b = lucicfg.var(),
set_b = set_b,
)
# Verify we can't touch them from the top scope of a module being 'load'ed.
assert.fails(lambda: shared_vars.a.set(123), "only code that is being ...")
assert.fails(lambda: shared_vars.a.get(), "only code that is being ...")
# Even through a function.
assert.fails(lambda: set_b(123), "only code that is being ...")