| 1 |
# Do the equivalent of "from brian2 import *" for all doctests |
| 2 |
import pytest |
| 3 |
|
| 4 |
@pytest.fixture(autouse=True) |
| 5 |
def add_brian2(doctest_namespace): |
| 6 |
exec('from brian2 import *', doctest_namespace) |
| 7 |
import brian2 |
| 8 |
import numpy as np |
| 9 |
# Always use numpy for doctests |
| 10 |
brian2.prefs['codegen.target'] = 'numpy' |
| 11 |
# Print output changed in numpy 1.14, stick with the old format to |
| 12 |
# avoid doctest failures |
| 13 |
try: |
| 14 |
np.set_printoptions(legacy='1.13') |
| 15 |
except TypeError: |
| 16 |
pass # using a numpy version < 1.14 |