diff --git a/conftest.py b/conftest.py new file mode 100644 index 00000000..19cb2998 --- /dev/null +++ b/conftest.py @@ -0,0 +1,31 @@ + +# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +# +# PMDA +# Copyright (c) 2017 The MDAnalysis Development Team and contributors +# (see the file AUTHORS for the full list of names) +# +# Released under the GNU Public Licence, v2 or any higher version + +from dask import distributed, multiprocessing +import pytest + +@pytest.fixture(scope="session", params=(1, 2)) +def client(tmpdir_factory, request): + with tmpdir_factory.mktemp("dask_cluster").as_cwd(): + lc = distributed.LocalCluster(n_workers=request.param, processes=True) + client = distributed.Client(lc) + + yield client + + client.close() + lc.close() + + +@pytest.fixture(scope='session', params=('distributed', 'multiprocessing')) +def scheduler(request, client): + if request.param == 'distributed': + return client + else: + return multiprocessing diff --git a/pmda/test/test_custom.py b/pmda/test/test_custom.py index c8e7cbbe..23c0a3ea 100644 --- a/pmda/test/test_custom.py +++ b/pmda/test/test_custom.py @@ -17,7 +17,6 @@ from numpy.testing import assert_equal from pmda import custom -from pmda.testing import scheduler def custom_function(mobile): return mobile.center_of_geometry() diff --git a/pmda/test/test_parallel.py b/pmda/test/test_parallel.py index 37cf0fcd..1fcb6cc0 100644 --- a/pmda/test/test_parallel.py +++ b/pmda/test/test_parallel.py @@ -17,7 +17,6 @@ from dask import distributed, multiprocessing from pmda import parallel -from pmda.testing import scheduler def test_timeing():