Skip to content

Commit

Permalink
Fix MDAnalysis#2606: moving local function to the top (MDAnalysis#2615)
Browse files Browse the repository at this point in the history
* Fixes MDAnalysis#2606
   Pytest and/or multiprocessing fails to pickle local functions. Found a workaround here:
   https://bugs.python.org/issue33884 (Basically, moving the local function to the top level.)
* the function which is being evaluated in parallel is global now
* make parallel test xfail for windows (because even this workaround does not help under windows)
  • Loading branch information
abhiShandy authored Mar 19, 2020
1 parent e0883c8 commit 89646b4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions testsuite/MDAnalysisTests/analysis/test_encore.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
import MDAnalysis.analysis.encore.confdistmatrix as confdistmatrix


def function(x):
return x**2

class TestEncore(object):
@pytest.fixture(scope='class')
def ens1_template(self):
Expand Down Expand Up @@ -117,13 +120,9 @@ def test_triangular_matrix(self):
inconsistent results")

@pytest.mark.xfail(os.name == 'nt',
strict=True,
reason="Not yet supported on Windows.")
def test_parallel_calculation(self):

def function(x):
return x**2

arguments = [tuple([i]) for i in np.arange(0,100)]

parallel_calculation = encore.utils.ParallelCalculation(function=function,
Expand Down

0 comments on commit 89646b4

Please sign in to comment.