Dash testing - Server not closing

Dear all,

I have a strange issue running the standard examples of dash testing (Dash Testing | Dash for Python Documentation | Plotly) on my linux/docker machine while on my mac/docker the test run fine.

I get the following error after the actual test passes.

pytest test_dash_minimal_example.py

dash.testing.errors.ServerCloseError: Cannot stop server within 3s timeout

I tried changing to the process fixture (dash/plugin.py at 8a4873d1feb2a3720be66428835892a364a0a86b · plotly/dash · GitHub) but with no success. Also I tried raising the timeout to 10 seconds with no success.

Does anybody have an idea how to fix this?

I found the issue. The dash ThreadRunner uses the ip of the app to send the stop signal. On one of my machines I use a proxy to connect to the internet. The solution was to simply add localhost to the no_proxy environment variable.

Your recipe helped me.
I will outline the recipe in more detail here.
I added a fixture to the test file with the following content:

import os

def setup_module():
    os.environ['no_proxy'] = 'localhost'