Skip to content

Commit

Permalink
Simplified logical expression of platform groupings.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Feb 4, 2024
1 parent 74803b1 commit 86cbced
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,28 +537,30 @@ def requires_debug_ranges(reason='requires co_positions / debug_ranges'):
is_apple_mobile = sys.platform in {"ios", "tvos", "watchos"}
is_apple = is_apple_mobile or sys.platform == "darwin"

has_fork_support = (
hasattr(os, "fork")
and not is_emscripten
and not is_wasi
and not is_apple_mobile
has_fork_support = hasattr(os, "fork") and not (
is_emscripten
or is_wasi
or is_apple_mobile
)

def requires_fork():
return unittest.skipUnless(has_fork_support, "requires working os.fork()")

has_subprocess_support = (
not is_emscripten
and not is_wasi
and not is_apple_mobile
has_subprocess_support = not (
is_emscripten
or is_wasi
or is_apple_mobile
)

def requires_subprocess():
"""Used for subprocess, os.spawn calls, fd inheritance"""
return unittest.skipUnless(has_subprocess_support, "requires subprocess support")

# Emscripten's socket emulation and WASI sockets have limitations.
has_socket_support = not is_emscripten and not is_wasi
has_socket_support = not (
is_emscripten
or is_wasi
)

def requires_working_socket(*, module=False):
"""Skip tests or modules that require working sockets
Expand Down

0 comments on commit 86cbced

Please sign in to comment.