Skip to content

Commit

Permalink
Remove the harmonica.test() function (#482)
Browse files Browse the repository at this point in the history
Remove the public `harmonica.test()` function. Also remove the section
in the Installing pages of the docs that instructed users to test their
installation.
  • Loading branch information
santisoler authored Mar 27, 2024
1 parent 8c7a09b commit a122b25
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
16 changes: 0 additions & 16 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,3 @@ The examples in the :ref:`gallery` also use:
* `ensaio <http://www.fatiando.org/ensaio/>`__ for downloading sample datasets
* `pygmt <https://www.pygmt.org/>`__ for plotting maps
* `pyproj <https://jswhit.github.io/pyproj/>`__ for cartographic projections


Testing your install
--------------------

We ship a full test suite with the package.
To run the tests, you'll need to install some extra dependencies first:

* `pytest <https://docs.pytest.org/>`__
* `boule <http://www.fatiando.org/boule/>`__

After that, you can test your installation by running the following inside
a Python interpreter::

import harmonica
harmonica.test()
48 changes: 0 additions & 48 deletions harmonica/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,51 +34,3 @@

# Append a leading "v" to the generated version by setuptools_scm
__version__ = f"v{__version__}"


def test(doctest=True, verbose=True, coverage=False, figures=False):
"""
Run the test suite.
Uses `py.test <http://pytest.org/>`__ to discover and run the tests.
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

package = __name__
args = []
if verbose:
args.append("-vv")
if coverage:
args.append("--cov={}".format(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."

0 comments on commit a122b25

Please sign in to comment.