Skip to content
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

nox fails in CI even when nox.options.error_on_missing_interpreters = False #650

Closed
johnthagen opened this issue Sep 6, 2022 · 2 comments
Labels

Comments

@johnthagen
Copy link
Contributor

Current Behavior

This PR makes CI fail if there are missing Python interpreters:

There was an exception for --no-error-on-missing-interpreters to override this behavior, but setting this in the noxfile.py itself does not work:

nox.options.error_on_missing_interpreters = False

In CI:

nox > Session test-3.9 was successful.
nox > Running session test-3.10
nox > Session test-3.10 failed: Python interpreter 3.10 not found.
nox > Ran multiple sessions:
nox > * test-3.9: success
nox > * test-3.10: failed

Expected Behavior

When nox.options.error_on_missing_interpreters = False is set, missing interpreters should not fail in CI.

Steps To Reproduce

Create a noxfile.py with

import nox

nox.options.error_on_missing_interpreters = False

@session(python=["3.9", "3.10"])
def test(s: Session) -> None:
    ...

Run this in a python:3.9 Docker image in GitLab CI.

nox > Session test-3.9 was successful.
nox > Running session test-3.10
nox > Session test-3.10 failed: Python interpreter 3.10 not found.
nox > Ran multiple sessions:
nox > * test-3.9: success
nox > * test-3.10: failed

Environment

- OS: `python:3.9` DockerHub image running on GitLab CI
- Python: 3.9
- Nox: 2022.8.7

Anything else?

tox allows this to be set in their configuration file:

@q0w
Copy link
Contributor

q0w commented Oct 20, 2022

its because of flag_pair_merge_func where

    noxfile_value = getattr(noxfile_args, enable_name) # False
    command_value = getattr(command_args, enable_name) # True
    disable_value = getattr(command_args, disable_name) # None
    return (command_value or noxfile_value) and not disable_value #(False or True) and not None

noxfile_value should take precedence over command_value

@johnthagen
Copy link
Contributor Author

johnthagen commented Jul 13, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants