Skip to content

Fix testAsync, test_stdlibsamples and testSrcPEP420Packages with Python 3.10 #11017

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 3 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
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: 15 additions & 4 deletions mypyc/test-data/run-misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[case testAsync]
import asyncio
import sys

async def h() -> int:
return 1
Expand All @@ -13,17 +14,27 @@ async def g() -> int:
async def f() -> int:
return await g()

loop = asyncio.get_event_loop()
result = loop.run_until_complete(f())
# sys.version_info >= (3, 7) fails with
# error: Unsupported left operand type for >= ("Tuple[int, int, int, str, int]")
if sys.version_info[0] >= 3 and sys.version_info[1] >= 7:
result = asyncio.run(f())
else:
loop = asyncio.get_event_loop()
result = loop.run_until_complete(f())
assert result == 1

[typing fixtures/typing-full.pyi]

[file driver.py]
from native import f
import asyncio
loop = asyncio.get_event_loop()
result = loop.run_until_complete(f())
import sys

if sys.version_info >= (3, 7):
result = asyncio.run(f())
else:
loop = asyncio.get_event_loop()
result = loop.run_until_complete(f())
assert result == 1

[case testMaybeUninitVar]
Expand Down
2 changes: 1 addition & 1 deletion test-data/stdlib-samples/3.2/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
from os import urandom as _urandom
from collections import Set as _Set, Sequence as _Sequence
from collections.abc import Set as _Set, Sequence as _Sequence
from hashlib import sha512 as _sha512

from typing import (
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ c.py:2: error: Argument 1 to "bar" has incompatible type "str"; expected "int"
[case testSrcPEP420Packages]
# cmd: mypy -p anamespace --namespace-packages
[file mypy.ini]
\[mypy]]
\[mypy]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this was just a typo.

mypy_path = src
[file src/setup.cfg]
[file src/anamespace/foo/__init__.py]
Expand Down