From 884e67e6e78d498c0b4e02e8f34f58ea684e0ea3 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 1 Sep 2023 14:34:49 +0800 Subject: [PATCH] Remove the unused pygmt.test() function (#2652) --- doc/api/index.rst | 1 - pygmt/__init__.py | 52 ----------------------------------------------- 2 files changed, 53 deletions(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index 9ce697b5fbd..8e63c016502 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -203,7 +203,6 @@ Miscellaneous :toctree: generated which - test print_clib_info show_versions diff --git a/pygmt/__init__.py b/pygmt/__init__.py index aea73fe3f44..5ee1dded30a 100644 --- a/pygmt/__init__.py +++ b/pygmt/__init__.py @@ -182,55 +182,3 @@ def _get_ghostscript_version(): print(f" ghostscript: {_get_ghostscript_version()}", file=file) print_clib_info(file=file) - - -def test(doctest=True, verbose=True, coverage=False, figures=True): - """ - Run the test suite. - - Uses `pytest `__ to discover and run the tests. If you - haven't already, you can install it with `mamba - `__ or `pip - `__. - - Parameters - ---------- - doctest : bool - If ``True``, will run the doctests as well (code examples that start - with a ``>>>`` in the docs). - verbose : bool - If ``True``, will print extra information during the test run. - coverage : bool - If ``True``, will run test coverage analysis on the code as well. - Requires ``pytest-cov``. - figures : bool - If ``True``, will test generated figures against saved baseline - figures. Requires ``pytest-mpl`` and ``matplotlib``. - - Raises - ------ - - AssertionError - If pytest returns a non-zero error code indicating that some tests have - failed. - """ - import pytest # pylint: disable=import-outside-toplevel - - show_versions() - - package = __name__ - - args = [] - if verbose: - args.append("-vv") - if coverage: - args.append(f"--cov={package}") - args.append("--cov-report=term-missing") - if doctest: - args.append("--doctest-modules") - if figures: - args.append("--mpl") - args.append("--pyargs") - args.append(package) - status = pytest.main(args) - assert status == 0, "Some tests have failed."