Changed hardcoded error values to standard errno system symbols in DaphneTestingInstance

This commit is contained in:
Jonas Lidén 2018-02-06 08:29:40 +01:00
parent 2b3d6af8d6
commit 89e2770fde

View File

@ -6,6 +6,7 @@ import time
import unittest
from http.client import HTTPConnection
from urllib import parse
import errno
from daphne.test_application import TestApplication
@ -31,7 +32,7 @@ class DaphneTestingInstance:
try:
s.bind(("127.0.0.1", port))
except socket.error as e:
if e.errno in [13, 98]:
if e.errno in [errno.EACCES, errno.EADDRINUSE]:
return True
else:
raise