From a60a71e1f6fcaac5da8748a591b0ceac70fe7515 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 13 Sep 2023 14:09:29 +0300 Subject: [PATCH 1/4] Add support for Python 3.12 --- .github/workflows/test.yaml | 8 +++++--- setup.py | 2 ++ tox.ini | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 511c14bac5..169ad46c63 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,15 +9,17 @@ 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 diff --git a/setup.py b/setup.py index 61975989ff..ca2170ce44 100755 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tox.ini b/tox.ini index 016beedb91..310f0761ec 100644 --- a/tox.ini +++ b/tox.ini @@ -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 From febdb639d4b80a64bab4dfc60e81d41ae970137e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 13 Sep 2023 14:14:37 +0300 Subject: [PATCH 2/4] Add colour to test logs for readability --- .github/workflows/test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 169ad46c63..82ed05d432 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,6 +5,9 @@ on: pull_request: branches: [master] +env: + FORCE_COLOR: 1 + jobs: test-ubuntu: runs-on: ubuntu-latest From 99b5ccb6be13b08b83cc5d654345ce5ed688cc54 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 13 Sep 2023 14:18:56 +0300 Subject: [PATCH 3/4] Remove redundant code for Python <= 3.6 --- src/prompt_toolkit/application/application.py | 2 +- src/prompt_toolkit/application/current.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/prompt_toolkit/application/application.py b/src/prompt_toolkit/application/application.py index 8683705bf7..c6e67ab9f9 100644 --- a/src/prompt_toolkit/application/application.py +++ b/src/prompt_toolkit/application/application.py @@ -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: diff --git a/src/prompt_toolkit/application/current.py b/src/prompt_toolkit/application/current.py index 736cb064f4..908141a476 100644 --- a/src/prompt_toolkit/application/current.py +++ b/src/prompt_toolkit/application/current.py @@ -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: From 6749a61e9e6ca45614f2b8ac68d0483013990019 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 2 Nov 2023 12:40:52 +0200 Subject: [PATCH 4/4] Fix Black warning --- tests/test_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 39aeedd45d..3a16e9fbd3 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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"