Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a new doctest_namespace fixture #1428
This resolves #1047 by introducing a new fixture
# content of conftest.py import numpy @pytest.fixture(autouse=True) def add_np(doctest_namespace): doctest_namespace['np'] = numpy
which can then be used in your doctests directly::
# content of numpy.py def arange(): """ >>> a = np.arange(10) >>> len(a) 10 """ pass
This is my first contribution to pytest so I welcome any feedback on style etc.