-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c616ac
commit 56bc373
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from unittest import TestCase | ||
from pympipool import PyMPIExecutor | ||
|
||
|
||
def add_two(x): | ||
return x + 2 | ||
|
||
|
||
class TestPyMPIExecutor(TestCase): | ||
|
||
def test_local(self): | ||
# Works perfectly | ||
def add_one(x): | ||
return x + 1 | ||
|
||
class Foo: | ||
def add(self, x): | ||
return add_one(x) | ||
|
||
foo = Foo() | ||
executor = PyMPIExecutor() | ||
fs = executor.submit(foo.add, 1) | ||
self.assertEqual(2, fs.result()) | ||
|
||
def test_semi_local(self): | ||
# Hangs | ||
# CI logs make it look like cloudpickle is trying to import from this module, | ||
# but can't find it | ||
class Foo: | ||
def add(self, x): | ||
return add_two(x) | ||
|
||
foo = Foo() | ||
executor = PyMPIExecutor() | ||
fs = executor.submit(foo.add, 1) | ||
self.assertEqual(3, fs.result()) |