Debian Codegraph @

skmisc/__init__.py

raw symbols SCIP
1 from importlib.metadata import PackageNotFoundError, version
2
3 try:
4 __version__ = version('scikit_misc')
5 except PackageNotFoundError:
6 # package is not installed
7 pass
8 finally:
9 del version
10 del PackageNotFoundError
11
12 __all__ = ['__version__']
13
14 try:
15 from skmisc.__config__ import show as show_config # noqa: F401
16 except ImportError as err:
17 msg = """Error importing skmisc: you cannot import skmisc while
18 being in skmisc source directory; please exit the skmisc source
19 tree first, and relaunch your python intepreter."""
20 raise ImportError('\n\n'.join([err.message, msg])) # type: ignore
21 else:
22 __all__.append('show_config')
23
24
25 def test(args=None, plugins=None):
26 """
27 Run tests
28 """
29 from pathlib import Path
30 # The doctests are not run when called from an installed
31 # package since the pytest.ini is not included in the
32 # package.
33 try:
34 import pytest
35 except ImportError:
36 msg = "To run the tests, you must install pytest"
37 raise ImportError(msg)
38 path = str(Path(__file__).parent)
39 if args is None:
40 args = [path]
41 else:
42 args.append(path)
43 return pytest.main(args=args, plugins=plugins)