Skip to content

Commit 5f1f434

Browse files
authored
drop 3.8, add 3.13 (#826)
1 parent d9e32c4 commit 5f1f434

File tree

4 files changed

+32
-47
lines changed

4 files changed

+32
-47
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy-3.9"]
15+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9"]
1616
os: [ubuntu-latest]
1717
# Include minimum py3 + maximum py3 + pypy3 on Windows
1818
include:
19-
- { os: "windows-latest" , python-version: "3.8" }
20-
- { os: "windows-latest" , python-version: "3.11" }
19+
- { os: "windows-latest" , python-version: "3.9" }
20+
- { os: "windows-latest" , python-version: "3.13" }
2121
- { os: "windows-latest" , python-version: "pypy-3.9" }
2222

2323
steps:

pyflakes/test/test_api.py

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -479,16 +479,12 @@ def foo(bar=baz, bax):
479479
else:
480480
msg = 'non-default argument follows default argument'
481481

482-
if PYPY and sys.version_info >= (3, 9):
482+
if PYPY:
483483
column = 18
484-
elif PYPY:
485-
column = 8
486484
elif sys.version_info >= (3, 10):
487485
column = 18
488-
elif sys.version_info >= (3, 9):
489-
column = 21
490486
else:
491-
column = 9
487+
column = 21
492488
last_line = ' ' * (column - 1) + '^\n'
493489
self.assertHasErrors(
494490
sourcePath,
@@ -508,23 +504,13 @@ def test_nonKeywordAfterKeywordSyntaxError(self):
508504
foo(bar=baz, bax)
509505
"""
510506
with self.makeTempFile(source) as sourcePath:
511-
if sys.version_info >= (3, 9):
512-
column = 17
513-
elif not PYPY:
514-
column = 14
515-
else:
516-
column = 13
517-
last_line = ' ' * (column - 1) + '^\n'
518-
columnstr = '%d:' % column
519-
520-
message = 'positional argument follows keyword argument'
521-
507+
last_line = ' ' * 16 + '^\n'
522508
self.assertHasErrors(
523509
sourcePath,
524-
["""\
525-
{}:1:{} {}
510+
[f"""\
511+
{sourcePath}:1:17: positional argument follows keyword argument
526512
foo(bar=baz, bax)
527-
{}""".format(sourcePath, columnstr, message, last_line)])
513+
{last_line}"""])
528514

529515
def test_invalidEscape(self):
530516
"""
@@ -533,11 +519,9 @@ def test_invalidEscape(self):
533519
# ValueError: invalid \x escape
534520
with self.makeTempFile(r"foo = '\xyz'") as sourcePath:
535521
position_end = 1
536-
if PYPY and sys.version_info >= (3, 9):
522+
if PYPY:
537523
column = 7
538-
elif PYPY:
539-
column = 6
540-
elif (3, 9) <= sys.version_info < (3, 12):
524+
elif sys.version_info < (3, 12):
541525
column = 13
542526
else:
543527
column = 7
@@ -669,23 +653,11 @@ def test_stdinReportsErrors(self):
669653
self.assertEqual(count, 1)
670654
errlines = err.getvalue().split("\n")[:-1]
671655

672-
if sys.version_info >= (3, 9):
673-
expected_error = [
674-
"<stdin>:1:5: Generator expression must be parenthesized",
675-
"max(1 for i in range(10), key=lambda x: x+1)",
676-
" ^",
677-
]
678-
elif PYPY:
679-
expected_error = [
680-
"<stdin>:1:4: Generator expression must be parenthesized if not sole argument", # noqa: E501
681-
"max(1 for i in range(10), key=lambda x: x+1)",
682-
" ^",
683-
]
684-
else:
685-
expected_error = [
686-
"<stdin>:1:5: Generator expression must be parenthesized",
687-
]
688-
656+
expected_error = [
657+
"<stdin>:1:5: Generator expression must be parenthesized",
658+
"max(1 for i in range(10), key=lambda x: x+1)",
659+
" ^",
660+
]
689661
self.assertEqual(errlines, expected_error)
690662

691663

@@ -774,8 +746,14 @@ def test_errors_syntax(self):
774746
with open(self.tempfilepath, 'wb') as fd:
775747
fd.write(b"import")
776748
d = self.runPyflakes([self.tempfilepath])
777-
error_msg = '{0}:1:7: invalid syntax{1}import{1} ^{1}'.format(
778-
self.tempfilepath, os.linesep)
749+
750+
if sys.version_info >= (3, 13):
751+
message = "Expected one or more names after 'import'"
752+
else:
753+
message = 'invalid syntax'
754+
755+
error_msg = '{0}:1:7: {1}{2}import{2} ^{2}'.format(
756+
self.tempfilepath, message, os.linesep)
779757
self.assertEqual(d, ('', error_msg, 1))
780758

781759
def test_readFromStdin(self):

pyflakes/test/test_type_annotations.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,3 +797,10 @@ def g(*args: P.args, **kwargs: P.kwargs) -> R:
797797
return f(*args, **kwargs)
798798
return g
799799
""")
800+
801+
@skipIf(version_info < (3, 13), 'new in Python 3.13')
802+
def test_type_parameter_defaults(self):
803+
self.flakes("""
804+
def f[T = int](u: T) -> T:
805+
return u
806+
""")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_long_description():
4242
author_email="[email protected]",
4343
url="https://github.com/PyCQA/pyflakes",
4444
packages=["pyflakes", "pyflakes.scripts", "pyflakes.test"],
45-
python_requires='>=3.8',
45+
python_requires='>=3.9',
4646
classifiers=[
4747
"Development Status :: 6 - Mature",
4848
"Environment :: Console",

0 commit comments

Comments
 (0)