Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
9b13a4cc
Commit
9b13a4cc
authored
Sep 30, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 2 call_function_test failures.
parent
79dd00db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
16 deletions
+10
-16
mitogen/core.py
mitogen/core.py
+2
-1
mitogen/master.py
mitogen/master.py
+3
-1
tests/call_function_test.py
tests/call_function_test.py
+5
-14
No files found.
mitogen/core.py
View file @
9b13a4cc
...
...
@@ -284,6 +284,7 @@ def _queue_interruptible_get(queue, timeout=None, block=True):
class
Receiver
(
object
):
notify
=
None
raise_channelerror
=
True
def
__init__
(
self
,
router
,
handle
=
None
,
persist
=
True
,
respondent
=
None
):
self
.
router
=
router
...
...
@@ -319,7 +320,7 @@ class Receiver(object):
# Must occur off the broker thread.
data
=
msg
.
unpickle
()
if
data
==
_DEAD
:
if
data
==
_DEAD
and
self
.
raise_channelerror
:
raise
ChannelError
(
'Channel closed by remote end.'
)
if
isinstance
(
data
,
CallError
):
...
...
mitogen/master.py
View file @
9b13a4cc
...
...
@@ -807,12 +807,14 @@ class Context(mitogen.core.Context):
else
:
klass
=
None
re
turn
self
.
send_async
(
re
cv
=
self
.
send_async
(
mitogen
.
core
.
Message
.
pickled
(
(
fn
.
__module__
,
klass
,
fn
.
__name__
,
args
,
kwargs
),
handle
=
mitogen
.
core
.
CALL_FUNCTION
,
)
)
recv
.
raise_channelerror
=
False
return
recv
def
call
(
self
,
fn
,
*
args
,
**
kwargs
):
return
self
.
call_async
(
fn
,
*
args
,
**
kwargs
).
get_data
()
...
...
tests/call_function_test.py
View file @
9b13a4cc
...
...
@@ -28,19 +28,10 @@ def func_accepts_returns_context(context):
return
context
class
CallFunctionTest
(
unittest
.
TestCase
):
@
classmethod
def
setUpClass
(
cls
):
super
(
CallFunctionTest
,
cls
).
setUpClass
()
cls
.
broker
=
mitogen
.
master
.
Broker
()
cls
.
router
=
mitogen
.
master
.
Router
(
cls
.
broker
)
cls
.
local
=
cls
.
router
.
local
()
@
classmethod
def
tearDownClass
(
cls
):
super
(
CallFunctionTest
,
cls
).
tearDownClass
()
cls
.
broker
.
shutdown
()
cls
.
broker
.
join
()
class
CallFunctionTest
(
testlib
.
RouterMixin
,
unittest
.
TestCase
):
def
setUp
(
self
):
super
(
CallFunctionTest
,
self
).
setUp
()
self
.
local
=
self
.
router
.
local
()
def
test_succeeds
(
self
):
assert
3
==
self
.
local
.
call
(
function_that_adds_numbers
,
1
,
2
)
...
...
@@ -69,7 +60,7 @@ class CallFunctionTest(unittest.TestCase):
except
mitogen
.
core
.
StreamError
,
e
:
pass
assert
e
[
0
]
==
"cannot unpickle 'call_function_test'/'CrazyType'"
self
.
assertEquals
(
e
[
0
],
"cannot unpickle '__main__'/'CrazyType'"
)
def
test_returns_dead
(
self
):
assert
mitogen
.
core
.
_DEAD
==
self
.
local
.
call
(
func_returns_dead
)
...
...
Write
Preview
Markdown
is supported
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