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

Function xcode_test

Platforms/Apple/testbed/__main__.py:63–106  ·  view source on GitHub ↗
(location: Path, platform: str, simulator: str, verbose: bool)

Source from the content-addressed store, hash-verified

61
62
63def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
64 # Build and run the test suite on the named simulator.
65 args = [
66 "-project",
67 str(location / f"{platform}Testbed.xcodeproj"),
68 "-scheme",
69 f"{platform}Testbed",
70 "-destination",
71 f"platform={platform} Simulator,name={simulator}",
72 "-derivedDataPath",
73 str(location / "DerivedData"),
74 ]
75 verbosity_args = [] if verbose else ["-quiet"]
76
77 print("Building test project...")
78 subprocess.run(
79 ["xcodebuild", "build-for-testing"] + args + verbosity_args,
80 check=True,
81 )
82
83 # Any environment variable prefixed with TEST_RUNNER_ is exposed into the
84 # test runner environment. There are some variables (like those identifying
85 # CI platforms) that can be useful to have access to.
86 test_env = os.environ.copy()
87 if "GITHUB_ACTIONS" in os.environ:
88 test_env["TEST_RUNNER_GITHUB_ACTIONS"] = os.environ["GITHUB_ACTIONS"]
89
90 print("Running test project...")
91 # Test execution *can't* be run -quiet; verbose mode
92 # is how we see the output of the test output.
93 process = subprocess.Popen(
94 ["xcodebuild", "test-without-building"] + args,
95 stdout=subprocess.PIPE,
96 stderr=subprocess.STDOUT,
97 env=test_env,
98 )
99 while line := (process.stdout.readline()).decode(*DECODE_ARGS):
100 # Strip the timestamp/process prefix from each log line
101 line = LOG_PREFIX_REGEX.sub("", line)
102 sys.stdout.write(line)
103 sys.stdout.flush()
104
105 status = process.wait(timeout=5)
106 exit(status)
107
108
109def copy(src, tgt):

Callers 1

run_testbedFunction · 0.85

Calls 10

waitMethod · 0.95
strFunction · 0.85
exitFunction · 0.50
runMethod · 0.45
copyMethod · 0.45
decodeMethod · 0.45
readlineMethod · 0.45
subMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…