Add docstrings
This commit is contained in:
parent
9a40551ef5
commit
2f003402d3
1 changed files with 6 additions and 1 deletions
|
|
@ -151,13 +151,14 @@
|
|||
(use-package poetry)
|
||||
|
||||
(defun load-python-env ()
|
||||
"Set up the Python IDE in the current project"
|
||||
"Set up the Python IDE in the current project."
|
||||
(interactive)
|
||||
(progn
|
||||
(poetry-venv-workon)
|
||||
(lsp)))
|
||||
|
||||
(defun symbols-at-point ()
|
||||
"Utility function to get the hierarchy of the object at point."
|
||||
(let* ((lsp--document-symbols-request-async t)
|
||||
(symbols (lsp--get-document-symbols))
|
||||
(symbols-hierarchy (lsp--symbols->document-symbols-hierarchy symbols)))
|
||||
|
|
@ -166,6 +167,7 @@
|
|||
symbols-hierarchy)))
|
||||
|
||||
(defun python-test-at-point ()
|
||||
"Use LSP to identify the test at point."
|
||||
(let ((symbols (symbols-at-point)))
|
||||
(pcase symbols
|
||||
(`((,class "Class") (,method "Method") . ,_)
|
||||
|
|
@ -176,11 +178,14 @@
|
|||
(_ ()))))
|
||||
|
||||
(defun python-test-name-at-point ()
|
||||
"Create a unittest-compatible descriptor for the test at point."
|
||||
(let* ((path (mapcar #'substring-no-properties lsp-headerline--path-up-to-project-segments))
|
||||
(filename (f-no-ext (f-filename (buffer-file-name)))))
|
||||
(string-join (append path (list filename) (python-test-at-point)) ".")))
|
||||
|
||||
(defun python-run-test-at-point (debug)
|
||||
"Identify and run the test at point.
|
||||
When DEBUG is set, run the test in the debugger."
|
||||
(interactive "P")
|
||||
(let ((python (or (executable-find "python3")
|
||||
(executable-find "python")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue