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
Check for NOXSESSION
environment variable
#121
Conversation
nox/tasks.py
Outdated
@@ -84,12 +86,17 @@ def filter_manifest(manifest, global_config): | |||
the manifest otherwise (to be sent to the next task). | |||
|
|||
""" | |||
|
|||
nox_env = os.environ.get("NOXSESSION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible for us to do this in __main__
using argparse?
https://github.com/theacodes/nox/blob/master/nox/__main__.py#L66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure where to put it. A default arg should be enough I think
So, looks like the env var from Travis is colliding with the one that nox uses. Tox removes some env variables and keeps others. Personally, I don't like that much. But here we will have problems in local dev too. Maybe we can make a simple fix on the conflicting test and move on I guess. |
Yeah that sounds reasonable. I also don't like tox's env var processing
behavior.
…On Tue, Aug 28, 2018, 10:47 PM Santos Gallegos ***@***.***> wrote:
So, looks like the env var from Travis is colliding with the one the nox
uses. Tox removes some env variables and keeps others. Personally, I don't
like that much. But here we will have problems in local dev too. Maybe we
can make a simple fix on the conflicting test and move on I guess.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#121 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPUc4QNcWMi_lLOr5aBszsYc1MM-JPcks5uVir3gaJpZM4WMrhf>
.
|
tests/test_main.py
Outdated
@@ -60,6 +61,8 @@ def test_global_config_constructor(): | |||
|
|||
|
|||
def test_main_no_args(): | |||
# Prevents any interference from outside | |||
os.environ.pop("NOXSESSION", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you are ok with this workaround
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind updating this to use monkeypatch.delenv
? https://docs.pytest.org/en/latest/reference.html#_pytest.monkeypatch.MonkeyPatch.delenv and likewise with setenv
for the test below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that looks like what we need here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for taking so long to review this, I just have a minor comment on the tests. :)
tests/test_main.py
Outdated
@@ -60,6 +61,8 @@ def test_global_config_constructor(): | |||
|
|||
|
|||
def test_main_no_args(): | |||
# Prevents any interference from outside | |||
os.environ.pop("NOXSESSION", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind updating this to use monkeypatch.delenv
? https://docs.pytest.org/en/latest/reference.html#_pytest.monkeypatch.MonkeyPatch.delenv and likewise with setenv
for the test below?
@stsewd I make the changes myself, I hope that's okay! |
That's ok, sorry I wasn't able to do it myself, busy week. |
Totally understand. :) I'm always happy to get these things over the finish line. |
Ref to #40 (comment)
Similar usage in tox https://tox.readthedocs.io/en/latest/config.html#confval-envlist=CSV