File: conftest.py

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (16 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (4)
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