Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the unused pygmt.test() function #2652

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ Miscellaneous
:toctree: generated

which
test
print_clib_info
show_versions

Expand Down
52 changes: 0 additions & 52 deletions pygmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://pytest.org/>`__ to discover and run the tests. If you
haven't already, you can install it with `mamba
<https://mamba.readthedocs.org/>`__ or `pip
<https://pip.pypa.io/en/stable/>`__.

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."
Loading