Skip to content
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
1 change: 0 additions & 1 deletion Lib/asyncio/staggered.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ async def staggered_race(coro_fns, delay, *, loop=None):
coroutine's entry is ``None``.

"""
# TODO: when we have aiter() and anext(), allow async iterables in coro_fns.
loop = loop or events.get_running_loop()
parent_task = tasks.current_task(loop)
enum_coro_fns = enumerate(coro_fns)
Expand Down
2 changes: 2 additions & 0 deletions Lib/site-packages/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory exists so that 3rd party packages can be installed
here. Read the source for site.py for more details.
120 changes: 120 additions & 0 deletions Lib/test/_crossinterp_definitions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# This may be loaded as a module, in the current __main__ module,
# or in another __main__ module.


#######################################
# functions and generators

from test._code_definitions import *


#######################################
# classes

class Spam:
# minimal
pass


class SpamOkay:
def okay(self):
return True


class SpamFull:

a: object
b: object
c: object

@staticmethod
def staticmeth(cls):
return True

@classmethod
def classmeth(cls):
return True

def __new__(cls, *args, **kwargs):
return super().__new__(cls)

def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c

# __repr__
# __str__
# ...

def __eq__(self, other):
if not isinstance(other, SpamFull):
return NotImplemented
return (self.a == other.a and
self.b == other.b and
self.c == other.c)

@property
def prop(self):
return True


class SubSpamFull(SpamFull):
...


class SubTuple(tuple):
...


def class_eggs_inner():
class EggsNested:
...
return EggsNested
EggsNested = class_eggs_inner()


TOP_CLASSES = {
Spam: (),
SpamOkay: (),
SpamFull: (1, 2, 3),
SubSpamFull: (1, 2, 3),
SubTuple: ([1, 2, 3],),
}
CLASSES_WITHOUT_EQUALITY = [
Spam,
SpamOkay,
]
BUILTIN_SUBCLASSES = [
SubTuple,
]
NESTED_CLASSES = {
EggsNested: (),
}
CLASSES = {
**TOP_CLASSES,
**NESTED_CLASSES,
}


#######################################
# exceptions

class MimimalError(Exception):
pass


class RichError(Exception):
def __init__(self, msg, value=None):
super().__init__(msg, value)
self.msg = msg
self.value = value

def __eq__(self, other):
if not isinstance(other, RichError):
return NotImplemented
if self.msg != other.msg:
return False
if self.value != other.value:
return False
return True
4 changes: 2 additions & 2 deletions Lib/test/support/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# aliases:
from _interpchannels import (
ChannelError, ChannelNotFoundError, ChannelClosedError,
ChannelEmptyError, ChannelNotEmptyError,
ChannelError, ChannelNotFoundError, ChannelClosedError, # noqa: F401
ChannelEmptyError, ChannelNotEmptyError, # noqa: F401
)
from concurrent.interpreters._crossinterp import (
UNBOUND_ERROR, UNBOUND_REMOVE,
Expand Down
19 changes: 12 additions & 7 deletions Lib/test/test_android.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import platform
import queue
import re
import subprocess
Expand All @@ -16,6 +17,11 @@
if sys.platform != "android":
raise unittest.SkipTest("Android-specific")

# Some API levels filter out consecutive identical lines and replace them with a
# "chatty" marker.
api_level = platform.android_ver().api_level
chatty_issue = (26 <= api_level <= 30)

# (name, level, fileno)
STREAM_INFO = [("stdout", "I", 1), ("stderr", "W", 2)]

Expand Down Expand Up @@ -174,15 +180,13 @@ def write(s, lines=None, *, write_len=None):
write("\u0000b", [r"\xc0\x80b"])
write("a\u0000b", [r"a\xc0\x80b"])

# Multi-line messages. Avoid identical consecutive lines, as
# they may activate "chatty" filtering and break the tests.
#
# Additional spaces will appear in the output where necessary to
# protect leading newlines.
# Multi-line messages. Additional spaces will appear in the output where
# necessary to protect leading newlines.
write("\nx", [" "])
write("\na\n", ["x", "a"])
write("\n", [" "])
write("\n\n", [" ", " "])
if not chatty_issue:
write("\n\n", [" ", " "])
write("b\n", ["b"])
write("c\n\n", ["c", " "])
write("d\ne", ["d"])
Expand All @@ -201,7 +205,8 @@ def write(s, lines=None, *, write_len=None):
write("\nx", [" ", "x"])
write("\na\n", [" ", "a"])
write("\n", [" "])
write("\n\n", [" ", " "])
if not chatty_issue:
write("\n\n", [" ", " "])
write("b\n", ["b"])
write("c\n\n", ["c", " "])
write("d\ne", ["d", "e"])
Expand Down
5 changes: 3 additions & 2 deletions Lib/test/test_ctypes/test_dlerror.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
"""


@unittest.skipUnless(sys.platform.startswith('linux'),
'test requires GNU IFUNC support')
@unittest.skipIf(not sys.platform.startswith('linux')
or platform.machine().startswith('parisc'),
'test requires GNU IFUNC support')
@unittest.skipIf(test.support.linked_to_musl(), "Requires glibc")
class TestNullDlsym(unittest.TestCase):
"""GH-126554: Ensure that we catch NULL dlsym return values
Expand Down
9 changes: 9 additions & 0 deletions Lib/test/test_interpreters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os
from test.support import load_package_tests, Py_GIL_DISABLED
import unittest

if Py_GIL_DISABLED:
raise unittest.SkipTest("GIL disabled")

def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)
4 changes: 4 additions & 0 deletions Lib/test/test_interpreters/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import load_tests
import unittest

unittest.main()
Loading
Loading