From 8b36471874662ccdae770bd143c997a0e5eadad9 Mon Sep 17 00:00:00 2001 From: Adrian Seyboldt Date: Tue, 7 Jul 2020 12:56:37 +0200 Subject: [PATCH] Add test for pickle with dill --- pymc3/tests/test_parallel_sampling.py | 10 +++++++++- requirements-dev.txt | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pymc3/tests/test_parallel_sampling.py b/pymc3/tests/test_parallel_sampling.py index fe124864ca9..3b8a52a2846 100644 --- a/pymc3/tests/test_parallel_sampling.py +++ b/pymc3/tests/test_parallel_sampling.py @@ -14,7 +14,7 @@ import multiprocessing import os -import pytest +i/mport pytest import pymc3.parallel_sampling as ps import pymc3 as pm import theano @@ -51,6 +51,8 @@ def test_bad_unpickle(): tt_vector = tt.TensorType(theano.config.floatX, [False]) + + @theano.as_op([tt_vector, tt.iscalar], [tt_vector]) def _crash_remote_process(a, master_pid): if os.getpid() != master_pid: @@ -58,6 +60,12 @@ def _crash_remote_process(a, master_pid): return 2 * np.array(a) +def test_dill(): + with pm.Model(): + pm.Normal('x') + pm.sample(tune=1, draws=1, chains=2, cores=2, pickle_backend="dill", mp_ctx="spawn") + + def test_remote_pipe_closed(): master_pid = os.getpid() with pm.Model(): diff --git a/requirements-dev.txt b/requirements-dev.txt index 7544a31085a..4c3d2a2859c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -18,3 +18,4 @@ seaborn>=0.8.1 sphinx-autobuild==0.7.1 sphinx>=1.5.5 watermark +dill