Skip to content

Commit 6c45f79

Browse files
committed
mock for doctest
1 parent 5dcb7c9 commit 6c45f79

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

causalpy/tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import numpy as np
2222
import pytest
23-
from pymc.testing import mock_sample_setup_and_teardown
23+
from pymc.testing import mock_sample, mock_sample_setup_and_teardown
2424

2525

2626
@pytest.fixture(scope="session")
@@ -31,3 +31,13 @@ def rng() -> np.random.Generator:
3131

3232

3333
mock_pymc_sample = pytest.fixture(mock_sample_setup_and_teardown, scope="session")
34+
35+
36+
@pytest.fixture(autouse=True)
37+
def mock_sample_for_doctest(request):
38+
if not request.config.getoption("--doctest-modules", default=False):
39+
return
40+
41+
import pymc as pm
42+
43+
pm.sample = mock_sample

0 commit comments

Comments
 (0)