mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140702: Add test skip for Unix Datagram tests on iOS when on Github Actions (#140740)
Exposes the GITHUB_ACTIONS environment variable to iOS simulator test runs, and uses this variable to skip a Unix Datagram socketserver test that is unreliable in the iOS GitHub Actions environment. Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
058bc182b9
commit
9f8d005d29
6 changed files with 31 additions and 1 deletions
|
|
@ -224,6 +224,17 @@ ### Testing a multi-architecture framework
|
||||||
|
|
||||||
$ python Apple test iOS
|
$ python Apple test iOS
|
||||||
|
|
||||||
|
This test will attempt to find an "SE-class" simulator (i.e., an iPhone SE, or
|
||||||
|
iPhone 16e, or similar), and run the test suite on the most recent version of
|
||||||
|
iOS that is available. You can specify a simulator using the `--simulator`
|
||||||
|
command line argument, providing the name of the simulator (e.g., `--simulator
|
||||||
|
'iPhone 16 Pro'`). You can also use this argument to control the OS version used
|
||||||
|
for testing; `--simulator 'iPhone 16 Pro,OS=18.2'` would attempt to run the
|
||||||
|
tests on an iPhone 16 Pro running iOS 18.2.
|
||||||
|
|
||||||
|
If the test runner is executed on GitHub Actions, the `GITHUB_ACTIONS`
|
||||||
|
environment variable will be exposed to the iOS process at runtime.
|
||||||
|
|
||||||
### Testing a single-architecture framework
|
### Testing a single-architecture framework
|
||||||
|
|
||||||
The `Apple/testbed` folder that contains an Xcode project that is able to run
|
The `Apple/testbed` folder that contains an Xcode project that is able to run
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@
|
||||||
setenv("NO_COLOR", "1", true);
|
setenv("NO_COLOR", "1", true);
|
||||||
setenv("PYTHON_COLORS", "0", true);
|
setenv("PYTHON_COLORS", "0", true);
|
||||||
|
|
||||||
|
if (getenv("GITHUB_ACTIONS")) {
|
||||||
|
NSLog(@"Running in a GitHub Actions environment");
|
||||||
|
}
|
||||||
// Arguments to pass into the test suite runner.
|
// Arguments to pass into the test suite runner.
|
||||||
// argv[0] must identify the process; any subsequent arg
|
// argv[0] must identify the process; any subsequent arg
|
||||||
// will be handled as if it were an argument to `python -m test`
|
// will be handled as if it were an argument to `python -m test`
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
@ -78,6 +79,13 @@ def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Any environment variable prefixed with TEST_RUNNER_ is exposed into the
|
||||||
|
# test runner environment. There are some variables (like those identifying
|
||||||
|
# CI platforms) that can be useful to have access to.
|
||||||
|
test_env = os.environ.copy()
|
||||||
|
if "GITHUB_ACTIONS" in os.environ:
|
||||||
|
test_env["TEST_RUNNER_GITHUB_ACTIONS"] = os.environ["GITHUB_ACTIONS"]
|
||||||
|
|
||||||
print("Running test project...")
|
print("Running test project...")
|
||||||
# Test execution *can't* be run -quiet; verbose mode
|
# Test execution *can't* be run -quiet; verbose mode
|
||||||
# is how we see the output of the test output.
|
# is how we see the output of the test output.
|
||||||
|
|
@ -85,6 +93,7 @@ def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
|
||||||
["xcodebuild", "test-without-building"] + args,
|
["xcodebuild", "test-without-building"] + args,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
|
env=test_env,
|
||||||
)
|
)
|
||||||
while line := (process.stdout.readline()).decode(*DECODE_ARGS):
|
while line := (process.stdout.readline()).decode(*DECODE_ARGS):
|
||||||
# Strip the timestamp/process prefix from each log line
|
# Strip the timestamp/process prefix from each log line
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
"BrokenIter",
|
"BrokenIter",
|
||||||
"in_systemd_nspawn_sync_suppressed",
|
"in_systemd_nspawn_sync_suppressed",
|
||||||
"run_no_yield_async_fn", "run_yielding_async_fn", "async_yield",
|
"run_no_yield_async_fn", "run_yielding_async_fn", "async_yield",
|
||||||
"reset_code",
|
"reset_code", "on_github_actions"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1369,6 +1369,7 @@ def reset_code(f: types.FunctionType) -> types.FunctionType:
|
||||||
f.__code__ = f.__code__.replace()
|
f.__code__ = f.__code__.replace()
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
on_github_actions = "GITHUB_ACTIONS" in os.environ
|
||||||
|
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
# Check for the presence of docstrings.
|
# Check for the presence of docstrings.
|
||||||
|
|
|
||||||
|
|
@ -223,12 +223,16 @@ def test_ForkingUDPServer(self):
|
||||||
self.dgram_examine)
|
self.dgram_examine)
|
||||||
|
|
||||||
@requires_unix_sockets
|
@requires_unix_sockets
|
||||||
|
@unittest.skipIf(test.support.is_apple_mobile and test.support.on_github_actions,
|
||||||
|
"gh-140702: Test fails regularly on iOS simulator on GitHub Actions")
|
||||||
def test_UnixDatagramServer(self):
|
def test_UnixDatagramServer(self):
|
||||||
self.run_server(socketserver.UnixDatagramServer,
|
self.run_server(socketserver.UnixDatagramServer,
|
||||||
socketserver.DatagramRequestHandler,
|
socketserver.DatagramRequestHandler,
|
||||||
self.dgram_examine)
|
self.dgram_examine)
|
||||||
|
|
||||||
@requires_unix_sockets
|
@requires_unix_sockets
|
||||||
|
@unittest.skipIf(test.support.is_apple_mobile and test.support.on_github_actions,
|
||||||
|
"gh-140702: Test fails regularly on iOS simulator on GitHub Actions")
|
||||||
def test_ThreadingUnixDatagramServer(self):
|
def test_ThreadingUnixDatagramServer(self):
|
||||||
self.run_server(socketserver.ThreadingUnixDatagramServer,
|
self.run_server(socketserver.ThreadingUnixDatagramServer,
|
||||||
socketserver.DatagramRequestHandler,
|
socketserver.DatagramRequestHandler,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
The iOS testbed app will now expose the ``GITHUB_ACTIONS`` environment
|
||||||
|
variable to iOS apps being tested.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue