Skip to content

Commit 439fc58

Browse files
ricardoV94twiecki
authored andcommitted
Skip test_init_jitter
The test relied on monkey patching the jitter so that the model initial logp would fail predictably. This does not seem to be possible with the new numpy random generators, so a different test strategy has to be developed
1 parent a91c41e commit 439fc58

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pymc/tests/test_sampling.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ def test_exec_nuts_init(method):
886886
check_exec_nuts_init(method)
887887

888888

889+
@pytest.mark.skip(reason="Test requires monkey patching of RandomGenerator")
889890
@pytest.mark.parametrize(
890891
"initval, jitter_max_retries, expectation",
891892
[
@@ -903,9 +904,13 @@ def test_init_jitter(initval, jitter_max_retries, expectation):
903904
with expectation:
904905
# Starting value is negative (invalid) when np.random.rand returns 0 (jitter = -1)
905906
# and positive (valid) when it returns 1 (jitter = 1)
906-
with mock.patch("numpy.random.rand", side_effect=[0, 0, 0, 1, 0]):
907+
with mock.patch("numpy.random.Generator.uniform", side_effect=[-1, -1, -1, 1, -1]):
907908
start = pm.sampling._init_jitter(
908-
m, m.initial_point, chains=1, jitter_max_retries=jitter_max_retries
909+
model=m,
910+
initvals=None,
911+
seeds=[1],
912+
jitter=True,
913+
jitter_max_retries=jitter_max_retries,
909914
)
910915
m.check_start_vals(start)
911916

0 commit comments

Comments
 (0)