From fa096345f88f8164ff4a3da418fc59088aa163a0 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Thu, 11 May 2023 23:07:54 -0400 Subject: [PATCH] Remove test helper functionality from public API (#2114) * Mark plasmapy.tests.helpers as private * pytest_helpers -> _pytest_helpers * Remove stub files for pytest helpers * Add changelog entry * Add second changelog entry * Update name of file * Fix reST links * Update reST links in changelog * Update import organization * Fix reST link * Update ruff ignore links * Remove api_static page for conftest * Fix pyproject.toml * Update changelog entries --- .sourcery.yaml | 2 +- CHANGELOG.rst | 4 ++-- changelog/2114.breaking.1.rst | 3 +++ changelog/2114.breaking.2.rst | 3 +++ docs/api_static/plasmapy.conftest.rst | 8 -------- .../plasmapy.tests.helpers.exceptions.rst | 8 -------- docs/api_static/plasmapy.tests.helpers.rst | 8 -------- ...apy.utils.pytest_helpers.pytest_helpers.rst | 8 -------- docs/utils/index.rst | 3 --- docs/whatsnew/0.5.0.rst | 4 ++-- .../formulary/collisions/tests/test_coulomb.py | 2 +- .../collisions/tests/test_dimensionless.py | 2 +- .../collisions/tests/test_frequencies.py | 2 +- .../formulary/collisions/tests/test_lengths.py | 2 +- .../formulary/collisions/tests/test_misc.py | 2 +- plasmapy/formulary/tests/test_dimensionless.py | 2 +- plasmapy/formulary/tests/test_frequencies.py | 2 +- plasmapy/formulary/tests/test_lengths.py | 2 +- plasmapy/formulary/tests/test_misc.py | 2 +- .../formulary/tests/test_plasma_frequency.py | 2 +- plasmapy/formulary/tests/test_speeds.py | 2 +- plasmapy/formulary/tests/test_thermal_speed.py | 2 +- plasmapy/particles/tests/test_atomic.py | 2 +- plasmapy/particles/tests/test_nuclear.py | 2 +- .../particles/tests/test_particle_class.py | 2 +- plasmapy/tests/__init__.py | 4 ++-- .../tests/{helpers => _helpers}/__init__.py | 12 ++++++------ .../tests/{helpers => _helpers}/exceptions.py | 0 .../{helpers => _helpers}/tests/__init__.py | 0 .../tests/sample_functions.py | 0 plasmapy/utils/__init__.py | 5 ----- .../__init__.py | 2 +- .../pytest_helpers.py | 18 +++++++++--------- .../tests/__init__.py | 0 .../tests/test_pytest_helpers.py | 4 ++-- plasmapy/utils/tests/test_roman.py | 2 +- pyproject.toml | 4 ++-- 37 files changed, 49 insertions(+), 83 deletions(-) create mode 100644 changelog/2114.breaking.1.rst create mode 100644 changelog/2114.breaking.2.rst delete mode 100644 docs/api_static/plasmapy.conftest.rst delete mode 100644 docs/api_static/plasmapy.tests.helpers.exceptions.rst delete mode 100644 docs/api_static/plasmapy.tests.helpers.rst delete mode 100644 docs/api_static/plasmapy.utils.pytest_helpers.pytest_helpers.rst rename plasmapy/tests/{helpers => _helpers}/__init__.py (73%) rename plasmapy/tests/{helpers => _helpers}/exceptions.py (100%) rename plasmapy/tests/{helpers => _helpers}/tests/__init__.py (100%) rename plasmapy/tests/{helpers => _helpers}/tests/sample_functions.py (100%) rename plasmapy/utils/{pytest_helpers => _pytest_helpers}/__init__.py (56%) rename plasmapy/utils/{pytest_helpers => _pytest_helpers}/pytest_helpers.py (98%) rename plasmapy/utils/{pytest_helpers => _pytest_helpers}/tests/__init__.py (100%) rename plasmapy/utils/{pytest_helpers => _pytest_helpers}/tests/test_pytest_helpers.py (98%) diff --git a/.sourcery.yaml b/.sourcery.yaml index dbd26d6949..24a419f72b 100644 --- a/.sourcery.yaml +++ b/.sourcery.yaml @@ -9,7 +9,7 @@ ignore: - vendor - docs/plasmapy_sphinx - braginskii.py -- helpers.py +- _helpers.py github: labels: [No changelog entry needed] diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 63c7fb1d5d..58808c3e63 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1356,7 +1356,7 @@ Backwards Incompatible Changes and migrated the dispersion functionality (`dispersionfunction.py`) from `plasmapy.formulary` to `plasmapy.dispersion`. (`#910 `__) - Removed default values for the `ion` and `particle` arguments of functions contained in ``plasmapy.formulary.parameters``, in accordance with issue [#453](https://github.com/PlasmaPy/PlasmaPy/issues/453), and updated all relevant calls to modified functionality. (`#911 `__) -- Moved test helper exceptions from `plasmapy.utils.pytest_helpers` to `plasmapy.tests.helpers`. (`#919 `__) +- Moved test helper exceptions from ``plasmapy.utils.pytest_helpers`` to ``plasmapy.tests.helpers``. (`#919 `__) - Update ``plasmapy.formulary.parameters.mass_density`` so it calculates the mass density for a specific particle from a given number density. Original function calculated the total mass density (ion + electron). (`#957 `__) @@ -1556,7 +1556,7 @@ Backwards Incompatible Changes - Create simulation subpackage; move Species particle tracker there; rename to particletracker (`#665 `__) - Changed `plasmapy.classes.Species` to `plasmapy.simulation.ParticleTracker` (`#668 `__) - Move pytest helper functionality from `plasmapy.utils` to - `~plasmapy.utils.pytest_helpers` (`#674 `__) + ``plasmapy.utils.pytest_helpers`` (`#674 `__) - Move `plasmapy.physics`, `plasmapy.mathematics` and `plasmapy.transport` into the common `plasmapy.formulary` subpackage (`#692 `__) - Change `ClassicalTransport` methods into attributes (`#705 `__) diff --git a/changelog/2114.breaking.1.rst b/changelog/2114.breaking.1.rst new file mode 100644 index 0000000000..280bd96b16 --- /dev/null +++ b/changelog/2114.breaking.1.rst @@ -0,0 +1,3 @@ +Removed ``plasmapy.tests.helpers`` from PlasmaPy's public API. It is +still available as ``plasmapy.tests._helpers``, but might be removed in +the future. diff --git a/changelog/2114.breaking.2.rst b/changelog/2114.breaking.2.rst new file mode 100644 index 0000000000..0661fbefcc --- /dev/null +++ b/changelog/2114.breaking.2.rst @@ -0,0 +1,3 @@ +Removed ``plasmapy.utils.pytest_helpers`` from PlasmaPy's public API. It is +still available as ``plasmapy.utils._pytest_helpers``, but might be removed in +the future. diff --git a/docs/api_static/plasmapy.conftest.rst b/docs/api_static/plasmapy.conftest.rst deleted file mode 100644 index 874d2081b9..0000000000 --- a/docs/api_static/plasmapy.conftest.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -`plasmapy.conftest` -=================== - -.. currentmodule:: plasmapy.conftest - -.. automodapi:: plasmapy.conftest diff --git a/docs/api_static/plasmapy.tests.helpers.exceptions.rst b/docs/api_static/plasmapy.tests.helpers.exceptions.rst deleted file mode 100644 index 4310ab0e32..0000000000 --- a/docs/api_static/plasmapy.tests.helpers.exceptions.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -`plasmapy.tests.helpers.exceptions` -=================================== - -.. currentmodule:: plasmapy.tests.helpers.exceptions - -.. automodapi:: plasmapy.tests.helpers.exceptions diff --git a/docs/api_static/plasmapy.tests.helpers.rst b/docs/api_static/plasmapy.tests.helpers.rst deleted file mode 100644 index 8041ae7731..0000000000 --- a/docs/api_static/plasmapy.tests.helpers.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -`plasmapy.tests.helpers` -======================== - -.. currentmodule:: plasmapy.tests.helpers - -.. automodapi:: plasmapy.tests.helpers diff --git a/docs/api_static/plasmapy.utils.pytest_helpers.pytest_helpers.rst b/docs/api_static/plasmapy.utils.pytest_helpers.pytest_helpers.rst deleted file mode 100644 index 31079e9e0f..0000000000 --- a/docs/api_static/plasmapy.utils.pytest_helpers.pytest_helpers.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -`plasmapy.utils.pytest_helpers.pytest_helpers` -============================================== - -.. currentmodule:: plasmapy.utils.pytest_helpers.pytest_helpers - -.. automodapi:: plasmapy.utils.pytest_helpers.pytest_helpers diff --git a/docs/utils/index.rst b/docs/utils/index.rst index 2a5ff9ba08..7e860d65cf 100644 --- a/docs/utils/index.rst +++ b/docs/utils/index.rst @@ -37,9 +37,6 @@ API .. automodapi:: plasmapy.utils.code_repr :include-heading: -.. automodapi:: plasmapy.utils.pytest_helpers - :include-heading: - .. automodapi:: plasmapy.utils.calculator :include-heading: diff --git a/docs/whatsnew/0.5.0.rst b/docs/whatsnew/0.5.0.rst index 4782405525..e77e7c050f 100644 --- a/docs/whatsnew/0.5.0.rst +++ b/docs/whatsnew/0.5.0.rst @@ -24,7 +24,7 @@ Backwards Incompatible Changes and migrated the dispersion functionality (:file:`dispersionfunction.py`) from `plasmapy.formulary` to `plasmapy.dispersion`. (`#910 `__) - Removed default values for the ``ion`` and ``particle`` arguments of functions contained in ``plasmapy.formulary.parameters``, in accordance with issue [#453](https://github.com/PlasmaPy/PlasmaPy/issues/453), and updated all relevant calls to modified functionality. (`#911 `__) -- Moved test helper exceptions from `plasmapy.utils.pytest_helpers` to `plasmapy.tests.helpers`. (`#919 `__) +- Moved test helper exceptions from ``plasmapy.utils.pytest_helpers`` to ``plasmapy.tests.helpers``. (`#919 `__) - Updated ``plasmapy.formulary.parameters.mass_density`` so it calculates the mass density for a specific particle from a given number density. Original function calculated the total mass density (ion + electron). (`#957 `__) @@ -42,7 +42,7 @@ Features functions are designed to wrap together an analytical function, a curve fitter, uncertainty propagation, and a root solver to make curve fitting a little less painful. (`#908 `__) -- Created a new subpackage, `plasmapy.tests.helpers`, to contain test helper functionality. (`#919 `__) +- Created a new subpackage, ``plasmapy.tests.helpers``, to contain test helper functionality. (`#919 `__) - Create decorator `~plasmapy.utils.decorators.helpers.modify_docstring`, which allows for programmatically prepending and/or appending a docstring. (`#943 `__) diff --git a/plasmapy/formulary/collisions/tests/test_coulomb.py b/plasmapy/formulary/collisions/tests/test_coulomb.py index 9f31414949..f70435ea76 100644 --- a/plasmapy/formulary/collisions/tests/test_coulomb.py +++ b/plasmapy/formulary/collisions/tests/test_coulomb.py @@ -9,8 +9,8 @@ from plasmapy.formulary.collisions.coulomb import Coulomb_logarithm from plasmapy.utils import exceptions +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import CouplingWarning -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray class Test_Coulomb_logarithm: diff --git a/plasmapy/formulary/collisions/tests/test_dimensionless.py b/plasmapy/formulary/collisions/tests/test_dimensionless.py index 7ab2c15474..2b929a19f2 100644 --- a/plasmapy/formulary/collisions/tests/test_dimensionless.py +++ b/plasmapy/formulary/collisions/tests/test_dimensionless.py @@ -7,8 +7,8 @@ Knudsen_number, ) from plasmapy.utils import exceptions +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import CouplingWarning -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray class Test_coupling_parameter: diff --git a/plasmapy/formulary/collisions/tests/test_frequencies.py b/plasmapy/formulary/collisions/tests/test_frequencies.py index 90db27bac5..234c30b08b 100644 --- a/plasmapy/formulary/collisions/tests/test_frequencies.py +++ b/plasmapy/formulary/collisions/tests/test_frequencies.py @@ -13,8 +13,8 @@ ) from plasmapy.particles import Particle from plasmapy.utils import exceptions +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import CouplingWarning, PhysicsError -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray class TestSingleParticleCollisionFrequencies: diff --git a/plasmapy/formulary/collisions/tests/test_lengths.py b/plasmapy/formulary/collisions/tests/test_lengths.py index 178b0dabb8..20af8a02d7 100644 --- a/plasmapy/formulary/collisions/tests/test_lengths.py +++ b/plasmapy/formulary/collisions/tests/test_lengths.py @@ -5,8 +5,8 @@ from plasmapy.formulary.collisions import coulomb, lengths from plasmapy.utils import exceptions +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import CouplingWarning -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray class Test_impact_parameter_perp: diff --git a/plasmapy/formulary/collisions/tests/test_misc.py b/plasmapy/formulary/collisions/tests/test_misc.py index 7b39a9c219..5fd0503ad9 100644 --- a/plasmapy/formulary/collisions/tests/test_misc.py +++ b/plasmapy/formulary/collisions/tests/test_misc.py @@ -4,8 +4,8 @@ from plasmapy.formulary.collisions.misc import mobility, Spitzer_resistivity from plasmapy.utils import exceptions +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import CouplingWarning -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray class Test_Spitzer_resistivity: diff --git a/plasmapy/formulary/tests/test_dimensionless.py b/plasmapy/formulary/tests/test_dimensionless.py index e2721d2691..57adb1f3f2 100644 --- a/plasmapy/formulary/tests/test_dimensionless.py +++ b/plasmapy/formulary/tests/test_dimensionless.py @@ -18,7 +18,7 @@ ) from plasmapy.particles import Particle from plasmapy.utils import RelativityWarning -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray Z = 1 diff --git a/plasmapy/formulary/tests/test_frequencies.py b/plasmapy/formulary/tests/test_frequencies.py index 9c7582e8ef..ec179890fe 100644 --- a/plasmapy/formulary/tests/test_frequencies.py +++ b/plasmapy/formulary/tests/test_frequencies.py @@ -14,7 +14,7 @@ wuh_, ) from plasmapy.particles.exceptions import InvalidParticleError -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray Z = 1 ion = "p" diff --git a/plasmapy/formulary/tests/test_lengths.py b/plasmapy/formulary/tests/test_lengths.py index 3c895c0acd..5330ddaee5 100644 --- a/plasmapy/formulary/tests/test_lengths.py +++ b/plasmapy/formulary/tests/test_lengths.py @@ -18,7 +18,7 @@ ) from plasmapy.formulary.speeds import thermal_speed from plasmapy.particles.exceptions import InvalidParticleError -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray Z = 1 n_i = 5e19 * u.m**-3 diff --git a/plasmapy/formulary/tests/test_misc.py b/plasmapy/formulary/tests/test_misc.py index 6d41d58cda..3972ab00ce 100644 --- a/plasmapy/formulary/tests/test_misc.py +++ b/plasmapy/formulary/tests/test_misc.py @@ -19,7 +19,7 @@ ub_, ) from plasmapy.particles import Particle -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray B = 1.0 * u.T B_arr = np.array([0.001, 0.002]) * u.T diff --git a/plasmapy/formulary/tests/test_plasma_frequency.py b/plasmapy/formulary/tests/test_plasma_frequency.py index 6fcea321ce..4b778be585 100644 --- a/plasmapy/formulary/tests/test_plasma_frequency.py +++ b/plasmapy/formulary/tests/test_plasma_frequency.py @@ -15,7 +15,7 @@ from plasmapy.formulary.frequencies import plasma_frequency, plasma_frequency_lite, wp_ from plasmapy.particles import Particle -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray @pytest.mark.parametrize( diff --git a/plasmapy/formulary/tests/test_speeds.py b/plasmapy/formulary/tests/test_speeds.py index d058e0ce43..01e99b22ec 100644 --- a/plasmapy/formulary/tests/test_speeds.py +++ b/plasmapy/formulary/tests/test_speeds.py @@ -7,13 +7,13 @@ from plasmapy.formulary.speeds import Alfven_speed, cs_, ion_sound_speed, va_ from plasmapy.particles import Particle from plasmapy.particles.exceptions import InvalidParticleError +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import ( PhysicsError, PhysicsWarning, RelativityError, RelativityWarning, ) -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray Z = 1 diff --git a/plasmapy/formulary/tests/test_thermal_speed.py b/plasmapy/formulary/tests/test_thermal_speed.py index 5450bd4edd..973edc382c 100644 --- a/plasmapy/formulary/tests/test_thermal_speed.py +++ b/plasmapy/formulary/tests/test_thermal_speed.py @@ -26,8 +26,8 @@ ) from plasmapy.particles import Particle from plasmapy.particles.exceptions import InvalidParticleError +from plasmapy.utils._pytest_helpers import assert_can_handle_nparray from plasmapy.utils.exceptions import RelativityError, RelativityWarning -from plasmapy.utils.pytest_helpers import assert_can_handle_nparray @pytest.mark.parametrize( diff --git a/plasmapy/particles/tests/test_atomic.py b/plasmapy/particles/tests/test_atomic.py index c343729025..872520a79c 100644 --- a/plasmapy/particles/tests/test_atomic.py +++ b/plasmapy/particles/tests/test_atomic.py @@ -36,7 +36,7 @@ ) from plasmapy.particles.particle_class import Particle from plasmapy.particles.symbols import atomic_symbol, element_name, isotope_symbol -from plasmapy.utils.pytest_helpers import run_test +from plasmapy.utils._pytest_helpers import run_test # function to be tested, argument(s), expected result/outcome diff --git a/plasmapy/particles/tests/test_nuclear.py b/plasmapy/particles/tests/test_nuclear.py index a4c8acf83a..40e8287297 100644 --- a/plasmapy/particles/tests/test_nuclear.py +++ b/plasmapy/particles/tests/test_nuclear.py @@ -9,7 +9,7 @@ nuclear_binding_energy, nuclear_reaction_energy, ) -from plasmapy.utils.pytest_helpers import run_test, run_test_equivalent_calls +from plasmapy.utils._pytest_helpers import run_test, run_test_equivalent_calls test_nuclear_equivalent_calls_table = [ [nuclear_binding_energy, ["He-4", {}], ["alpha", {}], ["He", {"mass_numb": 4}]] diff --git a/plasmapy/particles/tests/test_particle_class.py b/plasmapy/particles/tests/test_particle_class.py index 8c04756c34..8844516076 100644 --- a/plasmapy/particles/tests/test_particle_class.py +++ b/plasmapy/particles/tests/test_particle_class.py @@ -30,8 +30,8 @@ valid_categories, ) from plasmapy.utils import roman +from plasmapy.utils._pytest_helpers import run_test_equivalent_calls from plasmapy.utils.code_repr import call_string -from plasmapy.utils.pytest_helpers import run_test_equivalent_calls # (arg, kwargs, results_dict) test_Particle_table = [ diff --git a/plasmapy/tests/__init__.py b/plasmapy/tests/__init__.py index cf2b9ff253..9d399a415e 100644 --- a/plasmapy/tests/__init__.py +++ b/plasmapy/tests/__init__.py @@ -1,3 +1,3 @@ -"""PlasmaPy tests and test helpers.""" +"""PlasmaPy tests and test _helpers.""" -from plasmapy.tests import helpers +from plasmapy.tests import _helpers diff --git a/plasmapy/tests/helpers/__init__.py b/plasmapy/tests/_helpers/__init__.py similarity index 73% rename from plasmapy/tests/helpers/__init__.py rename to plasmapy/tests/_helpers/__init__.py index 0075dc1bcf..ea2129812f 100644 --- a/plasmapy/tests/helpers/__init__.py +++ b/plasmapy/tests/_helpers/__init__.py @@ -18,11 +18,11 @@ # requests that were each originally part of #728. The blank lines # between the import statements will hopefully simplify automatic merging. -# from plasmapy.tests.helpers.actual import ActualTestOutcome +# from plasmapy.tests._helpers.actual import ActualTestOutcome -# from plasmapy.tests.helpers.cases import AttrTestCase, FunctionTestCase, MethodTestCase +# from plasmapy.tests._helpers.cases import AttrTestCase, FunctionTestCase, MethodTestCase -from plasmapy.tests.helpers.exceptions import ( +from plasmapy.tests._helpers.exceptions import ( ExceptionMismatchFail, InvalidTestError, MissingExceptionFail, @@ -35,9 +35,9 @@ WarningMismatchFail, ) -# from plasmapy.tests.helpers.expected import ExpectedTestOutcome +# from plasmapy.tests._helpers.expected import ExpectedTestOutcome -# from plasmapy.tests.helpers.inputs import ( +# from plasmapy.tests._helpers.inputs import ( # AbstractTestInputs, # ClassAttributeTestInputs, # ClassMethodTestInputs, @@ -45,4 +45,4 @@ # GenericClassTestInputs, # ) -# from plasmapy.tests.helpers.runner import test_runner +# from plasmapy.tests._helpers.runner import test_runner diff --git a/plasmapy/tests/helpers/exceptions.py b/plasmapy/tests/_helpers/exceptions.py similarity index 100% rename from plasmapy/tests/helpers/exceptions.py rename to plasmapy/tests/_helpers/exceptions.py diff --git a/plasmapy/tests/helpers/tests/__init__.py b/plasmapy/tests/_helpers/tests/__init__.py similarity index 100% rename from plasmapy/tests/helpers/tests/__init__.py rename to plasmapy/tests/_helpers/tests/__init__.py diff --git a/plasmapy/tests/helpers/tests/sample_functions.py b/plasmapy/tests/_helpers/tests/sample_functions.py similarity index 100% rename from plasmapy/tests/helpers/tests/sample_functions.py rename to plasmapy/tests/_helpers/tests/sample_functions.py diff --git a/plasmapy/utils/__init__.py b/plasmapy/utils/__init__.py index 5f0e6b8542..be6273f379 100644 --- a/plasmapy/utils/__init__.py +++ b/plasmapy/utils/__init__.py @@ -35,8 +35,3 @@ RelativityError, RelativityWarning, ) - -with contextlib.suppress(ModuleNotFoundError): - # pytest is not a hard dependency, so only import pytest_helpers if pytest - # is installed - from plasmapy.utils import pytest_helpers diff --git a/plasmapy/utils/pytest_helpers/__init__.py b/plasmapy/utils/_pytest_helpers/__init__.py similarity index 56% rename from plasmapy/utils/pytest_helpers/__init__.py rename to plasmapy/utils/_pytest_helpers/__init__.py index 950b9bd680..fbab3eac35 100644 --- a/plasmapy/utils/pytest_helpers/__init__.py +++ b/plasmapy/utils/_pytest_helpers/__init__.py @@ -1,4 +1,4 @@ -from plasmapy.utils.pytest_helpers.pytest_helpers import ( +from plasmapy.utils._pytest_helpers.pytest_helpers import ( assert_can_handle_nparray, run_test, run_test_equivalent_calls, diff --git a/plasmapy/utils/pytest_helpers/pytest_helpers.py b/plasmapy/utils/_pytest_helpers/pytest_helpers.py similarity index 98% rename from plasmapy/utils/pytest_helpers/pytest_helpers.py rename to plasmapy/utils/_pytest_helpers/pytest_helpers.py index a5c2254f48..b18a202a8a 100644 --- a/plasmapy/utils/pytest_helpers/pytest_helpers.py +++ b/plasmapy/utils/_pytest_helpers/pytest_helpers.py @@ -19,7 +19,7 @@ from typing import Any, Callable -from plasmapy.tests.helpers.exceptions import ( +from plasmapy.tests._helpers.exceptions import ( InvalidTestError, MissingExceptionFail, MissingWarningFail, @@ -113,22 +113,22 @@ def run_test( # noqa: C901 Raises ------ - ~plasmapy.tests.helpers.exceptions.UnexpectedResultFail + ~plasmapy.tests._helpers.exceptions.UnexpectedResultFail If the test returns a result that is different from the expected result. - ~plasmapy.tests.helpers.exceptions.TypeMismatchFail + ~plasmapy.tests._helpers.exceptions.TypeMismatchFail If the actual result is of a different type than the expected result. - ~plasmapy.tests.helpers.exceptions.UnexpectedExceptionFail + ~plasmapy.tests._helpers.exceptions.UnexpectedExceptionFail If an exception occurs when no exception or a different exception is expected. - ~plasmapy.tests.helpers.exceptions.MissingExceptionFail + ~plasmapy.tests._helpers.exceptions.MissingExceptionFail If no exception is raised when an exception is expected. - ~plasmapy.tests.helpers.exceptions.MissingWarningFail + ~plasmapy.tests._helpers.exceptions.MissingWarningFail An expected warning is not issued. ~astropy.units.UnitsError @@ -433,16 +433,16 @@ def run_test_equivalent_calls( # noqa: C901 Raises ------ - ~plasmapy.tests.helpers.exceptions.UnexpectedResultFail + ~plasmapy.tests._helpers.exceptions.UnexpectedResultFail If not all of the results are equivalent, or not all of the results are of the same type and ``require_same_type`` evaluates to `True`. - ~plasmapy.tests.helpers.exceptions.UnexpectedExceptionFail + ~plasmapy.tests._helpers.exceptions.UnexpectedExceptionFail If an exception is raised whilst attempting to run one of the test cases. - ~plasmapy.tests.helpers.exceptions.InvalidTestError + ~plasmapy.tests._helpers.exceptions.InvalidTestError If there is an error associated with the inputs or the test is set up incorrectly. diff --git a/plasmapy/utils/pytest_helpers/tests/__init__.py b/plasmapy/utils/_pytest_helpers/tests/__init__.py similarity index 100% rename from plasmapy/utils/pytest_helpers/tests/__init__.py rename to plasmapy/utils/_pytest_helpers/tests/__init__.py diff --git a/plasmapy/utils/pytest_helpers/tests/test_pytest_helpers.py b/plasmapy/utils/_pytest_helpers/tests/test_pytest_helpers.py similarity index 98% rename from plasmapy/utils/pytest_helpers/tests/test_pytest_helpers.py rename to plasmapy/utils/_pytest_helpers/tests/test_pytest_helpers.py index 9f43ca407a..f014ef4a43 100644 --- a/plasmapy/utils/pytest_helpers/tests/test_pytest_helpers.py +++ b/plasmapy/utils/_pytest_helpers/tests/test_pytest_helpers.py @@ -6,16 +6,16 @@ from typing import Any from plasmapy.particles import Particle -from plasmapy.tests.helpers import ( +from plasmapy.tests._helpers import ( MissingExceptionFail, MissingWarningFail, TypeMismatchFail, UnexpectedExceptionFail, UnexpectedResultFail, ) +from plasmapy.utils._pytest_helpers import run_test, run_test_equivalent_calls from plasmapy.utils.code_repr import call_string from plasmapy.utils.exceptions import PlasmaPyError, PlasmaPyWarning -from plasmapy.utils.pytest_helpers import run_test, run_test_equivalent_calls def generic_function(*args, **kwargs): diff --git a/plasmapy/utils/tests/test_roman.py b/plasmapy/utils/tests/test_roman.py index b6f774f747..6a1812aa7a 100644 --- a/plasmapy/utils/tests/test_roman.py +++ b/plasmapy/utils/tests/test_roman.py @@ -2,7 +2,7 @@ import pytest from plasmapy.utils import roman -from plasmapy.utils.pytest_helpers import run_test +from plasmapy.utils._pytest_helpers import run_test ints_and_roman_numerals = [ (1, "I"), diff --git a/pyproject.toml b/pyproject.toml index bac1d36351..2de404763f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -315,8 +315,8 @@ max-complexity = 10 "plasmapy/formulary/tests/test_distribution.py" = ["ARG005"] "plasmapy/particles/tests/test_decorators.py" = ["ARG001", "ARG002"] "plasmapy/plasma/sources/*.py" = ["D102"] -"plasmapy/utils/pytest_helpers/pytest_helpers.py" = ["BLE001", "PLR"] -"plasmapy/utils/pytest_helpers/tests/test_pytest_helpers.py" = ["BLE001", "TRY002"] +"plasmapy/utils/_pytest_helpers/pytest_helpers.py" = ["BLE001", "PLR"] +"plasmapy/utils/_pytest_helpers/tests/test_pytest_helpers.py" = ["BLE001", "TRY002"] "setup.py" = ["D100"] "test_*" = ["D100", "D101", "D102", "D103", "D104", "D209", "D400", "D401"] "*/*/tests/__init__.py" = ["D104"]