MCPcopy Index your code
hub / github.com/python/cpython / gradle_task

Function gradle_task

Android/android.py:640–702  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

638
639
640async def gradle_task(context):
641 env = os.environ.copy()
642 if context.managed:
643 task_prefix = context.managed
644 else:
645 task_prefix = "connected"
646 env["ANDROID_SERIAL"] = context.connected
647
648 if context.ci_mode:
649 context.args[0:0] = [
650 # See _add_ci_python_opts in libregrtest/main.py.
651 "-W", "error", "-bb", "-E",
652
653 # Randomization is disabled because order-dependent failures are
654 # much less likely to pass on a rerun in single-process mode.
655 "-m", "test",
656 f"--{context.ci_mode}-ci", "--single-process", "--no-randomize",
657 "--pythoninfo",
658 ]
659
660 if not any(arg in context.args for arg in ["-c", "-m"]):
661 context.args[0:0] = ["-m", "test"]
662
663 args = [
664 gradlew, "--console", "plain", f"{task_prefix}DebugAndroidTest",
665 ] + [
666 f"-P{name}={value}"
667 for name, value in [
668 ("python.sitePackages", context.site_packages),
669 ("python.cwd", context.cwd),
670 (
671 "android.testInstrumentationRunnerArguments.pythonArgs",
672 json.dumps(context.args),
673 ),
674 ]
675 if value
676 ]
677 if context.verbose >= 2:
678 args.append("--info")
679 log_verbose(context, f"> {join_command(args)}\n")
680
681 try:
682 async with async_process(
683 *args, cwd=TESTBED_DIR, env=env,
684 stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
685 ) as process:
686 while line := (await process.stdout.readline()).decode(*DECODE_ARGS):
687 # Gradle may take several minutes to install SDK packages, so
688 # it's worth showing those messages even in non-verbose mode.
689 if line.startswith('Preparing "Install'):
690 sys.stdout.write(line)
691 else:
692 log_verbose(context, line)
693
694 status = await wait_for(process.wait(), timeout=1)
695 if status == 0:
696 exit(0)
697 else:

Callers 1

run_testbedFunction · 0.85

Calls 15

wait_forFunction · 0.90
CalledProcessErrorClass · 0.90
log_verboseFunction · 0.85
async_processFunction · 0.85
stop_appFunction · 0.85
join_commandFunction · 0.70
exitFunction · 0.70
anyFunction · 0.50
copyMethod · 0.45
dumpsMethod · 0.45
appendMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…