From 5f19e283dcfae5435f6bef1130f30351224d55dd Mon Sep 17 00:00:00 2001 From: mj-will Date: Mon, 11 Dec 2023 17:36:14 +0000 Subject: [PATCH] test: fix timing issue with windows --- .../test_flowproposal_population.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/test_proposal/test_flowproposal/test_flowproposal_population.py b/tests/test_proposal/test_flowproposal/test_flowproposal_population.py index acf91225..b952802c 100644 --- a/tests/test_proposal/test_flowproposal/test_flowproposal_population.py +++ b/tests/test_proposal/test_flowproposal/test_flowproposal_population.py @@ -348,7 +348,7 @@ def test_draw_latent_prior(proposal): [(0.5, None), (None, 1.5), (None, None)], ) def test_populate( - proposal, check_acceptance, indices, r, min_radius, max_radius + proposal, check_acceptance, indices, r, min_radius, max_radius, wait ): """Test the main populate method""" n_dims = 2 @@ -383,6 +383,7 @@ def test_populate( rand_u = 0.5 * np.ones(3 * drawsize) log_l = np.random.rand(poolsize) + log_p = np.random.rand(poolsize) r_flow = 1.0 @@ -428,10 +429,14 @@ def test_populate( return_value=log_l ) + def convert_to_samples(samples, plot): + samples["logP"] = log_p + # wait for windows + wait() + return samples + proposal.plot_pool = MagicMock() - proposal.convert_to_samples = MagicMock( - side_effect=lambda *args, **kwargs: args[0] - ) + proposal.convert_to_samples = MagicMock(side_effect=convert_to_samples) x_empty = np.empty(0, dtype=proposal.population_dtype) with patch(