Open twmr opened 1 year ago
A possible fix is to check the value of buffer-file-name
in pytest-find-test-runner
.
;;; Utility functions
(defun pytest-find-test-runner ()
- (let ((result
- (cl-reduce '(lambda (x y) (or x y))
- (mapcar 'pytest-find-test-runner-names pytest-project-names))))
- (if result
- result
- pytest-global-name)))
+ (if buffer-file-name
+ (if-let ((result
+ (cl-reduce '(lambda (x y) (or x y))
+ (mapcar 'pytest-find-test-runner-names pytest-project-names))))
+ result
+ pytest-global-name)
+ pytest-global-name))
but probably the check could also be added to pytest-find-test-runner-names
When
pytest-run
is run while the current buffer is e.g. a magit buffer, the following error is outputWrong type argument: stringp, nil
This is because
pytest-find-test-runner-names
runs(file-name-directory buffer-file-name)
, which raises the above error when run inside a buffer that doesn't have abuffer-file-name
.