When pytest-run is run while the current buffer is e.g. a magit buffer, the following error is output
Wrong 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 a buffer-file-name.