-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Change default behavior for --error-on-missing-interpreters
#340
Comments
This is intentional behavior and you can fail these sessions using |
Thanks! As a user, this was unexpected (CI passing when no tests were run) To minimize surprise, I would suggest:
Are those reasonable or do I misunderstand the intent? |
I think this is perfectly reasonable and we should do it. That said, I think in CI you still would have the same "I didn't notice that" experience. |
Two is definitely reasonable, but I'm hesitant to do one.
…On Fri, Aug 21, 2020 at 2:29 PM Chris Broadfoot ***@***.***> wrote:
Thanks! As a user, this was unexpected.
To minimize surprise, I would suggest:
- make this a hard failure when no interpreter in the matrix is found
(i.e., no tests were run)
- mention the --error-on-missing-interpreters flag in the
error/warning/success message if an interpreter was skipped
Are those reasonable or do I misunderstand the intent?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#340 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB5I465JOED2GTRIJYBSJDSB24HVANCNFSM4QHQTSYA>
.
|
@theacodes How would you feel about changing the default value of
|
--error-on-missing-interpreters
Hmmm I don't like the idea of differing default behavior based on
environment.
…On Fri, Aug 21, 2020, 2:40 PM Danny Hermes ***@***.***> wrote:
@theacodes <https://github.com/theacodes> How would you feel about
changing the default value of --error-on-missing-interpreters depending
on environment? Things we could do to decide to make it default on:
- CI=true is set (I'm pretty sure TravisCI, CircleCI and AppVeyor all
set this, not sure about GitHub actions or the AWS code builder thing)
- sys.stdout.isatty() is False
- sys.stdin.isatty() is False
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#340 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB5I4YHEHZ3KOS7YHFYFX3SB25THANCNFSM4QHQTSYA>
.
|
I am with you on that one in pretty much all cases. But it isn't a great experience (and it's fairly common) when someone is running in CI like @broady reported here. I feel like switching |
Alright, coming back to this I'd be willing to review a PR that:
|
--error-on-missing-interpreters
--error-on-missing-interpreters
GitHub Actions recently removed some old Python versions from the default installs, which caused the nox action to silently no longer include them - but my jobs were "passing" and I had no idea that I was not running anything, even though I was explicitly running one job per line.
On reading the above, I'm not sure I like changing the "non-interactive sessions" behavior, it's really tricky to get non-interactive sessions right - piping to a pager, for example. Since I always run one Python version per action or job, my option (1) would be fine with me, even though it could probably be implemented in parallel with another option. It would not break local running 99% of the time, since you are either running on all Python versions and at least one matches (the one you are on), or you ask for a specific version and it's quite fine to error if it's not found. Also, by "error" I mean produce an error code. I don't really care if it's exactly the same printout as we have today. I just need to know to look in my CI logs! |
Also, quick workaround that doesn't seem to be mentioned yet, but can be implemented at the noxfile level: if os.environ.get("CI", None):
nox.options.error_on_missing_interpreters = True I'd rather not have to add that to dozens of noxfiles, and have to include that in docs and tutorials, but that's a way to improve CI safety for now. |
@theacodes @dhermes @FollowTheProcess @cjolowicz (and anyone else) thoughts here? I would really, really like the error code if at least one matching interpreter is not found (I'm totally fine with exactly the same text printout, I just want the error code so CI doesn't "pass"). And maybe some of the other ideas. But I (almost) always run and recommend one Python process per step or job, so that would fix CI in a lot of cases. Scikit-build is an example where several "passing" jobs were passing, with the only clue being the job length of a few seconds. |
I've been tripped up by this too, and actually so has Nox itself: #475. IMO the average user shouldn't have to care about this which means we can't add pain to local runs whilst doing the correct thing on CI, I think the cleanest way of doing this is checking for the Maybe say if you want to emulate behaviour on CI, set I appreciate the concern that this is different behaviour based on a somewhat hidden environment state but ultimately, CI is a different environment and in this case I think it makes sense that we behave differently. I'm also not against the Either way, something we could do quickly to address this is document @henryiii's workaround: if os.environ.get("CI", None):
nox.options.error_on_missing_interpreters = True We could discuss forever, I think the best thing to do is just take a crack at a solution and get it into PR review for us all to discuss a bit more concretely. I'll try and have a go over the next week or so 👍🏻 |
IMO, error codes no not cause the average user to "care". You don't normally even see them on the command line, they do not cause a failure in scripts unless you set an option, etc. Error codes are using when scripting with things like If you run nox and request a session, and no session runs because no matching interpreter is found, that should return an error code. The printout doesn't have to even change, but it could - nox should run at least one thing before saying "completed successfully" if you ask for a session. I've worked with that part of the code before, pretty sure I could provide a fix if you are agreeable. I can't actually reproduce this locally for an illustration, because unfound interpreters are always errors for me locally, due to #381 🤦. This never has bothered me enough to care, though, since I just ignore the error message and look at the ones that do complete (or ask for the one I want to run that's not in pyenv). |
I'm not "against" the non-interactive solution either, I just know from experience with color that it's a bit finicky. And interactively, error codes don't matter anyway, so I don't really see a point in toggling error codes based on interactivity. |
Sorry if I wasn't clear, I wasn't referring to exit codes specifically as impacting users, more so any solution that would cause skipped local missing interpreter sessions to now cause an error for example defaulting
Sorry if I'm not understanding you, are you suggesting this as behaviour in all situations (i.e. both on CI and local dev) or just to be applied when in CI? I think we're broadly on the same page. If we check for |
+1 for option 3:
Additionally, it would be good to add the warning described here:
I'm -0.5 for option 1:
|
Okay, mostly really looking forward to it being solved! If I have a chance to start a PR, I'll drop a note here (unless it's really quick). |
Is it possible to improve
--error-on-missing-interpreters
with "principle of least surprise" in mind? We don't want onerous failures during local dev, but the two changes are proposed:--error-on-missing-interpreters
flag in the error / warning / success message if an interpreter was skipped--error-on-missing-interpreters
to default ON (instead of OFF) if we've detected the code is in CI (CI=true
) or in an automated environment (sys.stdout.isatty()==False
)Original Content (Original title: Test suite skipped with error "Python interpreter 3.8 not found.)
Describe the bug
The desired Python version was not available, the test suite is skipped entirely.
How to reproduce
Expected behavior
non-zero exit code
The text was updated successfully, but these errors were encountered: