mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Add workflow stubtests for macos (#5384)
* Add macos to stubtest * Add general darwin stubtest exception file * Adding exceptions and platform ifs
This commit is contained in:
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -103,7 +103,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "windows-latest"]
|
||||
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, '3.10.0-beta.1']
|
||||
fail-fast: false
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class Error(Exception): ...
|
||||
|
||||
def setlocale(category: int, locale: Union[_str, Iterable[_str], None] = ...) -> _str: ...
|
||||
def localeconv() -> Mapping[_str, Union[int, _str, List[int]]]: ...
|
||||
def nl_langinfo(option: int) -> _str: ...
|
||||
def nl_langinfo(__key: int) -> _str: ...
|
||||
def getdefaultlocale(envvars: Tuple[_str, ...] = ...) -> Tuple[Optional[_str], Optional[_str]]: ...
|
||||
def getlocale(category: int = ...) -> Sequence[_str]: ...
|
||||
def getpreferredencoding(do_setlocale: bool = ...) -> _str: ...
|
||||
|
||||
@@ -9,11 +9,13 @@ ACCESS_COPY: int
|
||||
|
||||
ALLOCATIONGRANULARITY: int
|
||||
|
||||
if sys.platform == "linux":
|
||||
MAP_DENYWRITE: int
|
||||
MAP_EXECUTABLE: int
|
||||
|
||||
if sys.platform != "win32":
|
||||
MAP_ANON: int
|
||||
MAP_ANONYMOUS: int
|
||||
MAP_DENYWRITE: int
|
||||
MAP_EXECUTABLE: int
|
||||
MAP_PRIVATE: int
|
||||
MAP_SHARED: int
|
||||
PROT_EXEC: int
|
||||
|
||||
@@ -117,6 +117,8 @@ if sys.platform != "win32":
|
||||
RTLD_LOCAL: int
|
||||
RTLD_NODELETE: int
|
||||
RTLD_NOLOAD: int
|
||||
|
||||
if sys.platform == "linux":
|
||||
RTLD_DEEPBIND: int
|
||||
|
||||
SEEK_SET: int
|
||||
@@ -791,8 +793,9 @@ else:
|
||||
def spawnvp(mode: int, file: AnyPath, args: _ExecVArgs) -> int: ...
|
||||
def spawnvpe(mode: int, file: AnyPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
|
||||
def wait() -> Tuple[int, int]: ... # Unix only
|
||||
from posix import waitid_result
|
||||
def waitid(idtype: int, ident: int, options: int) -> waitid_result: ...
|
||||
if sys.platform != "darwin":
|
||||
from posix import waitid_result
|
||||
def waitid(idtype: int, ident: int, options: int) -> waitid_result: ...
|
||||
def wait3(options: int) -> Tuple[int, int, Any]: ...
|
||||
def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ...
|
||||
def WCOREDUMP(__status: int) -> bool: ...
|
||||
@@ -808,14 +811,15 @@ if sys.platform != "win32":
|
||||
from posix import sched_param
|
||||
def sched_get_priority_min(policy: int) -> int: ... # some flavors of Unix
|
||||
def sched_get_priority_max(policy: int) -> int: ... # some flavors of Unix
|
||||
def sched_setscheduler(pid: int, policy: int, param: sched_param) -> None: ... # some flavors of Unix
|
||||
def sched_getscheduler(pid: int) -> int: ... # some flavors of Unix
|
||||
def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix
|
||||
def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix
|
||||
def sched_rr_get_interval(pid: int) -> float: ... # some flavors of Unix
|
||||
def sched_yield() -> None: ... # some flavors of Unix
|
||||
def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix
|
||||
def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix
|
||||
if sys.platform != "darwin":
|
||||
def sched_setscheduler(pid: int, policy: int, param: sched_param) -> None: ... # some flavors of Unix
|
||||
def sched_getscheduler(pid: int) -> int: ... # some flavors of Unix
|
||||
def sched_rr_get_interval(pid: int) -> float: ... # some flavors of Unix
|
||||
def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix
|
||||
def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix
|
||||
def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix
|
||||
def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix
|
||||
|
||||
def cpu_count() -> Optional[int]: ...
|
||||
|
||||
|
||||
@@ -16,12 +16,13 @@ class times_result(NamedTuple):
|
||||
children_system: float
|
||||
elapsed: float
|
||||
|
||||
class waitid_result(NamedTuple):
|
||||
si_pid: int
|
||||
si_uid: int
|
||||
si_signo: int
|
||||
si_status: int
|
||||
si_code: int
|
||||
if sys.platform != "darwin":
|
||||
class waitid_result(NamedTuple):
|
||||
si_pid: int
|
||||
si_uid: int
|
||||
si_signo: int
|
||||
si_status: int
|
||||
si_code: int
|
||||
|
||||
class sched_param(NamedTuple):
|
||||
sched_priority: int
|
||||
@@ -59,8 +60,9 @@ F_TEST: int
|
||||
F_TLOCK: int
|
||||
F_ULOCK: int
|
||||
|
||||
GRND_NONBLOCK: int
|
||||
GRND_RANDOM: int
|
||||
if sys.platform == "linux":
|
||||
GRND_NONBLOCK: int
|
||||
GRND_RANDOM: int
|
||||
NGROUPS_MAX: int
|
||||
|
||||
O_APPEND: int
|
||||
@@ -84,12 +86,13 @@ O_SYNC: int
|
||||
O_TRUNC: int
|
||||
O_WRONLY: int
|
||||
|
||||
POSIX_FADV_DONTNEED: int
|
||||
POSIX_FADV_NOREUSE: int
|
||||
POSIX_FADV_NORMAL: int
|
||||
POSIX_FADV_RANDOM: int
|
||||
POSIX_FADV_SEQUENTIAL: int
|
||||
POSIX_FADV_WILLNEED: int
|
||||
if sys.platform != "darwin":
|
||||
POSIX_FADV_DONTNEED: int
|
||||
POSIX_FADV_NOREUSE: int
|
||||
POSIX_FADV_NORMAL: int
|
||||
POSIX_FADV_RANDOM: int
|
||||
POSIX_FADV_SEQUENTIAL: int
|
||||
POSIX_FADV_WILLNEED: int
|
||||
|
||||
PRIO_PGRP: int
|
||||
PRIO_PROCESS: int
|
||||
@@ -99,7 +102,8 @@ P_ALL: int
|
||||
P_PGID: int
|
||||
P_PID: int
|
||||
|
||||
RTLD_DEEPBIND: int
|
||||
if sys.platform == "linux":
|
||||
RTLD_DEEPBIND: int
|
||||
RTLD_GLOBAL: int
|
||||
RTLD_LAZY: int
|
||||
RTLD_LOCAL: int
|
||||
@@ -107,13 +111,16 @@ RTLD_NODELETE: int
|
||||
RTLD_NOLOAD: int
|
||||
RTLD_NOW: int
|
||||
|
||||
SCHED_BATCH: int
|
||||
SCHED_FIFO: int
|
||||
SCHED_IDLE: int
|
||||
SCHED_OTHER: int
|
||||
SCHED_RESET_ON_FORK: int
|
||||
SCHED_RR: int
|
||||
|
||||
if sys.platform == "linux":
|
||||
SCHED_BATCH: int
|
||||
SCHED_IDLE: int
|
||||
if sys.platform != "darwin":
|
||||
SCHED_RESET_ON_FORK: int
|
||||
|
||||
SEEK_DATA: int
|
||||
SEEK_HOLE: int
|
||||
|
||||
|
||||
@@ -54,11 +54,11 @@ def normpath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
def realpath(filename: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
def realpath(filename: AnyStr, *, strict: bool = ...) -> AnyStr: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
|
||||
@@ -41,6 +41,8 @@ if sys.platform != "win32":
|
||||
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
|
||||
def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ...
|
||||
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
|
||||
|
||||
if sys.platform == "linux":
|
||||
class EpollSelector(BaseSelector):
|
||||
def fileno(self) -> int: ...
|
||||
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ...
|
||||
|
||||
@@ -137,7 +137,7 @@ if sys.platform == "win32":
|
||||
CTRL_C_EVENT: int
|
||||
CTRL_BREAK_EVENT: int
|
||||
|
||||
if sys.platform != "win32":
|
||||
if sys.platform != "win32" and sys.platform != "darwin":
|
||||
class struct_siginfo(Tuple[int, int, int, int, int, int, int]):
|
||||
def __init__(self, sequence: Iterable[int]) -> None: ...
|
||||
@property
|
||||
@@ -189,6 +189,7 @@ def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def sigpending() -> Any: ...
|
||||
def sigtimedwait(sigset: Iterable[int], timeout: float) -> Optional[struct_siginfo]: ...
|
||||
def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ...
|
||||
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
|
||||
if sys.platform != "darwin":
|
||||
def sigtimedwait(sigset: Iterable[int], timeout: float) -> Optional[struct_siginfo]: ...
|
||||
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
|
||||
|
||||
@@ -14,7 +14,8 @@ timezone: int
|
||||
tzname: Tuple[str, str]
|
||||
|
||||
if sys.version_info >= (3, 7) and sys.platform != "win32":
|
||||
CLOCK_BOOTTIME: int # Linux
|
||||
if sys.platform == "linux":
|
||||
CLOCK_BOOTTIME: int
|
||||
CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD
|
||||
CLOCK_UPTIME: int # FreeBSD, OpenBSD
|
||||
|
||||
|
||||
4
tests/stubtest_whitelists/darwin-py36.txt
Normal file
4
tests/stubtest_whitelists/darwin-py36.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
ctypes.wintypes
|
||||
pwd.getpwnam
|
||||
ssl.PROTOCOL_SSLv3 # Depends on openssl compilation
|
||||
ssl.RAND_egd # Depends on openssl compilation
|
||||
4
tests/stubtest_whitelists/darwin-py37.txt
Normal file
4
tests/stubtest_whitelists/darwin-py37.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
ctypes.wintypes
|
||||
pwd.getpwnam
|
||||
time.CLOCK_PROF
|
||||
time.CLOCK_UPTIME
|
||||
2
tests/stubtest_whitelists/darwin-py38.txt
Normal file
2
tests/stubtest_whitelists/darwin-py38.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
time.CLOCK_PROF
|
||||
time.CLOCK_UPTIME
|
||||
52
tests/stubtest_whitelists/darwin.txt
Normal file
52
tests/stubtest_whitelists/darwin.txt
Normal file
@@ -0,0 +1,52 @@
|
||||
_posixsubprocess.cloexec_pipe
|
||||
_?curses.ACS_.* # ACS codes are initialized only after initscr call.
|
||||
_?curses.A_ITALIC # System dependent
|
||||
curses.COLORS # Initialized after start_color
|
||||
curses.COLOR_PAIRS # Initialized after start_color
|
||||
curses.COLS # Initialized only after initscr call.
|
||||
curses.LINES # Initialized only after initscr call.
|
||||
distutils.command.bdist_msi # msi is only available on windows
|
||||
grp.getgrgid
|
||||
grp.struct_group._asdict
|
||||
grp.struct_group._make
|
||||
grp.struct_group._replace
|
||||
os.EX_NOTFOUND
|
||||
os.SF_MNOWAIT
|
||||
os.SF_NODISKIO
|
||||
os.SF_SYNC
|
||||
posix.sched_param # system dependent. Unclear if macos has it.
|
||||
posix.EX_NOTFOUND
|
||||
posix.XATTR.* # Value seems to be in docs but not defined in github macos
|
||||
readline.append_history_file # not defined in macos
|
||||
select.kqueue.__init__ # default C signature is wrong
|
||||
select.KQ_FILTER_NETDEV # system dependent
|
||||
select.POLLMSG # system dependent
|
||||
socket.socketpair
|
||||
time.CLOCK_HIGHRES
|
||||
|
||||
# ==========
|
||||
# Whitelist entries that cannot or should not be fixed
|
||||
# ==========
|
||||
|
||||
# Modules that do not exist on macos systems
|
||||
_msi
|
||||
_winapi
|
||||
asyncio.windows_events
|
||||
asyncio.windows_utils
|
||||
msilib(.[a-z]+)?
|
||||
msvcrt
|
||||
winreg
|
||||
winsound
|
||||
ossaudiodev
|
||||
spwd
|
||||
|
||||
# NamedTuple like, but not actually NamedTuples
|
||||
posix.[a-z]+_(param|result)._(asdict|make|replace)
|
||||
|
||||
# Platform differences that cannot be captured by the type system
|
||||
fcntl.[A-Z0-9_]+
|
||||
os.SCHED_[A-Z_]+
|
||||
|
||||
# Loadable SQLite extensions are disabled on GitHub runners
|
||||
(sqlite3(.dbapi2)?.Connection.enable_load_extension)?
|
||||
(sqlite3(.dbapi2)?.Connection.load_extension)?
|
||||
@@ -1,2 +0,0 @@
|
||||
locale.nl_langinfo
|
||||
posixpath.realpath
|
||||
|
||||
@@ -3,7 +3,6 @@ locale.[A-Z0-9_]+ # Constants that should be moved to _locale and re-exported c
|
||||
locale.nl_langinfo # Function that should be moved to _locale and re-exported conditionally
|
||||
os.path.join # Parameter name mismatch
|
||||
posixpath.altsep # Type mismatch
|
||||
posixpath.realpath # Parameter name mismatch
|
||||
urllib.request.pathname2url # Parameter name mismatch
|
||||
urllib.request.url2pathname # Same
|
||||
|
||||
|
||||
Reference in New Issue
Block a user