Repository: astropy/astropy

Issue:
Pickle test on constants all set to xfail
Looking over #5694, I noticed that `constants.tests.test_pickle` runs tests that are all set to fail. This is mostly a reminder to understand why this is, and whether something needs to be changed.

Discussion:

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 3bfecd1597..5894060123 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -15,6 +15,8 @@ astropy.constants
 
 - Default constants now use CODATA 2018 and IAU 2015 definitions. [#8761]
 
+- Constants can be pickled and unpickled. [#9377]
+
 astropy.convolution
 ^^^^^^^^^^^^^^^^^^^
 
diff --git a/astropy/constants/constant.py b/astropy/constants/constant.py
index a715cb2fc6..3753d1326b 100644
--- a/astropy/constants/constant.py
+++ b/astropy/constants/constant.py
@@ -62,7 +62,8 @@ class ConstantMeta(type):
         exclude = set(['__new__', '__array_finalize__', '__array_wrap__',
                        '__dir__', '__getattr__', '__init__', '__str__',
                        '__repr__', '__hash__', '__iter__', '__getitem__',
-                       '__len__', '__bool__', '__quantity_subclass__'])
+                       '__len__', '__bool__', '__quantity_subclass__',
+                       '__setstate__'])
         for attr, value in vars(Quantity).items():
             if (isinstance(value, types.FunctionType) and
                     attr.startswith('__') and attr.endswith('__') and


Test patch:
diff --git a/astropy/constants/tests/test_pickle.py b/astropy/constants/tests/test_pickle.py
index b9714f371f..75c2fb93bf 100644
--- a/astropy/constants/tests/test_pickle.py
+++ b/astropy/constants/tests/test_pickle.py
@@ -9,8 +9,8 @@ originals = [const.Constant('h_fake', 'Not Planck',
                             0.0, 'J s', 0.0, 'fakeref',
                             system='si'),
              const.h,
-             const.e]
-xfails = [True, True, True]
+             const.e.si]
+xfails = [False, False, False]
 
 
 @pytest.mark.parametrize(("original", "xfail"), zip(originals, xfails))