Repository: PlasmaPy/PlasmaPy

Issue:
Remove limit on version of Sphinx
We just started getting an `ImportError` related to `plasmapy_sphinx` in our weekly test with the development version of Sphinx:  
```
Extension error:
Could not import extension plasmapy_sphinx (exception: cannot import name 'PyField' from 'sphinx.domains.python' (/home/runner/work/PlasmaPy/PlasmaPy/.tox/build_docs-sphinxdev/lib/python3.12/site-packages/sphinx/domains/python/__init__.py))
build_docs-sphinxdev: exit 2 (7.26 seconds) /home/runner/work/PlasmaPy/PlasmaPy> sphinx-build docs docs/_build/html -W -n --keep-going -b html -q pid=2260
```

I think the change happened in either [this commit](https://github.com/sphinx-doc/sphinx/commit/e9dcfebcf9f3cb5db6a47448e10e9b61c5abc416) or [this other commit](https://github.com/sphinx-doc/sphinx/commit/d491d3e04c0b95ea9603a82a5fb8cb83c1e192f1).

In #2498, the requirement got hard-coded to `sphinx == 7.2.6` so that this doesn't end up surprising us in the coming months.  I decided against fixing it now because the change hasn't been released yet.


Discussion:

Resolving patch:
diff --git a/plasmapy/formulary/dimensionless.py b/plasmapy/formulary/dimensionless.py
--- a/plasmapy/formulary/dimensionless.py
+++ b/plasmapy/formulary/dimensionless.py
@@ -205,14 +205,8 @@ def Hall_parameter(
     Examples
     --------
     >>> import astropy.units as u
-    >>> import pytest
-    >>> from plasmapy.utils.exceptions import RelativityWarning
-
     >>> Hall_parameter(1e10 * u.m**-3, 2.8e2 * u.eV, 2.3 * u.T, "He-4 +1", "e-")
     <Quantity 2.500...e+15>
-    >>> with pytest.warns(RelativityWarning):
-    ...     Hall_parameter(1e10 * u.m**-3, 5.8e3 * u.eV, 2.3 * u.T, "He-4 +1", "e-")
-    <Quantity 2.11158...e+17>
     """
     from plasmapy.formulary.collisions import (
         fundamental_electron_collision_freq,
diff --git a/plasmapy/particles/particle_class.py b/plasmapy/particles/particle_class.py
--- a/plasmapy/particles/particle_class.py
+++ b/plasmapy/particles/particle_class.py
@@ -1960,7 +1960,6 @@ def json_dict(self) -> dict:
             'date_created': '...',
             '__init__': {'args': (), 'kwargs': {'mass': 1.0, 'charge': -1.0,
             'symbol': 'DimensionlessParticle(mass=1.0, charge=-1.0)'}}}}
-        >>> import pytest
         >>> dimensionless_particle = DimensionlessParticle(mass=1.0)
         >>> dimensionless_particle.json_dict
         {'plasmapy_particle': {'type': 'DimensionlessParticle',
@@ -2224,7 +2223,6 @@ def json_dict(self) -> dict[str, str]:
             'date_created': '...',
             '__init__': {'args': (), 'kwargs': {'mass': '5.12 kg', 'charge': '6.2 C',
             'charge_number': '3.869735626...e+19', 'symbol': 'ξ'}}}}
-        >>> import pytest
         >>> custom_particle = CustomParticle(mass=1.5e-26 * u.kg)
         >>> custom_particle.json_dict
         {'plasmapy_particle': {'type': 'CustomParticle',


Test patch:
diff --git a/plasmapy/diagnostics/tests/test_langmuir.py b/plasmapy/diagnostics/tests/test_langmuir.py
--- a/plasmapy/diagnostics/tests/test_langmuir.py
+++ b/plasmapy/diagnostics/tests/test_langmuir.py
@@ -275,26 +275,21 @@ def test_nan_area() -> None:
         r"""Test error upon NaN area"""
 
         with pytest.raises(ValueError):
-            with pytest.warns(FutureWarning):
-                langmuir.swept_probe_analysis(
-                    characteristic, np.nan * u.cm**2, "Ar-40 1+"
-                )
+            langmuir.swept_probe_analysis(characteristic, np.nan * u.cm**2, "Ar-40 1+")
 
     @staticmethod
     def test_unit_conversion_error() -> None:
         r"""Test error upon incorrect probe area unit"""
 
         with pytest.raises(u.UnitTypeError):
-            with pytest.warns(FutureWarning):
-                langmuir.swept_probe_analysis(characteristic, 1 * u.cm, "Ar-40 1+")
+            langmuir.swept_probe_analysis(characteristic, 1 * u.cm, "Ar-40 1+")
 
     @staticmethod
     def test_negative_area() -> None:
         r"""Test error upon negative probe area"""
 
         with pytest.raises(ValueError):
-            with pytest.warns(FutureWarning):
-                langmuir.swept_probe_analysis(characteristic, -1 * u.cm**2, "Ar-40 1+")
+            langmuir.swept_probe_analysis(characteristic, -1 * u.cm**2, "Ar-40 1+")
 
     @staticmethod
     @pytest.mark.parametrize("bimaxwellian", [True, False])
diff --git a/plasmapy/formulary/tests/test_transport.py b/plasmapy/formulary/tests/test_transport.py
--- a/plasmapy/formulary/tests/test_transport.py
+++ b/plasmapy/formulary/tests/test_transport.py
@@ -258,7 +258,7 @@ def test_coulomb_log_warnings(self) -> None:
 
     def test_coulomb_log_errors(self) -> None:
         """Should raise PhysicsError if coulomb log is < 1"""
-        with pytest.raises(PhysicsError), pytest.warns(CouplingWarning):
+        with pytest.raises(PhysicsError):
             ClassicalTransport(
                 T_e=self.T_e,
                 n_e=self.n_e,
@@ -268,7 +268,7 @@ def test_coulomb_log_errors(self) -> None:
                 coulomb_log_ii=0.3,
             )
 
-        with pytest.raises(PhysicsError), pytest.warns(CouplingWarning):
+        with pytest.raises(PhysicsError):
             ClassicalTransport(
                 T_e=self.T_e,
                 n_e=self.n_e,
diff --git a/plasmapy/particles/tests/test_particle_class.py b/plasmapy/particles/tests/test_particle_class.py
--- a/plasmapy/particles/tests/test_particle_class.py
+++ b/plasmapy/particles/tests/test_particle_class.py
@@ -1057,12 +1057,7 @@ def test_customized_particles_errors(cls, kwargs, exception) -> None:
     results in an InvalidParticleError.
     """
     with pytest.raises(exception):
-        if "mass" not in kwargs or "charge" not in kwargs:
-            with pytest.warns(MissingParticleDataWarning):
-                cls(**kwargs)
-        else:
-            cls(**kwargs)
-        pytest.fail(f"{cls.__name__}(**{kwargs}) did not raise: {exception.__name__}.")
+        cls(**kwargs)
 
 
 customized_particle_repr_table = [