Skip to content

Commit 6d535bf

Browse files
authored
Enable stubtest for pyserial (#9692)
1 parent cf6ff75 commit 6d535bf

File tree

6 files changed

+33
-11
lines changed

6 files changed

+33
-11
lines changed

stubs/pyserial/@tests/stubtest_allowlist.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,3 @@ serial.serialutil.SerialBase.setDTR
6767
serial.serialutil.SerialBase.setPort
6868
serial.serialutil.SerialBase.setRTS
6969
serial.serialutil.SerialBase.writeTimeout
70-
71-
# Private aliases
72-
serial.serialposix.plat
73-
serial.tools.list_ports_posix.plat

stubs/pyserial/@tests/stubtest_allowlist_darwin.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# =======================
33
serial.serialwin32 # Windows only
44
serial.win32 # Windows only
5-
serial.tools.list_ports_linux # Linux only
65
serial.tools.list_ports_windows # Windows only
76

87
# Error: is inconsistent
@@ -15,3 +14,13 @@ serial.serialposix.Serial.read
1514
serial.serialposix.Serial.write
1615
serial.serialposix.PosixPollSerial.read
1716
serial.serialposix.VTIMESerial.read
17+
18+
# Error: is missing from the stub
19+
# ===============================
20+
# TODO: maybe add these
21+
serial.tools.list_ports_linux.SysFS
22+
serial.tools.list_ports_linux.comports
23+
24+
# intended to be private aliases
25+
serial.tools.list_ports_posix.plat
26+
serial.serialposix.plat

stubs/pyserial/@tests/stubtest_allowlist_linux.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ serial.serialposix.Serial.read
1515
serial.serialposix.Serial.write
1616
serial.serialposix.PosixPollSerial.read
1717
serial.serialposix.VTIMESerial.read
18+
19+
# Error: is missing from the stub (intended to be private aliases)
20+
# ================================================================
21+
serial.tools.list_ports_posix.plat
22+
serial.serialposix.plat

stubs/pyserial/@tests/stubtest_allowlist_win32.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@
22
# =======================
33
serial.serialposix # Posix only
44
serial.tools.list_ports_osx # Mac only
5-
serial.tools.list_ports_linux # Linux only
5+
serial.tools.list_ports_posix # Posix only
66

77
# Error: is inconsistent
88
# ======================
99
# These are positional only argument in the stub because they inherit from io.RawIOBase
1010
# but at runtime they are normal arguments that don't have consistent names.
1111
serial.serialwin32.Serial.read
1212
serial.serialwin32.Serial.write
13+
14+
# Missing from the stub (TODO: add these)
15+
# =======================================
16+
serial.win32._SECURITY_ATTRIBUTES.\w+
17+
serial.win32._OVERLAPPED.\w+
18+
serial.win32._DCB.\w+
19+
serial.win32._COMSTAT.\w+
20+
serial.win32._COMMTIMEOUTS.\w+
21+
serial.win32.N11_OVERLAPPED4DOLLAR_48E.\w+
22+
serial.win32.N11_OVERLAPPED4DOLLAR_484DOLLAR_49E.\w+
23+
serial.win32.CreateEventW
24+
serial.win32.CreateFileW
25+
serial.tools.list_ports_linux.SysFS
26+
serial.tools.list_ports_linux.comports
27+
serial.tools.list_ports_windows.SP_DEVINFO_DATA.\w+
28+
serial.tools.list_ports_windows.GUID.\w+

stubs/pyserial/METADATA.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
version = "3.5.*"
22

33
[tool.stubtest]
4-
# Skip stubtest because it crashes with `SystemExit` when trying to import `serial.__main__`.
5-
# This has been fixed in https://github.com/python/mypy/pull/14284.
6-
# TODO: Remove skip once mypy 1.0 is released with the fix.
7-
skip = true
84
ignore_missing_stub = false
95
platforms = ["linux", "win32", "darwin"]
106
extras = ["cp2110"]

stubs/pyserial/serial/win32.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from typing_extensions import TypeAlias
66
if sys.platform == "win32":
77
def is_64bit() -> bool: ...
88

9-
ULONG_PTR: TypeAlias = c_int64 | c_ulong
9+
ULONG_PTR: c_int64 | c_ulong
1010

1111
class _SECURITY_ATTRIBUTES(Structure): ...
1212
LPSECURITY_ATTRIBUTES: type[_Pointer[_SECURITY_ATTRIBUTES]]

0 commit comments

Comments
 (0)