Completed
Pull Request — master (#393)
by Ryan
01:39
created

doctest_available_modules()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
1
# Copyright (c) 2016 MetPy Developers.
2
# Distributed under the terms of the BSD 3-Clause License.
3
# SPDX-License-Identifier: BSD-3-Clause
4
"""Configure pytest for metpy."""
5
6
import matplotlib
7
import numpy
8
import pint
9
import pytest
10
import scipy
11
12
import metpy.calc
13
14
15
def pytest_report_header(config, startdir):
16
    """Add dependency information to pytest output."""
17
    return ('Dependencies: Matplotlib ({}), NumPy ({}), '
18
            'Pint ({}), SciPy ({})'.format(matplotlib.__version__, numpy.__version__,
19
                                           pint.__version__, scipy.__version__))
20
21
22
@pytest.fixture(autouse=True)
23
def doctest_available_modules(doctest_namespace):
24
    """Make modules available automatically to doctests."""
25
    doctest_namespace['metpy'] = metpy
26
    doctest_namespace['metpy.calc'] = metpy.calc
27
    doctest_namespace['plt'] = matplotlib.pyplot
28