Skip to content

Commit

Permalink
Add support for Python 3.12 (#1782)
Browse files Browse the repository at this point in the history
* Add support for Python 3.12

* Add colour to test logs for readability

* Remove redundant code for Python <= 3.6

* Fix Black warning
  • Loading branch information
hugovk committed Nov 3, 2023
1 parent f47186a commit f1a0a74
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ on:
pull_request:
branches: [master]

env:
FORCE_COLOR: 1

jobs:
test-ubuntu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install Dependencies
run: |
sudo apt remove python3-pip
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def get_version(package):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python",
"Topic :: Software Development",
Expand Down
2 changes: 1 addition & 1 deletion src/prompt_toolkit/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def _enable_breakpointhook(self) -> Generator[None, None, None]:
manager. (We will only install the hook if no other custom hook was
set.)
"""
if sys.version_info >= (3, 7) and sys.breakpointhook == sys.__breakpointhook__:
if sys.breakpointhook == sys.__breakpointhook__:
sys.breakpointhook = self._breakpointhook

try:
Expand Down
4 changes: 1 addition & 3 deletions src/prompt_toolkit/application/current.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ def create_app_session(
Create a separate AppSession.
This is useful if there can be multiple individual `AppSession`s going on.
Like in the case of an Telnet/SSH server. This functionality uses
contextvars and requires at least Python 3.7.
Like in the case of an Telnet/SSH server.
"""

# If no input/output is specified, fall back to the current input/output,
# whatever that is.
if input is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_emacs_cursor_movements():
def test_emacs_kill_multiple_words_and_paste():
# Using control-w twice should place both words on the clipboard.
result, cli = _feed_cli_with_input(
"hello world test" "\x17\x17" "--\x19\x19\r" # Twice c-w. # Twice c-y.
"hello world test\x17\x17--\x19\x19\r" # Twice c-w. Twice c-y.
)
assert result.text == "hello --world testworld test"
assert cli.clipboard.get_data().text == "world test"
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# and then run "tox" from this directory.

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

[testenv]
commands = py.test []
commands = pytest []

deps=
pytest

0 comments on commit f1a0a74

Please sign in to comment.