diff --git a/python-pytest.el b/python-pytest.el index 6e95f54..e28b8ab 100644 --- a/python-pytest.el +++ b/python-pytest.el @@ -282,6 +282,7 @@ With a prefix ARG, allow editing." (user-error "No previous pytest run for this project")) (python-pytest--run-command :command command + :popup-arguments python-pytest-arguments :edit current-prefix-arg))) @@ -293,24 +294,26 @@ With a prefix ARG, allow editing." (cl-defun python-pytest--run (&key args file func edit) "Run pytest for the given arguments." - (setq args (python-pytest--transform-arguments args)) - (when (and file (file-name-absolute-p file)) - (setq file (python-pytest--relative-file-name file))) - (when func - (setq func (s-replace "." "::" func))) - (let ((command) - (thing (cond - ((and file func) (format "%s::%s" file func)) - (file file)))) - (when thing - (setq args (-snoc args (python-pytest--shell-quote thing)))) - (setq args (cons python-pytest-executable args) - command (s-join " " args)) - (python-pytest--run-command - :command command - :edit edit))) - -(cl-defun python-pytest--run-command (&key command edit) + (let ((popup-arguments args)) + (setq args (python-pytest--transform-arguments args)) + (when (and file (file-name-absolute-p file)) + (setq file (python-pytest--relative-file-name file))) + (when func + (setq func (s-replace "." "::" func))) + (let ((command) + (thing (cond + ((and file func) (format "%s::%s" file func)) + (file file)))) + (when thing + (setq args (-snoc args (python-pytest--shell-quote thing)))) + (setq args (cons python-pytest-executable args) + command (s-join " " args)) + (python-pytest--run-command + :command command + :popup-arguments popup-arguments + :edit edit)))) + +(cl-defun python-pytest--run-command (&key command popup-arguments edit) "Run a pytest command line." (let* ((default-directory (python-pytest--project-root))) (when python-pytest-confirm @@ -324,9 +327,11 @@ With a prefix ARG, allow editing." (setq python-pytest--history (-uniq python-pytest--history)) (puthash (python-pytest--project-root) command python-pytest--project-last-command) - (python-pytest-run-as-comint command))) + (python-pytest-run-as-comint + :command command + :popup-arguments popup-arguments))) -(defun python-pytest-run-as-comint (command) +(cl-defun python-pytest-run-as-comint (&key command popup-arguments) "Run a pytest comint session for COMMAND." (let* ((buffer (python-pytest--get-buffer)) (process (get-buffer-process buffer))) @@ -340,7 +345,9 @@ With a prefix ARG, allow editing." (erase-buffer) (python-pytest-mode) (insert (format "cwd: %s\ncmd: %s\n\n" default-directory command)) - (setq python-pytest--current-command command) + (make-local-variable 'python-pytest-arguments) + (setq python-pytest--current-command command + python-pytest-arguments popup-arguments) (when python-pytest-pdb-track (add-hook 'comint-output-filter-functions