Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_parse_target(self):
scope = scope_tree_to_scope({
'modules': {
'a': {
'modules': {
'b': {
'modules': {
'c': {}
},
'rules': ['r'],
}
}
}
}
})
c, (r, ) = run_task(scope.parse_target(DummyRuntime(), 'a.b.c|a.b.r'))
assert type(c) is DummyModule and c.name == 'a.b.c'
assert type(r) is DummyRule and r.name == 'a.b.r'
def wrapper(*args, **kwargs):
return run_task(f(*args, **kwargs))
def test_plugin_get_reup_fields(context, type, fields):
handle = TestDisplayHandle()
return run_task(
plugin.plugin_get_reup_fields(context, type, fields, handle))
args = docopt_parse_args(argv)
command = args['']
ret = maybe_print_help_and_return(args)
if ret is not None:
return ret
try:
runtime = run_task(Runtime(args, env))
if not args['--quiet']:
parser.warn_duplicate_keys(runtime.peru_file)
scope, imports = parser.parse_file(runtime.peru_file)
params = CommandParams(args, runtime, scope, imports)
command_fn = COMMAND_FNS[command]
run_task(command_fn(params))
except PrintableError as e:
if args['--verbose'] or nocatch:
# Just allow the stacktrace to print if verbose, or in testing.
raise
print_red(e.message, end='' if e.message.endswith('\n') else '\n')
return 1
force_utf8_in_ascii_mode_hack()
if argv is None:
argv = sys.argv[1:]
if env is None:
env = os.environ.copy()
args = docopt_parse_args(argv)
command = args['']
ret = maybe_print_help_and_return(args)
if ret is not None:
return ret
try:
runtime = run_task(Runtime(args, env))
if not args['--quiet']:
parser.warn_duplicate_keys(runtime.peru_file)
scope, imports = parser.parse_file(runtime.peru_file)
params = CommandParams(args, runtime, scope, imports)
command_fn = COMMAND_FNS[command]
run_task(command_fn(params))
except PrintableError as e:
if args['--verbose'] or nocatch:
# Just allow the stacktrace to print if verbose, or in testing.
raise
print_red(e.message, end='' if e.message.endswith('\n') else '\n')
return 1