-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add Python 3.13 (beta) support #12334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Support for Python 3.13 (beta1 at the time of writing). |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -289,7 +289,8 @@ def assert_contains(self, entries: Sequence[Tuple[str, str]]) -> None: | |||||||
__tracebackhide__ = True | ||||||||
i = 0 | ||||||||
entries = list(entries) | ||||||||
backlocals = sys._getframe(1).f_locals | ||||||||
# Since Python 3.13, f_locals is not a dict, but eval requires a dict. | ||||||||
backlocals = dict(sys._getframe(1).f_locals) | ||||||||
while entries: | ||||||||
name, check = entries.pop(0) | ||||||||
for ind, call in enumerate(self.calls[i:]): | ||||||||
|
@@ -760,6 +761,9 @@ def _makefile( | |||||||
) -> Path: | ||||||||
items = list(files.items()) | ||||||||
|
||||||||
if ext is None: | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave a note here:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's necessary, since I think we better not rely on it and just keep the check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see what harm a small comment like that could cause either, but OK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also in that case, we probably should change the signature as well, so we have the typing match the runtime behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well OK, this is no big deal anyway. |
||||||||
raise TypeError("ext must not be None") | ||||||||
|
||||||||
if ext and not ext.startswith("."): | ||||||||
raise ValueError( | ||||||||
f"pytester.makefile expects a file extension, try .{ext} instead of {ext}" | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# mypy: allow-untyped-defs | ||
from __future__ import annotations | ||
|
||
import fnmatch | ||
import importlib | ||
import io | ||
import operator | ||
|
@@ -237,7 +238,7 @@ def f(n): | |
n += 1 | ||
f(n) | ||
|
||
excinfo = pytest.raises(RuntimeError, f, 8) | ||
excinfo = pytest.raises(RecursionError, f, 8) | ||
traceback = excinfo.traceback | ||
recindex = traceback.recursionindex() | ||
assert recindex == 3 | ||
|
@@ -373,7 +374,10 @@ def test_excinfo_no_sourcecode(): | |
except ValueError: | ||
excinfo = _pytest._code.ExceptionInfo.from_current() | ||
s = str(excinfo.traceback[-1]) | ||
assert s == " File '<string>':1 in <module>\n ???\n" | ||
# TODO: Since Python 3.13b1 under pytest-xdist, the * is `import | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so. |
||
# sys;exec(eval(sys.stdin.readline()))` (execnet bootstrap code) | ||
# instead of `???` like before. Is this OK? | ||
fnmatch.fnmatch(s, " File '<string>':1 in <module>\n *\n") | ||
|
||
|
||
def test_excinfo_no_python_sourcecode(tmp_path: Path) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://discuss.python.org/t/pep-667-consistent-views-of-namespaces/46631/36