File: __init__.py

package info (click to toggle)
scikit-misc 0.1.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 960 kB
  • sloc: fortran: 2,217; python: 2,023; ansic: 1,352; sh: 138; makefile: 97; javascript: 60
file content (48 lines) | stat: -rw-r--r-- 1,469 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
from ._version import get_versions

__version__ = get_versions()['version']
del get_versions

__all__ = ['__version__']

# We first need to detect if we're being called as part of the skmisc
# setup procedure itself in a reliable manner.
try:
    __SKMISC_SETUP__
except NameError:
    __SKMISC_SETUP__ = False

if __SKMISC_SETUP__:
    import sys as _sys
    _sys.stderr.write('Running from skmisc source directory.\n')
    del _sys
else:
    try:
        from skmisc.__config__ import show as show_config  # noqa: F401
    except ImportError as err:
        msg = """Error importing skmisc: you cannot import skmisc while
        being in skmisc source directory; please exit the skmisc source
        tree first, and relaunch your python intepreter."""
        raise ImportError('\n\n'.join([err.message, msg]))

    __all__.append('show_config')

    def test(args=None, plugins=None):
        """
        Run tests
        """
        # The doctests are not run when called from an installed
        # package since the pytest.ini is not included in the
        # package.
        import os
        try:
            import pytest
        except ImportError:
            msg = "To run the tests, you must install pytest"
            raise ImportError(msg)
        path = os.path.dirname(os.path.realpath(__file__))
        if args is None:
            args = [path]
        else:
            args.append(path)
        return pytest.main(args=args, plugins=plugins)