TestTCPClient.test_spoof_address and TestTCPClient.test_spoof_address errors found while tox testing
See original GitHub issueI tested with tox on my machine running Ubuntu 16.04 having both python 3.5 and 3.6 and got two commands failed errors TestTCPClient.test_spoof_address and TestTCPClient.test_spoof_address.
Steps to reproduce the problem: I am using Ubuntu 16.04. I had both py35 and py36 installed.
- I clone the repo: git clone https://github.com/mitmproxy/mitmproxy
- cd mitmproxy
- Run the dev.sh from terminal
sudo ./dev.sh - . venv/bin/activate
- tox (Also tried tox -e py35/6)
Expected behavior: py35: commands succeeded py36: commands succeeded
Error found: =================================== FAILURES =================================== ___________________________ TestProxyServer.test_err ___________________________
self = <test.mitmproxy.test_proxy.TestProxyServer object at 0x7fb3be65bac8>
@skip_windows
def test_err(self):
# binding to 0.0.0.0:1 works without special permissions on Windows
conf = ProxyConfig(options.Options(listen_port=1))
with pytest.raises(Exception, match="Error starting proxy server"):
> ProxyServer(conf)
E Failed: DID NOT RAISE <class ‘Exception’> matching ‘Error starting proxy server’
test/mitmproxy/test_proxy.py:65: Failed _______________________ TestTCPClient.test_spoof_address _______________________
self = <test.mitmproxy.net.test_tcp.TestTCPClient object at 0x7fb3bd7cfba8>
def test_spoof_address(self):
c = tcp.TCPClient(("127.0.0.1", self.port), spoof_source_address=("127.0.0.1", 0))
with pytest.raises(exceptions.TcpException, match="Failed to spoof"):
> c.connect()
E Failed: DID NOT RAISE <class ‘mitmproxy.exceptions.TcpException’> matching ‘Failed to spoof’
test/mitmproxy/net/test_tcp.py:628: Failed ============== 2 failed, 1328 passed, 1 skipped in 90.52 seconds =============== ERROR: InvocationError: ‘/home/bksahu/Documents/Github/mitmproxy/.tox/py35/bin/pytest --timeout 60 --cov-report= --cov=mitmproxy --cov=pathod --full-cov=mitmproxy/ --full-cov=pathod/’
Any other comments? What have you tried so far? Tried tox -e py35/6 and got the same error for both. I looked up the documentation of both mitmproxy and tox but I couldn’t find anything relevant.
System information Mitmproxy: 3.0.0dev1082 (ddb8f43) Python: 3.5.2 OpenSSL: OpenSSL 1.1.0g 2 Nov 2017 Platform: Linux-4.10.0-28-generic-x86_64-with-Ubuntu-16.04-xenial
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Ok, so the culprit is that you are running this as root, that makes binding to privileged ports succeed (which would normally fail). Similar to skip_windows, we probably need a “skip_root” decorator to skip those tests when running as root.
If you run mitmproxy as a regular user, you should be fine. 😃
On Sat, 30 Dec 2017, 10:44 Batakrishna Sahu, notifications@github.com wrote:
Yes that
mitmproxy -p 85
works fine. Yes I am running this as root.