From e1bca496f446d991746a715f55d1e856e50f0a86 Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Fri, 22 Mar 2024 15:35:44 -0700 Subject: [PATCH] Remove the harmonica.test() function Remove the public `harmonica.test()` function. Also remove the section in the Installing pages of the docs that instructed users to test their installation. Related to https://github.com/fatiando/community/issues/44 --- doc/install.rst | 16 --------------- harmonica/__init__.py | 48 ------------------------------------------- 2 files changed, 64 deletions(-) diff --git a/doc/install.rst b/doc/install.rst index 02ef25f9c..8c325313e 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -90,19 +90,3 @@ there:: git clone https://github.com/fatiando/harmonica.git cd harmonica pip install . - - -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 `__ -* `boule `__ - -After that, you can test your installation by running the following inside -a Python interpreter:: - - import harmonica - harmonica.test() diff --git a/harmonica/__init__.py b/harmonica/__init__.py index 2195e7532..10277ac91 100644 --- a/harmonica/__init__.py +++ b/harmonica/__init__.py @@ -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 `__ 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."