Gentoo Archives: gentoo-commits

From: Louis Sautier <sbraz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/mypy/files/, dev-python/mypy/
Date: Wed, 25 Aug 2021 00:04:13
Message-Id: 1629849659.150b60befae35cc7c1f017a561d928391f5e35f2.sbraz@gentoo
1 commit: 150b60befae35cc7c1f017a561d928391f5e35f2
2 Author: Louis Sautier <sbraz <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 24 22:58:59 2021 +0000
4 Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 25 00:00:59 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=150b60be
7
8 dev-python/mypy: enable py3.10, explicitly inherit multiprocessing
9
10 Also remove an unused variable and comment failing tests.
11
12 Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>
13
14 .../mypy/files/mypy-0.910-py3.10-tests.patch | 51 ++++++++++++++++++++++
15 dev-python/mypy/mypy-0.910.ebuild | 27 +++++++-----
16 2 files changed, 68 insertions(+), 10 deletions(-)
17
18 diff --git a/dev-python/mypy/files/mypy-0.910-py3.10-tests.patch b/dev-python/mypy/files/mypy-0.910-py3.10-tests.patch
19 new file mode 100644
20 index 00000000000..16e85049cc1
21 --- /dev/null
22 +++ b/dev-python/mypy/files/mypy-0.910-py3.10-tests.patch
23 @@ -0,0 +1,51 @@
24 +diff --git a/mypyc/test-data/run-misc.test b/mypyc/test-data/run-misc.test
25 +index 431efc228..0c1a26c1b 100644
26 +--- a/mypyc/test-data/run-misc.test
27 ++++ b/mypyc/test-data/run-misc.test
28 +@@ -13,8 +13,7 @@ async def g() -> int:
29 + async def f() -> int:
30 + return await g()
31 +
32 +-loop = asyncio.get_event_loop()
33 +-result = loop.run_until_complete(f())
34 ++result = asyncio.run(f())
35 + assert result == 1
36 +
37 + [typing fixtures/typing-full.pyi]
38 +@@ -22,8 +21,8 @@ assert result == 1
39 + [file driver.py]
40 + from native import f
41 + import asyncio
42 +-loop = asyncio.get_event_loop()
43 +-result = loop.run_until_complete(f())
44 ++
45 ++result = asyncio.run(f())
46 + assert result == 1
47 +
48 + [case testMaybeUninitVar]
49 +diff --git a/test-data/stdlib-samples/3.2/random.py b/test-data/stdlib-samples/3.2/random.py
50 +index 7eecdfe04..82bda03f7 100644
51 +--- a/test-data/stdlib-samples/3.2/random.py
52 ++++ b/test-data/stdlib-samples/3.2/random.py
53 +@@ -41,7 +41,7 @@ from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethod
54 + from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
55 + from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
56 + from os import urandom as _urandom
57 +-from collections import Set as _Set, Sequence as _Sequence
58 ++from collections.abc import Set as _Set, Sequence as _Sequence
59 + from hashlib import sha512 as _sha512
60 +
61 + from typing import (
62 +diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test
63 +index 92ef7e069..87d04f3c4 100644
64 +--- a/test-data/unit/cmdline.test
65 ++++ b/test-data/unit/cmdline.test
66 +@@ -791,7 +791,7 @@ c.py:2: error: Argument 1 to "bar" has incompatible type "str"; expected "int"
67 + [case testSrcPEP420Packages]
68 + # cmd: mypy -p anamespace --namespace-packages
69 + [file mypy.ini]
70 +-\[mypy]]
71 ++\[mypy]
72 + mypy_path = src
73 + [file src/setup.cfg]
74 + [file src/anamespace/foo/__init__.py]
75
76 diff --git a/dev-python/mypy/mypy-0.910.ebuild b/dev-python/mypy/mypy-0.910.ebuild
77 index 3d67ec72646..c1cf4858510 100644
78 --- a/dev-python/mypy/mypy-0.910.ebuild
79 +++ b/dev-python/mypy/mypy-0.910.ebuild
80 @@ -3,15 +3,12 @@
81
82 EAPI=7
83
84 -PYTHON_COMPAT=( python3_{8..9} )
85 -inherit distutils-r1
86 +PYTHON_COMPAT=( python3_{8..10} )
87 +inherit distutils-r1 multiprocessing
88
89 DESCRIPTION="Optional static typing for Python"
90 HOMEPAGE="http://www.mypy-lang.org/"
91 -TYPESHED_COMMIT="add4d92f050fb11d3901c6f0ee579a122d4a7a98"
92 -SRC_URI="
93 - https://github.com/python/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
94 -"
95 +SRC_URI="https://github.com/python/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
96
97 LICENSE="MIT"
98 SLOT="0"
99 @@ -41,18 +38,28 @@ BDEPEND="
100 distutils_enable_sphinx docs/source dev-python/sphinx_rtd_theme
101 distutils_enable_tests pytest
102
103 +PATCHES=(
104 + # https://github.com/python/mypy/pull/11017
105 + "${FILESDIR}/${P}-py3.10-tests.patch"
106 +)
107 +
108 # this requires packaging a lot of type stubs
109 export MYPY_USE_MYPYC=0
110
111 python_test() {
112 - local deselect=(
113 - # TODO
114 + local EPYTEST_DESELECT=(
115 + # Fails with pytest-xdist 2.3.0
116 + # https://github.com/python/mypy/issues/11019
117 mypy/test/teststubtest.py
118 )
119
120 + [[ "${EPYTHON}" == "python3.10" ]] && EPYTEST_DESELECT+=(
121 + # https://github.com/python/mypy/issues/11018
122 + mypyc/test/test_commandline.py::TestCommandLine::testErrorOutput
123 + )
124 +
125 # Some mypy/test/testcmdline.py::PythonCmdlineSuite tests
126 # fail with high COLUMNS values
127 local -x COLUMNS=80
128 - epytest ${deselect[@]/#/--deselect } \
129 - -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
130 + epytest -n "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")"
131 }