-
-
Notifications
You must be signed in to change notification settings - Fork 21
multiple options to addopts #18
Comments
Yes. It seems non-obvious to me how one could capture the nuances of this pass-through in a option description. I note that this format also matches that of the 'addopts' value in pytest.ini. I tried adding a reference to this URL, but in
One couldn't copy that URL to the clipboard and open it without editing it first. At the same time, I don't want to try to repeat that detail in the quick help. Perhaps the solution is to put more details in the readme. Or maybe there's an elegant way to capture the details in the option description. Or maybe using a URL shortener would work there. What do you recommend? |
Actually, that link still left me a tab confused. I think it's because here we're specifying command line options inside of a command line option (as opposed to command line options inside of a config variable). E.g. here I would be worried about writing
I'm not sure what's possible, as I'm pretty new to setuptools. That said, I'd be tempted to try:
|
I've looked into the first two options in pytest-dev/pytest#567, but due to the implementation of distutils (which drives the processing of options to a distutils command, which pytest-runner is), there's no mechanism that I found to cleanly (a) introspect options to pytest or (b) inject them into the distutils command. Option 3, moving to using a config file, falls prey to the same problem. There's already a mechanism for supplying options in a config file. But since pytest itself already accepts most of its options via a config file in a field called If someone can come up with a solution that allows the options to pytest to be passed naturally (without forcing a great deal of duplication in the runner code), I'd be all for that, but I'm not optimistic it's even possible. That said, I've started work on a new project that aims to move away from distutils and setuptools for dependency resolution, while providing some of the same benefits that
So you get the elegance of passing parameters directly to pytest, and the convenience of resolving the test requirements into an ephemeral environment, and all without the trouble of setting up virtualenvs or leaving a lot of cruft around after. I do dislike that Anyway, food for thought. I hope this inspires some ideas, and I welcome suggestions and PRs, but as it stands, I don't see any way to move this forward, so I'm going to close it until such a point as it becomes actionable. |
FWIW I just opened pytest-dev/pytest#1813 which attempts to fix pytest-dev/pytest#567, so your feedback is welcome @jaraco. 😁 |
Thanks @jaraco - you've clearly thought this one through, and I'm happy to close it. rwt sounds nifty too - good luck. |
I might be missing something, but it seems the only way to pass multiple options to pytest are by using a single
--addopts
and wrapping the multiple optoins in quotes e.g.Is this expected? If so, it might help to tweak the user_options definition to explain this. (As an aside, it wasn't clear to me how to even use one argument:
--addopts arg=val
or--addopts arg val
etc.)The text was updated successfully, but these errors were encountered: