File tree 3 files changed +29
-6
lines changed 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 1
1
test :
2
- pytest
2
+ python -m pytest
3
3
coverage :
4
4
python -m coverage run -p --source=. setup.py test
5
5
cov-html :
Original file line number Diff line number Diff line change 38
38
39
39
# Test runner
40
40
# 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
46
46
47
47
48
48
def read (* parts ):
Original file line number Diff line number Diff line change @@ -134,6 +134,12 @@ def close(self):
134
134
self ._socket = None
135
135
136
136
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 ):
137
143
'''
138
144
Create connection to the host and port specified in __init__().
139
145
:raise: `NetworkError`
@@ -150,6 +156,23 @@ def connect_basic(self):
150
156
self .connected = False
151
157
raise NetworkError (e )
152
158
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
+
153
176
def handshake (self ):
154
177
greeting_buf = self ._recv (IPROTO_GREETING_SIZE )
155
178
greeting = greeting_decode (greeting_buf )
You can’t perform that action at this time.
0 commit comments