File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 11test :
2- pytest
2+ python -m pytest
33coverage :
44 python -m coverage run -p --source=. setup.py test
55cov-html :
Original file line number Diff line number Diff line change 3838
3939# Test runner
4040# python setup.py test
41- # try:
42- # from tests.setup_command import test
43- # cmdclass["test"] = test
44- # except ImportError:
45- # pass
41+ try :
42+ from tests .setup_command import test
43+ cmdclass ["test" ] = test
44+ except ImportError :
45+ pass
4646
4747
4848def read (* parts ):
Original file line number Diff line number Diff line change @@ -134,6 +134,12 @@ def close(self):
134134 self ._socket = None
135135
136136 def connect_basic (self ):
137+ if self .host == None :
138+ self .connect_unix ()
139+ else :
140+ self .connect_tcp ()
141+
142+ def connect_tcp (self ):
137143 '''
138144 Create connection to the host and port specified in __init__().
139145 :raise: `NetworkError`
@@ -150,6 +156,23 @@ def connect_basic(self):
150156 self .connected = False
151157 raise NetworkError (e )
152158
159+ def connect_unix (self ):
160+ '''
161+ Create connection to the host and port specified in __init__().
162+ :raise: `NetworkError`
163+ '''
164+
165+ try :
166+ # If old socket already exists - close it and re-create
167+ self .connected = True
168+ if self ._socket :
169+ self ._socket .close ()
170+ self ._socket = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
171+ self ._socket .connect (self .port )
172+ except socket .error as e :
173+ self .connected = False
174+ raise NetworkError (e )
175+
153176 def handshake (self ):
154177 greeting_buf = self ._recv (IPROTO_GREETING_SIZE )
155178 greeting = greeting_decode (greeting_buf )
You can’t perform that action at this time.
0 commit comments