mirror of
https://github.com/django/daphne.git
synced 2025-07-15 02:12:17 +03:00
Changed hardcoded error values to standard errno system symbols in DaphneTestingInstance
This commit is contained in:
parent
2b3d6af8d6
commit
89e2770fde
|
@ -6,6 +6,7 @@ import time
|
||||||
import unittest
|
import unittest
|
||||||
from http.client import HTTPConnection
|
from http.client import HTTPConnection
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
|
import errno
|
||||||
|
|
||||||
from daphne.test_application import TestApplication
|
from daphne.test_application import TestApplication
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ class DaphneTestingInstance:
|
||||||
try:
|
try:
|
||||||
s.bind(("127.0.0.1", port))
|
s.bind(("127.0.0.1", port))
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e.errno in [13, 98]:
|
if e.errno in [errno.EACCES, errno.EADDRINUSE]:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in New Issue
Block a user