Skip to content

Commit

Permalink
move doctest setup routines to a location actually checked by pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Böck committed Nov 12, 2018
1 parent 2ce69a6 commit e01ed43
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions madmom/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import numpy as np
import pytest

# set and restore numpy's print options for doctests
_NP_PRINT_OPTIONS = np.get_printoptions()


@pytest.fixture(autouse=True)
def setup_package(request):
"""Set up the environment for doctests (when run through pytest)."""
np.set_printoptions(precision=5, edgeitems=2, suppress=True)

def fin():
"""Restore the environment after doctests (when run through pytest)."""
np.set_printoptions(**_NP_PRINT_OPTIONS)

request.addfinalizer(fin)

0 comments on commit e01ed43

Please sign in to comment.