Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Problems to run nox doctest session behind proxy #149

Closed
sivogel opened this issue Jul 25, 2024 · 7 comments
Closed

Problems to run nox doctest session behind proxy #149

sivogel opened this issue Jul 25, 2024 · 7 comments

Comments

@sivogel
Copy link
Member

sivogel commented Jul 25, 2024

I have problems running the nox doctest session behind a proxy. The command "session.run("pip", "install", "numpy<2")" needs the proxy to be set. If I remove "with _clean_environment(session):"

@tyralla
Copy link
Member

tyralla commented Jul 29, 2024

Could you please complete your error report?

However, I guess that we simply need to change this code:

    with _clean_environment(session):
        if numpy == "1":
            session.run("pip", "install", "numpy<2")
        elif numpy == "2":
            session.run("pip", "install", "numpy>1,<3")
        else:
            assert_never(numpy)
        session.run("python", "hydpy/tests/run_doctests.py", *session.posargs)

to that one:

    if numpy == "1":
        session.run("pip", "install", "numpy<2")
    elif numpy == "2":
        session.run("pip", "install", "numpy>1,<3")
    else:
        assert_never(numpy)
    with _clean_environment(session):
        session.run("python", "hydpy/tests/run_doctests.py", *session.posargs)

Could you please verify and, if it works, open a pull request?

@sivogel
Copy link
Member Author

sivogel commented Jul 29, 2024

Oh pardon. Somehow the second part got lost:
The following part did not work due to a SSL connection error (no proxy set for pip install)

with _clean_environment(session):
        if numpy == "1":
            session.run("pip", "install", "numpy<2")
        elif numpy == "2":
            session.run("pip", "install", "numpy>1,<3")

Removing the with _clean_environment(session): (from the whole statement) helped to run the session. Could you please explain why do you need the _clean_environment for the run_doctest session?

@tyralla
Copy link
Member

tyralla commented Jul 29, 2024

I added the _clean_environment context manager to get the HydPy-Server doctests running, which were hanging in some cases when the environment variable HTTP_PROXY or HTTPS_PROXY was set. However, I don't know if it is still required after the change introduced in commit 7bb80bf.

@sivogel
Copy link
Member Author

sivogel commented Jul 29, 2024

In my case (behind a proxy) it is not needed (I run it without last week). But I think it also was no problem before, because localhost is added to my NO_PROXY environment variable. I think we can completely remove it.

@tyralla
Copy link
Member

tyralla commented Jul 29, 2024

But removing _clean_environment would mean some nox sessions would not run if HTTP_PROXY is set without NO_PROXY being defined as you explained. We would have to explain this somewhere in the documentation. Hence, I see no advantage in removing _clean_environment compared to fixing the problem as suggested.

@sivogel
Copy link
Member Author

sivogel commented Jul 30, 2024

I think setting up a proxy that ignores all local addresses is pretty standard. I would like to discuss this with Holger. He is more familiar this topic.

tyralla added a commit that referenced this issue Dec 6, 2024
…nment` context manager after updating all dependencies.

Fixes #149
@tyralla
Copy link
Member

tyralla commented Dec 6, 2024

Fixed by commit 3283533.

I think keeping _clean_environment is the safer solution. If we remove it and some would run the test with a non-standard proxy configuration, he would likely have a bad time finding out what is wrong.

@tyralla tyralla closed this as completed Dec 6, 2024
tyralla added a commit that referenced this issue Jan 14, 2025
…nment` context manager after updating all dependencies.

Fixes #149

(cherry picked from commit 3283533)
tyralla added a commit that referenced this issue Jan 15, 2025
…nment` context manager after updating all dependencies.

Fixes #149

(cherry picked from commit 3283533)
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants