wntrblm / nox

Flexible test automation for Python
https://nox.thea.codes
Apache License 2.0
1.3k stars 148 forks source link

feat: support default=False #810

Closed henryiii closed 5 months ago

henryiii commented 5 months ago

Fix #686 and fix #654. I looked over https://github.com/wntrblm/nox/issues/232#issuecomment-518505164, and that doesn't seem to preclude this as an option. It looks like very early nox adopted nox.options as a general solution, but I don't think that means there can't be a per-session option to remove it from the default list.

Personally, I generally do the inverse - I only have a small set of "default" sessions, and most sessions for me are helpers, etc. But it seems a decent number of projects like this mechanism, and it's also very discoverable. It also reads well inline. An added idea would be a nox.options.default = False mechanism to switch the default for default, so that you'd list the sessions you wanted to run with default = True (which I think would match my usage better), but that could always be added later if people want it, and there probably should be some discussion of the name - default on a session is clear, not so much on nox.options. And I don't see a reason to have it on the command line.

I choose default=False over skip=True. Though either would be fine.

All default=False is not special cased, it behaves like an empty file (in other words, it's like nox.options.sessions = None not nox.options.sessions = [], which prints the list of sessions if nothing is specified). Maybe that would be better, though.