| 1 |
"""Configure Test Suite. |
| 2 |
|
| 3 |
This file is used to configure the behavior of pytest when using the Astropy |
| 4 |
test infrastructure. It needs to live inside the package in order for it to |
| 5 |
get picked up when running the tests inside an interpreter using |
| 6 |
`astropy_healpix.test()`. |
| 7 |
|
| 8 |
""" |
| 9 |
|
| 10 |
import os |
| 11 |
|
| 12 |
import numpy as np |
| 13 |
|
| 14 |
try: |
| 15 |
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS |
| 16 |
ASTROPY_HEADER = True |
| 17 |
except ImportError: |
| 18 |
ASTROPY_HEADER = False |
| 19 |
|
| 20 |
|
| 21 |
def pytest_configure(config): |
| 22 |
"""Configure Pytest with Astropy. |
| 23 |
|
| 24 |
Parameters |
| 25 |
---------- |
| 26 |
config : pytest configuration |
| 27 |
|
| 28 |
""" |
| 29 |
if ASTROPY_HEADER: |
| 30 |
|
| 31 |
config.option.astropy_header = True |
| 32 |
|
| 33 |
# Customize the following lines to add/remove entries from the list of |
| 34 |
# packages for which version numbers are displayed when running the tests. |
| 35 |
PYTEST_HEADER_MODULES.pop('h5py', None) |
| 36 |
PYTEST_HEADER_MODULES.pop('Pandas', None) |
| 37 |
PYTEST_HEADER_MODULES['Astropy'] = 'astropy' |
| 38 |
PYTEST_HEADER_MODULES['healpy'] = 'healpy' |
| 39 |
|
| 40 |
from . import __version__ |
| 41 |
packagename = os.path.basename(os.path.dirname(__file__)) |
| 42 |
TESTED_VERSIONS[packagename] = __version__ |
| 43 |
|
| 44 |
# Set the Numpy print style to a fixed version to make doctest outputs |
| 45 |
# reproducible. |
| 46 |
try: |
| 47 |
np.set_printoptions(legacy='1.13') |
| 48 |
except TypeError: |
| 49 |
# On older versions of Numpy, the unrecognized 'legacy' option will |
| 50 |
# raise a TypeError. |
| 51 |
pass |