Repository: pysat/pysatMissions (language: python)

Issue:
MAINT: warning evaluation
Replace the custom. `eval_deprecation` function in test_deprecation.py with the `pysat.utils.testing.eval_warnings` function once pysat 3.0.2 is released.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a7c8274..cbfbd4b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
 ## [0.3.2] - 2022-08-01
 * Make OMMBV an optional install
 * Access logger directly from pysat
+* Use pysat deprecation tests
 
 ## [0.3.1] - 2022-05-18
 * Include license in package manifest
diff --git a/README.md b/README.md
index 09d3593d..85238f29 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ Python 3.8+.
 | -------------- | ----------------- |
 | numpy          | aacgmv2           |
 | pandas         | apexpy            |
-| pyEphem        | pysat>=3.0        |
+| pyEphem        | pysat>=3.0.2      |
 | sgp4>=2.7      |                   |
 
 
@@ -63,7 +63,7 @@ python setup.py install
 
 Note: pre-1.0.0 version
 -----------------------
-pysatMissions is currently in an initial development phase and requires pysat 3.0.0.  
+pysatMissions is currently in an initial development phase and requires pysat 3.0.2.  
 
 # Using with pysat
 
diff --git a/requirements.txt b/requirements.txt
index a296180a..e25989b9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,6 +3,6 @@ apexpy
 geospacepy
 numpy
 pandas
-pysat>=3.0
+pysat>=3.0.2
 pyEphem
 sgp4>=2.7
diff --git a/setup.cfg b/setup.cfg
index faf48e8f..717d6fd4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -44,7 +44,7 @@ install_requires =
   numpy
   OMMBV
   pandas
-  pysat>=3.0
+  pysat
   pyEphem
   sgp4
 


Test patch:
diff --git a/pysatMissions/tests/test_deprecation.py b/pysatMissions/tests/test_deprecation.py
index 7ef08553..709a6397 100644
--- a/pysatMissions/tests/test_deprecation.py
+++ b/pysatMissions/tests/test_deprecation.py
@@ -1,6 +1,5 @@
 """Unit tests for deprecated methods and objects in pysatMissions."""
 
-import numpy as np
 import warnings
 
 import pysat
@@ -20,41 +19,6 @@ def teardown(self):
         """Clean up test environment after each method."""
         return
 
-    def eval_deprecation(self, warns, check_msgs, warn_type=DeprecationWarning):
-        """Evaluate whether message is contained in DeprecationWarning.
-
-        Parameters
-        ----------
-        warns : list
-            List of warnings.WarningMessage objects
-        check_msgs : list
-            List of strings containing the expected warning messages
-        warn_type : type
-            Type for the warning messages (default=DeprecationWarning)
-
-        """
-
-        # TODO(#82): Remove when pysat 3.0.2 is released.  Replace with
-        # pysat.utils.testing.eval_warnings
-
-        # Ensure the minimum number of warnings were raised
-        assert len(warns) >= len(check_msgs)
-
-        # Initialize the output
-        found_msgs = [False for msg in check_msgs]
-
-        # Test the warning messages, ensuring each attribute is present
-        for iwar in warns:
-            for i, msg in enumerate(check_msgs):
-                if str(iwar.message).find(msg) >= 0:
-                    assert iwar.category == warn_type, \
-                        "bad warning type for message: {:}".format(msg)
-                    found_msgs[i] = True
-
-        assert np.all(found_msgs), "did not find {:d} expected {:}".format(
-            len(found_msgs) - np.sum(found_msgs), repr(warn_type))
-        return
-
     def test_ephem_deprecation(self):
         """Test that instatiating missions_ephem will give DeprecationWarning."""
 
@@ -63,8 +27,5 @@ def test_ephem_deprecation(self):
 
         warn_msgs = ["`missions_ephem` has been deprecated"]
 
-        # TODO(#82): Replace with pysat.utils.testing.eval_warnings when pysat
-        # 3.0.2 is released.
-
-        self.eval_deprecation(war, warn_msgs)
+        pysat.utils.testing.eval_warnings(war, warn_msgs)
         return