Skip to content

Commit 39cc301

Browse files
authored
Skip tests using util on Python 3.15 alpha/beta. (#939)
* test: skip tests using `util` on Python 3.15 alpha/beta. Temporarily skip tests relying on `util` when running on Python 3.15 alpha/beta versions, as recent layout changes cause a `RuntimeError` during import. * test: clarify `SKIP_MSG` reason in `test_util.py`
1 parent 8fec088 commit 39cc301

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

comtypes/test/test_util.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import unittest
23
from ctypes import (
34
POINTER,
@@ -13,7 +14,25 @@
1314
sizeof,
1415
)
1516

16-
import comtypes.util
17+
PY_3_15_ALPHA_BETA = (
18+
sys.version_info.major == 3
19+
and sys.version_info.minor == 15
20+
and sys.version_info.releaselevel in ("alpha", "beta")
21+
)
22+
23+
try:
24+
import comtypes.util
25+
except RuntimeError as e:
26+
SKIP_MSG = (
27+
"Starting from Python 3.15, PyCArgObject layout is changed. "
28+
"See https://github.com/enthought/comtypes/issues/938."
29+
)
30+
if PY_3_15_ALPHA_BETA:
31+
32+
def setUpModule():
33+
raise unittest.SkipTest(SKIP_MSG)
34+
else:
35+
raise e
1736
from comtypes import GUID, CoCreateInstance, IUnknown, shelllink
1837

1938

0 commit comments

Comments
 (0)