diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 00de485a..0a1da86b 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -58,4 +58,5 @@ jobs: with: run: | export NAVIS_HEADLESS=TRUE + export NAVIS_TEST_ENV=TRUE pytest --verbose diff --git a/navis/config.py b/navis/config.py index 9aec3b17..c675630d 100644 --- a/navis/config.py +++ b/navis/config.py @@ -59,6 +59,12 @@ def get_logger(name: str): return logging.getLogger(name) return logger +# Set up numpy number representation, see NEP51 +# Once numpy<=2 is dropped from requirements, the doctest comparissons +# should become `np.float64(1.074)` instead of `1.074` +if os.environ.get('NAVIS_TEST_ENV', '').lower() == 'true': + import numpy as np + np.set_printoptions(legacy="1.25") # Default settings for progress bars pbar_hide = False diff --git a/navis/morpho/mmetrics.py b/navis/morpho/mmetrics.py index dcd8c415..4e3ae951 100644 --- a/navis/morpho/mmetrics.py +++ b/navis/morpho/mmetrics.py @@ -30,6 +30,7 @@ # Set up logging logger = config.get_logger(__name__) + __all__ = sorted( [ "strahler_index", diff --git a/navis/plotting/plot_utils.py b/navis/plotting/plot_utils.py index de3fb31b..802bd382 100644 --- a/navis/plotting/plot_utils.py +++ b/navis/plotting/plot_utils.py @@ -190,7 +190,7 @@ def make_tube(segments, radii=1.0, tube_points=8, use_normals=True): faces : np.ndarray """ - vertices = np.empty((0, 3), dtype=np.float_) + vertices = np.empty((0, 3), dtype=np.float64) indices = np.empty((0, 3), dtype=np.uint32) if not isinstance(radii, Iterable): @@ -219,7 +219,7 @@ def make_tube(segments, radii=1.0, tube_points=8, use_normals=True): # Vertices for each point on the circle verts = np.repeat(points, tube_points, axis=0) - v = np.arange(tube_points, dtype=np.float_) / tube_points * 2 * np.pi + v = np.arange(tube_points, dtype=np.float64) / tube_points * 2 * np.pi all_cx = ( radius diff --git a/pytest.ini b/pytest.ini index 6754b78f..f7278cac 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,3 +3,4 @@ doctest_optionflags = IGNORE_EXCEPTION_DETAIL NUMBER NORMALIZE_WHITESPACE addopts = --doctest-modules env = NAVIS_HEADLESS=TRUE + NAVIS_TEST_ENV=TRUE