Got error "gaierror: [Errno -2] Name or service not known" when run py.test

I know this late but I too had the same error today. Check the contents of your /etc/hosts file ‘localhost’ may not be written in front of ::1 . I had ip6-localhost
To fix this just add ‘localhost’ to the line starting with ::1

1 Like