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