diff options
| author | Liu Hui | 2024-02-26 18:46:36 +0800 |
|---|---|---|
| committer | Basil L. Contovounesios | 2024-03-14 15:09:56 +0100 |
| commit | a7057745f5ef903a2655c6d9e7813168e361baf7 (patch) | |
| tree | 96c9ebebdd1a3f8c2ffcc2405c3f2961fedadb18 /test/lisp/progmodes/python-tests.el | |
| parent | c94d680f6eb46a47549633c7076fe32660b3cd42 (diff) | |
| download | emacs-a7057745f5ef903a2655c6d9e7813168e361baf7.tar.gz emacs-a7057745f5ef903a2655c6d9e7813168e361baf7.zip | |
Detect the readline support for Python shell completion
* lisp/progmodes/python.el
(python-shell-comint-watch-for-first-prompt-output-filter):
Detect the readline support.
(python-shell-readline-completer-delims): Update docstring.
(python-shell-completion-native-setup): Move the readline
detection code to ...
(python-shell-readline-detect): ... new function.
(python-shell-completion-native-turn-on-maybe): Skip if Python
has no readline support.
(python-shell-completion-at-point): Respect the delimiter of
readline completer in non-native completion.
* test/lisp/progmodes/python-tests.el
(python-shell-completion-at-point-1)
(python-shell-completion-at-point-native-1)
(python-completion-at-point-1, python-completion-at-point-2)
(python-completion-at-point-pdb-1)
(python-completion-at-point-while-running-1)
(python-completion-at-point-native-1)
(python-completion-at-point-native-2)
(python-completion-at-point-native-with-ffap-1)
(python-completion-at-point-native-with-eldoc-1): Skip tests if
Python has no readline support.
(python-shell-completion-at-point-jedi-completer): Add test for
non-native Python shell completion. (bug#68559)
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 1ceee690cfb..e11440cdb5b 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -4783,6 +4783,7 @@ def foo(): | |||
| 4783 | (python-tests-with-temp-buffer-with-shell | 4783 | (python-tests-with-temp-buffer-with-shell |
| 4784 | "" | 4784 | "" |
| 4785 | (python-shell-with-shell-buffer | 4785 | (python-shell-with-shell-buffer |
| 4786 | (skip-unless python-shell-readline-completer-delims) | ||
| 4786 | (insert "import abc") | 4787 | (insert "import abc") |
| 4787 | (comint-send-input) | 4788 | (comint-send-input) |
| 4788 | (python-tests-shell-wait-for-prompt) | 4789 | (python-tests-shell-wait-for-prompt) |
| @@ -4797,6 +4798,7 @@ def foo(): | |||
| 4797 | "" | 4798 | "" |
| 4798 | (python-shell-completion-native-turn-on) | 4799 | (python-shell-completion-native-turn-on) |
| 4799 | (python-shell-with-shell-buffer | 4800 | (python-shell-with-shell-buffer |
| 4801 | (skip-unless python-shell-readline-completer-delims) | ||
| 4800 | (insert "import abc") | 4802 | (insert "import abc") |
| 4801 | (comint-send-input) | 4803 | (comint-send-input) |
| 4802 | (python-tests-shell-wait-for-prompt) | 4804 | (python-tests-shell-wait-for-prompt) |
| @@ -4883,11 +4885,14 @@ def foo(): | |||
| 4883 | (python-tests-with-temp-buffer-with-shell | 4885 | (python-tests-with-temp-buffer-with-shell |
| 4884 | "" | 4886 | "" |
| 4885 | (python-shell-with-shell-buffer | 4887 | (python-shell-with-shell-buffer |
| 4886 | (python-shell-completion-native-turn-on) | 4888 | (skip-unless (string= python-shell-readline-completer-delims "")) |
| 4887 | (skip-unless (string= python-shell-readline-completer-delims "")) | 4889 | (python-shell-completion-native-turn-off) |
| 4888 | (python-tests--completion-module) | 4890 | (python-tests--completion-module) |
| 4889 | (python-tests--completion-parameters) | 4891 | (python-tests--completion-parameters) |
| 4890 | (python-tests--completion-extra-context))))) | 4892 | (python-shell-completion-native-turn-on) |
| 4893 | (python-tests--completion-module) | ||
| 4894 | (python-tests--completion-parameters) | ||
| 4895 | (python-tests--completion-extra-context))))) | ||
| 4891 | 4896 | ||
| 4892 | (ert-deftest python-shell-completion-at-point-ipython () | 4897 | (ert-deftest python-shell-completion-at-point-ipython () |
| 4893 | "Check if Python shell completion works for IPython." | 4898 | "Check if Python shell completion works for IPython." |
| @@ -4924,6 +4929,8 @@ def foo(): | |||
| 4924 | import abc | 4929 | import abc |
| 4925 | " | 4930 | " |
| 4926 | (let ((inhibit-message t)) | 4931 | (let ((inhibit-message t)) |
| 4932 | (python-shell-with-shell-buffer | ||
| 4933 | (skip-unless python-shell-readline-completer-delims)) | ||
| 4927 | (python-shell-send-buffer) | 4934 | (python-shell-send-buffer) |
| 4928 | (python-tests-shell-wait-for-prompt) | 4935 | (python-tests-shell-wait-for-prompt) |
| 4929 | (goto-char (point-max)) | 4936 | (goto-char (point-max)) |
| @@ -4940,6 +4947,8 @@ import abc | |||
| 4940 | import abc | 4947 | import abc |
| 4941 | " | 4948 | " |
| 4942 | (let ((inhibit-message t)) | 4949 | (let ((inhibit-message t)) |
| 4950 | (python-shell-with-shell-buffer | ||
| 4951 | (skip-unless python-shell-readline-completer-delims)) | ||
| 4943 | (python-shell-send-buffer) | 4952 | (python-shell-send-buffer) |
| 4944 | (python-tests-shell-wait-for-prompt) | 4953 | (python-tests-shell-wait-for-prompt) |
| 4945 | (python-shell-with-shell-buffer | 4954 | (python-shell-with-shell-buffer |
| @@ -4959,6 +4968,8 @@ pdb.set_trace() | |||
| 4959 | print('Hello') | 4968 | print('Hello') |
| 4960 | " | 4969 | " |
| 4961 | (let ((inhibit-message t)) | 4970 | (let ((inhibit-message t)) |
| 4971 | (python-shell-with-shell-buffer | ||
| 4972 | (skip-unless python-shell-readline-completer-delims)) | ||
| 4962 | (python-shell-send-buffer) | 4973 | (python-shell-send-buffer) |
| 4963 | (python-tests-shell-wait-for-prompt) | 4974 | (python-tests-shell-wait-for-prompt) |
| 4964 | (goto-char (point-max)) | 4975 | (goto-char (point-max)) |
| @@ -4975,6 +4986,8 @@ import time | |||
| 4975 | time.sleep(3) | 4986 | time.sleep(3) |
| 4976 | " | 4987 | " |
| 4977 | (let ((inhibit-message t)) | 4988 | (let ((inhibit-message t)) |
| 4989 | (python-shell-with-shell-buffer | ||
| 4990 | (skip-unless python-shell-readline-completer-delims)) | ||
| 4978 | (python-shell-send-buffer) | 4991 | (python-shell-send-buffer) |
| 4979 | (goto-char (point-max)) | 4992 | (goto-char (point-max)) |
| 4980 | (insert "time.") | 4993 | (insert "time.") |
| @@ -4987,6 +5000,8 @@ time.sleep(3) | |||
| 4987 | import abc | 5000 | import abc |
| 4988 | " | 5001 | " |
| 4989 | (let ((inhibit-message t)) | 5002 | (let ((inhibit-message t)) |
| 5003 | (python-shell-with-shell-buffer | ||
| 5004 | (skip-unless python-shell-readline-completer-delims)) | ||
| 4990 | (python-shell-completion-native-turn-on) | 5005 | (python-shell-completion-native-turn-on) |
| 4991 | (python-shell-send-buffer) | 5006 | (python-shell-send-buffer) |
| 4992 | (python-tests-shell-wait-for-prompt) | 5007 | (python-tests-shell-wait-for-prompt) |
| @@ -5004,6 +5019,8 @@ import abc | |||
| 5004 | import abc | 5019 | import abc |
| 5005 | " | 5020 | " |
| 5006 | (let ((inhibit-message t)) | 5021 | (let ((inhibit-message t)) |
| 5022 | (python-shell-with-shell-buffer | ||
| 5023 | (skip-unless python-shell-readline-completer-delims)) | ||
| 5007 | (python-shell-completion-native-turn-on) | 5024 | (python-shell-completion-native-turn-on) |
| 5008 | (python-shell-send-buffer) | 5025 | (python-shell-send-buffer) |
| 5009 | (python-tests-shell-wait-for-prompt) | 5026 | (python-tests-shell-wait-for-prompt) |
| @@ -5020,6 +5037,8 @@ import abc | |||
| 5020 | import abc | 5037 | import abc |
| 5021 | " | 5038 | " |
| 5022 | (let ((inhibit-message t)) | 5039 | (let ((inhibit-message t)) |
| 5040 | (python-shell-with-shell-buffer | ||
| 5041 | (skip-unless python-shell-readline-completer-delims)) | ||
| 5023 | (python-shell-completion-native-turn-on) | 5042 | (python-shell-completion-native-turn-on) |
| 5024 | (python-shell-send-buffer) | 5043 | (python-shell-send-buffer) |
| 5025 | (python-tests-shell-wait-for-prompt) | 5044 | (python-tests-shell-wait-for-prompt) |
| @@ -5036,6 +5055,8 @@ import abc | |||
| 5036 | import abc | 5055 | import abc |
| 5037 | " | 5056 | " |
| 5038 | (let ((inhibit-message t)) | 5057 | (let ((inhibit-message t)) |
| 5058 | (python-shell-with-shell-buffer | ||
| 5059 | (skip-unless python-shell-readline-completer-delims)) | ||
| 5039 | (python-shell-completion-native-turn-on) | 5060 | (python-shell-completion-native-turn-on) |
| 5040 | (python-shell-send-buffer) | 5061 | (python-shell-send-buffer) |
| 5041 | (python-tests-shell-wait-for-prompt) | 5062 | (python-tests-shell-wait-for-prompt) |