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.

TestTCPClient.test_spoof_address and TestTCPClient.test_spoof_address errors found while tox testing

See original GitHub issue

I 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.

  1. I clone the repo: git clone https://github.com/mitmproxy/mitmproxy
  2. cd mitmproxy
  3. Run the dev.sh from terminal
    sudo ./dev.sh
  4. . venv/bin/activate
  5. 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:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mhilscommented, Dec 30, 2017

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.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/mitmproxy/mitmproxy/issues/2730#issuecomment-354536883, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-NPr1q7er57Gz-aoRxQd3UuTeJNIacks5tFgXmgaJpZM4ROXlA .

0reactions
bksahucommented, Dec 30, 2017

Yes that mitmproxy -p 85 works fine. Yes I am running this as root.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests fail with tox because module under test can't be found
Right, I finally discovered the problem. The test module seems to be shadowing the name of the module under test. If I change...
Read more >
Can't find tox config file when running make test-unit #2739
I'm trying to get my local developer setup by following the commands in https://github.com/fishtown-analytics/dbt/blob/dev/marian-anderson/ ...
Read more >
tox
tox is a generic virtual environment management and test command line tool you can use for: checking your package builds and installs correctly...
Read more >
Buyer Beware: Pitfalls in Toxicology Laboratory Testing - NCBI
Although convenient, immunoassays are prone to false positive and false negative results. It is important for the health care provider to understand the ......
Read more >
Getting Started With Testing in Python
In this in-depth tutorial, you'll see how to create Python unit tests, execute them, and find the bugs before your users do. You'll...
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