Skip to content

Commit 8797cd8

Browse files
authored
Fix CI cross-platform coverage and Windows CRT install/run failures (boto#368)
* Run CI on all platforms * Fix BaseManager test under spawn and restricted sockets * Upgrade dev dependencies * Fix hashes * Address windows quiting issue * Fix another windows issue
1 parent 26f0a2b commit 8797cd8

8 files changed

Lines changed: 94 additions & 36 deletions

File tree

.github/workflows/run-crt-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os }}
1515
strategy:
1616
fail-fast: false
1717
matrix:

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
build:
1313

14-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os }}
1515
strategy:
1616
fail-fast: false
1717
matrix:

requirements-dev-lock.txt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,35 @@ iniconfig==2.0.0 \
8686
packaging==24.1 \
8787
--hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \
8888
--hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124
89-
# via pytest
89+
# via
90+
# pytest
91+
# wheel
9092
pluggy==1.5.0 \
9193
--hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \
9294
--hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669
9395
# via pytest
94-
psutil==4.4.2 \
95-
--hash=sha256:10fbb631142a3200623f4ab49f8bf82c32b79b8fe179f6056d01da3dfc589da1 \
96-
--hash=sha256:15aba78f0262d7839702913f5d2ce1e97c89e31456bb26da1a5f9f7d7fe6d336 \
97-
--hash=sha256:1c37e6428f7fe3aeea607f9249986d9bb933bb98133c7919837fd9aac4996b07 \
98-
--hash=sha256:69e30d789c495b781f7cd47c13ee64452c58abfc7132d6dd1b389af312a78239 \
99-
--hash=sha256:7481f299ae0e966a10cb8dd93a327efd8f51995d9bdc8810dcc65d3b12d856ee \
100-
--hash=sha256:c2b0d8d1d8b5669b9884d0dd49ccb4094d163858d672d3d13a3fa817bc8a3197 \
101-
--hash=sha256:d96d31d83781c7f3d0df8ccb1cc50650ca84d4722c5070b71ce8f1cc112e02e0 \
102-
--hash=sha256:e423dd9cb12256c742d1d56ec38bc7d2a7fa09287c82c41e475e68b9f932c2af \
103-
--hash=sha256:e44d6b758a96539e3e02336430d3f85263d43c470c5bad93572e9b6a86c67f76
96+
psutil==7.2.2 \
97+
--hash=sha256:0746f5f8d406af344fd547f1c8daa5f5c33dbc293bb8d6a16d80b4bb88f59372 \
98+
--hash=sha256:076a2d2f923fd4821644f5ba89f059523da90dc9014e85f8e45a5774ca5bc6f9 \
99+
--hash=sha256:11fe5a4f613759764e79c65cf11ebdf26e33d6dd34336f8a337aa2996d71c841 \
100+
--hash=sha256:1a571f2330c966c62aeda00dd24620425d4b0cc86881c89861fbc04549e5dc63 \
101+
--hash=sha256:1a7b04c10f32cc88ab39cbf606e117fd74721c831c98a27dc04578deb0c16979 \
102+
--hash=sha256:1fa4ecf83bcdf6e6c8f4449aff98eefb5d0604bf88cb883d7da3d8d2d909546a \
103+
--hash=sha256:2edccc433cbfa046b980b0df0171cd25bcaeb3a68fe9022db0979e7aa74a826b \
104+
--hash=sha256:7b6d09433a10592ce39b13d7be5a54fbac1d1228ed29abc880fb23df7cb694c9 \
105+
--hash=sha256:8c233660f575a5a89e6d4cb65d9f938126312bca76d8fe087b947b3a1aaac9ee \
106+
--hash=sha256:917e891983ca3c1887b4ef36447b1e0873e70c933afc831c6b6da078ba474312 \
107+
--hash=sha256:ab486563df44c17f5173621c7b198955bd6b613fb87c71c161f827d3fb149a9b \
108+
--hash=sha256:ae0aefdd8796a7737eccea863f80f81e468a1e4cf14d926bd9b6f5f2d5f90ca9 \
109+
--hash=sha256:b0726cecd84f9474419d67252add4ac0cd9811b04d61123054b9fb6f57df6e9e \
110+
--hash=sha256:b58fabe35e80b264a4e3bb23e6b96f9e45a3df7fb7eed419ac0e5947c61e47cc \
111+
--hash=sha256:c7663d4e37f13e884d13994247449e9f8f574bc4655d509c3b95e9ec9e2b9dc1 \
112+
--hash=sha256:e452c464a02e7dc7822a05d25db4cde564444a67e58539a00f929c51eddda0cf \
113+
--hash=sha256:e78c8603dcd9a04c7364f1a3e670cea95d51ee865e4efb3556a3a63adef958ea \
114+
--hash=sha256:eb7e81434c8d223ec4a219b5fc1c47d0417b12be7ea866e24fb5ad6e84b3d988 \
115+
--hash=sha256:ed0cace939114f62738d808fdcecd4c869222507e266e574799e9c0faa17d486 \
116+
--hash=sha256:eed63d3b4d62449571547b60578c5b2c4bcccc5387148db46e0c2313dad0ee00 \
117+
--hash=sha256:fd04ef36b4a6d599bbdb225dd1d3f51e00105f6d48a28f006da7f9822f2606d8
104118
# via -r requirements-dev.txt
105119
pytest==8.1.1 \
106120
--hash=sha256:2a8386cfc11fa9d2c50ee7b2a57e7d898ef90470a7a34c4b949ff59662bb78b7 \
@@ -121,7 +135,7 @@ tomli==2.0.1 \
121135
# via
122136
# coverage
123137
# pytest
124-
wheel==0.43.0 \
125-
--hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
126-
--hash=sha256:55c570405f142630c6b9f72fe09d9b67cf1477fcf543ae5b8dcb1f5b7377da81
138+
wheel==0.46.3 \
139+
--hash=sha256:4b399d56c9d9338230118d705d9737a2a468ccca63d5e813e2a4fc7815d8bc4d \
140+
--hash=sha256:e3e79874b07d776c40bd6033f8ddf76a7dad46a7b8aa1b2787a83083519a1803
127141
# via -r requirements-dev.txt

requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
psutil>=4.1.0,<5.0.0
1+
psutil>=4.1.0,<8.0.0
22
tabulate==0.7.5
33
coverage==7.2.7
4-
wheel==0.43.0
5-
setuptools==71.1.0;python_version>="3.12"
4+
wheel==0.46.3
5+
setuptools==80.10.2;python_version>="3.12"
66
packaging==24.1;python_version>="3.12" # Requirement for setuptools>=71
77

88
# Pytest specific deps

scripts/ci/install

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import argparse
33
import os
44
import shutil
5+
import sys
56
from contextlib import contextmanager
67
from subprocess import check_call
78

@@ -21,8 +22,8 @@ def cd(path):
2122
os.chdir(cwd)
2223

2324

24-
def run(command):
25-
return check_call(command, shell=True)
25+
def run(args):
26+
return check_call(args)
2627

2728

2829
if __name__ == "__main__":
@@ -35,13 +36,13 @@ if __name__ == "__main__":
3536
)
3637
args = parser.parse_args()
3738
with cd(REPO_ROOT):
38-
run("pip install -r requirements.txt")
39-
run('python scripts/ci/install-dev-deps')
39+
run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
40+
run([sys.executable, "scripts/ci/install-dev-deps"])
4041
if os.path.isdir('dist') and os.listdir('dist'):
4142
shutil.rmtree('dist')
42-
run('python setup.py bdist_wheel')
43+
run([sys.executable, "setup.py", "bdist_wheel"])
4344
wheel_dist = os.listdir('dist')[0]
4445
package = os.path.join('dist', wheel_dist)
4546
if args.extras:
46-
package = f"'{package}[{args.extras}]'"
47-
run(f'pip install {package}')
47+
package = f"{package}[{args.extras}]"
48+
run([sys.executable, "-m", "pip", "install", package])

scripts/ci/install-dev-deps

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def cd(path):
2020
os.chdir(cwd)
2121

2222

23-
def run(command):
24-
return check_call(command, shell=True)
23+
def run(args):
24+
return check_call(args)
2525

2626

2727
if __name__ == "__main__":
@@ -32,6 +32,24 @@ if __name__ == "__main__":
3232
# Setuptools 71+ now prefers already installed versions
3333
# of packaging _and_ broke the API for packaging<22.0.
3434
# We'll pin to match what's in requirements-dev.txt.
35-
run("pip install setuptools==71.1.0 packaging==24.1")
36-
37-
run("pip install -r requirements-dev-lock.txt")
35+
run(
36+
[
37+
sys.executable,
38+
"-m",
39+
"pip",
40+
"install",
41+
"setuptools==71.1.0",
42+
"packaging==24.1",
43+
]
44+
)
45+
46+
run(
47+
[
48+
sys.executable,
49+
"-m",
50+
"pip",
51+
"install",
52+
"-r",
53+
"requirements-dev-lock.txt",
54+
]
55+
)

scripts/ci/run-crt-tests

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def cd(path):
2424
os.chdir(cwd)
2525

2626

27-
def run(command, env=None):
28-
return check_call(command, shell=True, env=env)
27+
def run(args, env=None):
28+
return check_call(args, env=env)
2929

3030

3131
try:
@@ -37,4 +37,11 @@ except ImportError:
3737

3838
if __name__ == "__main__":
3939
with cd(os.path.join(REPO_ROOT, "tests")):
40-
run(f"{REPO_ROOT}/scripts/ci/run-tests unit/ functional/")
40+
run(
41+
[
42+
sys.executable,
43+
os.path.join(REPO_ROOT, "scripts/ci/run-tests"),
44+
"unit/",
45+
"functional/",
46+
]
47+
)

tests/unit/test_compat.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import os
1515
import shutil
1616
import signal
17+
import socket
1718
import tempfile
1819
from io import BytesIO
1920

@@ -79,13 +80,28 @@ def test_non_file_like_obj(self):
7980

8081

8182
class TestBaseManager(unittest.TestCase):
83+
def _can_bind_socket(self):
84+
sock = socket.socket()
85+
try:
86+
sock.bind(('127.0.0.1', 0))
87+
return True
88+
except PermissionError:
89+
return False
90+
finally:
91+
sock.close()
92+
8293
def create_pid_manager(self):
8394
class PIDManager(BaseManager):
8495
def __init__(self):
8596
# Python 3.14 changed the non-macOS POSIX default to forkserver
86-
# but the code in this module does not work with it
97+
# and macOS defaults to spawn. This test uses a local manager
98+
# class which is not picklable under spawn/forkserver, so force
99+
# fork for the test.
87100
# See https://github.com/python/cpython/issues/125714
88-
if multiprocessing.get_start_method() == 'forkserver':
101+
if multiprocessing.get_start_method() in (
102+
'forkserver',
103+
'spawn',
104+
):
89105
ctx = multiprocessing.get_context(method='fork')
90106
else:
91107
ctx = multiprocessing.get_context()
@@ -102,6 +118,8 @@ def get_pid(self, pid_manager):
102118

103119
@skip_if_windows('os.kill() with SIGINT not supported on Windows')
104120
def test_can_provide_signal_handler_initializers_to_start(self):
121+
if not self._can_bind_socket():
122+
self.skipTest('socket bind is not permitted in this environment')
105123
manager = self.create_pid_manager()
106124
manager.start(signal.signal, (signal.SIGINT, signal.SIG_IGN))
107125
pid = self.get_pid(manager)

0 commit comments

Comments
 (0)