Skip to content

[mypyc] Provide instructions for resolving missing test module on Windows #19579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions mypyc/test-data/run-tuples.test
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,23 @@ import sys
from typing import Optional
from native import ClassIR, FuncIR, Record

HAVE_TEST = False
if sys.version_info >= (3, 14):
from test.support import EqualToForwardRef
type_forward_ref = EqualToForwardRef
else:
try:
from test.support import EqualToForwardRef
type_forward_ref = EqualToForwardRef
HAVE_TEST = True
except ImportError as e:
# catch the case of a pymanager installed Python
# without the test module. It is excluded by default
# on Windows.
msg = 'Missing "test" module.'
if sys.platform == "win32":
msg += (' Please install a version of Python with the test module.'
' If you are using pymanager, try running pymanager install --force PythonTest\\<version>')
raise ImportError(msg) from e

if not HAVE_TEST:
from typing import ForwardRef
type_forward_ref = ForwardRef

Expand Down
Loading