Search code examples
pythondjangomacos-sierra

Django tests slows after MacOS Sierra


I'm working on a Django project using Python 3 and Django 1.10 on Mac.

Before update I was running 40 tests in 0.441s.

Now after MacOS Sierra: Ran 40 tests in 5.487s

I did some investigations and found this line to be the problem:

response = self.client.post(r('subscriptions:new'), data)

If I pass a empty dict instead of data, the tests run faster. Anyone have a clue why this is happening?


Solution

  • I found that to resolve local DNS was taking forever to resolve.

    If anyone has the same problem run this commands:

    sudo scutil --get LocalHostName
    sudo scutil --get HostName
    

    If the result is not the same, use this commands to put them equal:

    sudo scutil --set LocalHostName My-MacBook
    sudo scutil --set HostName My-MacBook
    

    Where My-Macbook is your local machine hostname. Problem solved to me.