question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tox -e lint doesn't work from behind a proxy

See original GitHub issue

Environment

  • pip version: 19.3.1
  • Python version: 3.8.0
  • OS: Windows 10

Running tox 3.14.4, pre-commit 1.21.0

Description I’m running behind a proxy with environment variables http{s}_proxy set. When I run tox -e lint a git call in pre-commit fails with a network error. Investigation shows that the git command is run in an environment without my proxy variables.

This is almost certainly an issue with tox or pre-commit, and not directly with pip. But I don’t have time right now to debug, and I wanted to record the problem somewhere. My main development machine doesn’t need a proxy, so this is not critical for me, but I’ll look into it more when I get the chance.

Expected behavior Proxy settings are passed to git.

How to Reproduce See above

Output

>.\.venv\Scripts\tox.exe -e lint
lint create: C:\Work\Projects\pip\.tox\lint
lint installdeps: pre-commit
lint installed: aspy.yaml==1.3.0,cfgv==2.0.1,identify==1.4.9,nodeenv==1.3.4,pip==19.3.1,pre-commit==1.21.0,PyYAML==5.3,setuptools==42.0.2,six==1.13.0,toml==0.10.0,virtualenv==16.7.9,wheel==0.33.6
lint run-test-pre: PYTHONHASHSEED='191'
lint run-test: commands[0] | pre-commit run --all-files --show-diff-on-failure
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: command: ('C:\\Program Files\\Git\\cmd\\git.exe', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Failed to connect to github.com port 443: Timed out

Check the log at C:\Users\UK03306/.cache\pre-commit\pre-commit.log
ERROR: InvocationError for command 'C:\Work\Projects\pip\.tox\lint\Scripts\pre-commit.EXE' run --all-files --show-diff-on-failure (exited with code 1)
_______________________________________________________________________ summary _______________________________________________________________________ ERROR:   lint: commands failed

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, Jan 15, 2020

Yeah, my feeling is that this reflects the difference in design focus of the 2 tools. Both are technically for running tests, but nox feels more general-purpose. Protecting tests from being messed up by environment settings seems like a good goal. Conversely, not having automations break because they rely on user-specific config via environment settings also seems like a good idea.

Maybe we should have HTTP{S}_PROXY in our PASSENV, though. I can’t imagine any situation where a user would say “network access needs to go through this proxy” and tox should say “nope, I don’t believe you” 😉 So technically tox should pass these by default, but let’s fix our config for now.

I’ll create a PR for that.

1reaction
pradyunsgcommented, Jan 14, 2020

What about nox -s lint? 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration - tox
A list of environments to run by default (when the user does not specify anything during the invocation).
Read more >
Setup Proxy For Tox In Tox.Ini - ADocLib
Setup Proxy For Tox In Tox.Ini ... This ensures tox works correctly when having parallel runs as each session will have In a...
Read more >
Bug #1465086 “tox doesn't work under proxy” - Launchpad Bugs
When a development environment is under a proxy, tox fails like this: (even if environment variables of the proxy are set.) $ tox...
Read more >
Sync charm/ceph helpers, tox, and requirements · 63c0ebbcd7 ...
charm-ceph-proxy - Juju Charm - Ceph Proxy. ... in the files/* dir which was previously not covered by lint testing. ... except CalledProcessError...
Read more >
pipenv Documentation - Read the Docs
Command line flags (e.g. --python and --three) are prioritized over this configuration. PIPENV_DONT_LOAD_ENV. If set, Pipenv does not load the .env file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found