Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Goblin OGM
AIO Gremlin
Commits
e18200f8
Commit
e18200f8
authored
May 17, 2015
by
davebshow
Browse files
fixed bug with context manager close
parent
329fbaf5
Changes
3
Hide whitespace changes
Inline
Side-by-side
aiogremlin/connection.py
View file @
e18200f8
...
...
@@ -134,8 +134,8 @@ class GremlinClientWebSocketResponse(BaseConnection, ClientWebSocketResponse):
@
asyncio
.
coroutine
def
close
(
self
,
*
,
code
=
1000
,
message
=
b
''
):
if
not
self
.
_closed
:
close
d
=
self
.
_close
()
if
close
d
:
do_
close
=
self
.
_close
()
if
do_
close
:
return
True
while
True
:
try
:
...
...
@@ -158,7 +158,7 @@ class GremlinClientWebSocketResponse(BaseConnection, ClientWebSocketResponse):
else
:
return
False
def
_close
(
self
):
def
_close
(
self
,
code
=
1000
,
message
=
b
''
):
self
.
_closed
=
True
try
:
self
.
_writer
.
close
(
code
,
message
)
...
...
aiogremlin/contextmanager.py
View file @
e18200f8
...
...
@@ -11,6 +11,7 @@ class ConnectionContextManager:
def
__exit__
(
self
,
exception_type
,
exception_value
,
traceback
):
try
:
self
.
_conn
.
_closing
=
True
self
.
_conn
.
_close
()
finally
:
self
.
_conn
=
None
...
...
tests/tests.py
View file @
e18200f8
...
...
@@ -229,7 +229,7 @@ class ContextMngrTest(unittest.TestCase):
factory
=
AiohttpFactory
,
max_retries
=
0
)
def
tearDown
(
self
):
#
self.loop.run_until_complete(self.pool.close())
self
.
loop
.
run_until_complete
(
self
.
pool
.
close
())
self
.
loop
.
close
()
def
test_connection_manager
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment