-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transient arg for pytest-xdist parallelization #54
Conversation
thanks, but i think this won't work out of the box because it depends on pytest plugins? not sure how to handle that gracefully. thoughts? similar things apply for for coverage flags ( |
One option could be to query for installed plugins and display their respective options. Having said that, I found that (defun pytest--plugins (packages)
"Find information about installed PACKAGES.
Return an alist that elements are cons of package from PACKAGES
and the installed version (or nil if not installed)."
(let ((installed-packages
(with-temp-buffer
(shell-command "pip list --format=json" (current-buffer))
(goto-char (point-min))
(json-read))))
(seq-map
(lambda (plugin)
(cons plugin
(seq-some
(lambda (pkg-info)
(let-alist pkg-info
(when (string= .name plugin)
.version)))
installed-packages)))
packages)))
(pytest--plugins '("pytest-xdist" "pytest-cov" "pytest-foo"))
-> (("pytest-xdist" . "2.4.0") ("pytest-cov" . "2.12.1") ("pytest-foo")) Edit: now when I think of it, it doesn't account that pytest may be called from "somewhere". I.e., |
Good call on only adding this if the plugins are installed. pytest actually returns plugin information if you pass This function returns
But I'm not sure the best way to conditionally include the plugin flags to the transient. Any ideas there? |
tbh i'm not a fan of dynamic plugin inspection
both |
To add to that list, I'm not sure neither how to deal with it (redefine
While I can see the former is being used in a few projects I'm working with these days, I cannot see the latter. Calling
While I don't know yet how to achieve that and I acknowledge that would require some work, perhaps it's worth investigating filtering out unknown options right before calling |
re |
With all that has been said, I'm loosing my appreciation for dynamic plugin discovery. At least for now. Perhaps in a future we may want to revisit. What's been done in e491a98 - LGTM |
Thanks for your work on this @wbolster! |
This PR adds rudimentary support for the pytest-xdist
-n
flag.