Skip to content

Commit f1a0a74

Browse files
authored
Add support for Python 3.12 (#1782)
* Add support for Python 3.12 * Add colour to test logs for readability * Remove redundant code for Python <= 3.6 * Fix Black warning
1 parent f47186a commit f1a0a74

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

.github/workflows/test.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ on:
55
pull_request:
66
branches: [master]
77

8+
env:
9+
FORCE_COLOR: 1
10+
811
jobs:
912
test-ubuntu:
1013
runs-on: ubuntu-latest
1114
strategy:
15+
fail-fast: false
1216
matrix:
13-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
17+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1418

1519
steps:
16-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
1721
- name: Setup Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v4
1923
with:
2024
python-version: ${{ matrix.python-version }}
25+
allow-prereleases: true
2126
- name: Install Dependencies
2227
run: |
2328
sudo apt remove python3-pip

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def get_version(package):
4444
"Programming Language :: Python :: 3.8",
4545
"Programming Language :: Python :: 3.9",
4646
"Programming Language :: Python :: 3.10",
47+
"Programming Language :: Python :: 3.11",
48+
"Programming Language :: Python :: 3.12",
4749
"Programming Language :: Python :: 3 :: Only",
4850
"Programming Language :: Python",
4951
"Topic :: Software Development",

src/prompt_toolkit/application/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ def _enable_breakpointhook(self) -> Generator[None, None, None]:
10051005
manager. (We will only install the hook if no other custom hook was
10061006
set.)
10071007
"""
1008-
if sys.version_info >= (3, 7) and sys.breakpointhook == sys.__breakpointhook__:
1008+
if sys.breakpointhook == sys.__breakpointhook__:
10091009
sys.breakpointhook = self._breakpointhook
10101010

10111011
try:

src/prompt_toolkit/application/current.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,8 @@ def create_app_session(
144144
Create a separate AppSession.
145145
146146
This is useful if there can be multiple individual `AppSession`s going on.
147-
Like in the case of an Telnet/SSH server. This functionality uses
148-
contextvars and requires at least Python 3.7.
147+
Like in the case of an Telnet/SSH server.
149148
"""
150-
151149
# If no input/output is specified, fall back to the current input/output,
152150
# whatever that is.
153151
if input is None:

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_emacs_cursor_movements():
190190
def test_emacs_kill_multiple_words_and_paste():
191191
# Using control-w twice should place both words on the clipboard.
192192
result, cli = _feed_cli_with_input(
193-
"hello world test" "\x17\x17" "--\x19\x19\r" # Twice c-w. # Twice c-y.
193+
"hello world test\x17\x17--\x19\x19\r" # Twice c-w. Twice c-y.
194194
)
195195
assert result.text == "hello --world testworld test"
196196
assert cli.clipboard.get_data().text == "world test"

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py26, py27, py33, py34, py35, pypy, pypy3
7+
envlist = py{37, 38, 39, 310, 311, 312, py3}
88

99
[testenv]
10-
commands = py.test []
10+
commands = pytest []
1111

1212
deps=
1313
pytest

0 commit comments

Comments
 (0)