9
9
import pytest
10
10
11
11
from numpy .testing import assert_allclose
12
+ from pymc .testing import mock_sample_setup_and_teardown
12
13
from pytensor .compile import SharedVariable
13
14
from pytensor .graph .basic import graph_inputs
14
15
32
33
floatX = pytensor .config .floatX
33
34
nile = load_nile_test_data ()
34
35
ALL_SAMPLE_OUTPUTS = MATRIX_NAMES + FILTER_OUTPUT_NAMES + SMOOTHER_OUTPUT_NAMES
36
+ mock_pymc_sample = pytest .fixture (scope = "session" )(mock_sample_setup_and_teardown )
35
37
36
38
37
39
def make_statespace_mod (k_endog , k_states , k_posdef , filter_type , verbose = False , data_info = None ):
@@ -214,7 +216,7 @@ def pymc_mod_no_exog_dt(ss_mod_no_exog_dt, rng):
214
216
215
217
216
218
@pytest .fixture (scope = "session" )
217
- def idata (pymc_mod , rng ):
219
+ def idata (pymc_mod , rng , mock_pymc_sample ):
218
220
with pymc_mod :
219
221
idata = pm .sample (draws = 10 , tune = 0 , chains = 1 , random_seed = rng )
220
222
idata_prior = pm .sample_prior_predictive (draws = 10 , random_seed = rng )
@@ -224,7 +226,7 @@ def idata(pymc_mod, rng):
224
226
225
227
226
228
@pytest .fixture (scope = "session" )
227
- def idata_exog (exog_pymc_mod , rng ):
229
+ def idata_exog (exog_pymc_mod , rng , mock_pymc_sample ):
228
230
with exog_pymc_mod :
229
231
idata = pm .sample (draws = 10 , tune = 0 , chains = 1 , random_seed = rng )
230
232
idata_prior = pm .sample_prior_predictive (draws = 10 , random_seed = rng )
@@ -233,7 +235,7 @@ def idata_exog(exog_pymc_mod, rng):
233
235
234
236
235
237
@pytest .fixture (scope = "session" )
236
- def idata_no_exog (pymc_mod_no_exog , rng ):
238
+ def idata_no_exog (pymc_mod_no_exog , rng , mock_pymc_sample ):
237
239
with pymc_mod_no_exog :
238
240
idata = pm .sample (draws = 10 , tune = 0 , chains = 1 , random_seed = rng )
239
241
idata_prior = pm .sample_prior_predictive (draws = 10 , random_seed = rng )
@@ -242,7 +244,7 @@ def idata_no_exog(pymc_mod_no_exog, rng):
242
244
243
245
244
246
@pytest .fixture (scope = "session" )
245
- def idata_no_exog_dt (pymc_mod_no_exog_dt , rng ):
247
+ def idata_no_exog_dt (pymc_mod_no_exog_dt , rng , mock_pymc_sample ):
246
248
with pymc_mod_no_exog_dt :
247
249
idata = pm .sample (draws = 10 , tune = 0 , chains = 1 , random_seed = rng )
248
250
idata_prior = pm .sample_prior_predictive (draws = 10 , random_seed = rng )
0 commit comments