-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
39 lines (27 loc) · 1.13 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Configure Test Suite.
This file is used to configure the behavior of pytest when using the Astropy
test infrastructure. It needs to live inside the package in order for it to
get picked up when running the tests inside an interpreter using
packagename.test
"""
from __future__ import annotations
import pathlib
from importlib.metadata import version
from typing import Any
import pytest
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
def pytest_configure(config: pytest.Config) -> None:
"""Configure Pytest with Astropy."""
config.option.astropy_header = True
# Customize the following lines to add/remove entries from the list of
# packages for which version numbers are displayed when running the
# tests.
PYTEST_HEADER_MODULES.pop("Pandas", None)
packagename = pathlib.Path(__file__).parent.name
TESTED_VERSIONS[packagename] = version("overload_numpy")
@pytest.fixture(autouse=True) # type: ignore[misc]
def add_numpy(doctest_namespace: dict[str, Any]) -> None:
"""Add NumPy to Pytest."""
import numpy as np
# add to namespace
doctest_namespace["np"] = np