File: __init__.py

package info (click to toggle)
scikit-misc 0.3.1%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,144 kB
  • sloc: fortran: 2,220; ansic: 1,352; python: 870; sh: 271; makefile: 98; javascript: 60
file content (43 lines) | stat: -rw-r--r-- 1,280 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
from importlib.metadata import PackageNotFoundError, version

try:
    __version__ = version('scikit_misc')
except PackageNotFoundError:
    # package is not installed
    pass
finally:
    del version
    del PackageNotFoundError

__all__ = ['__version__']

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]))  # type: ignore
else:
    __all__.append('show_config')


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