Django Tests run faster with no internet connection

邮差的信 提交于 2019-12-07 23:07:02

问题


I have a django test suite that builds a DB from a 400 line fixture file. It runs unfortunately slow. Several seconds per test.

I was on the train yesterday developing without internet access, with my wifi turned off, and I noticed my tests ran literally 10x faster without internet. And they are definitely running correctly.

Everything is local, it all runs fine without an internet connection. The tests themselves do not hit any APIs or make any other connections, so it seems it must be something else.


回答1:


This most likely means you've got some component installed which is trying to make network connections. Possibly something that does monitoring or statistics gathering?

The simplest way to figure out what's going on is to use tcpdump to capture your network traffic and see what's going on. To do that:

  1. Run tcpdump -i any (or tcpdump -i en1 if you're on a mac; the airport is usually en1, but you can double check with ifconfig)
  2. Watch the traffic to get some idea what's normal
  3. Run your test suite
  4. Watch the traffic printed by tcpdump to see if anything obviously jumps out at you


来源:https://stackoverflow.com/questions/28864152/django-tests-run-faster-with-no-internet-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!