Skip to content

Commit

Permalink
Merge pull request #42 from lsst/tickets/DM-21065
Browse files Browse the repository at this point in the history
DM-21065: Deprecate makePolicy
  • Loading branch information
timj committed Sep 4, 2019
2 parents 6b74884 + 3b19ebc commit c96e915
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions python/lsst/pex/config/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

__all__ = ('makePropertySet', 'makePolicy')

from deprecated.sphinx import deprecated

try:
import lsst.pex.policy as pexPolicy
except ImportError:
Expand Down Expand Up @@ -71,6 +73,8 @@ def _helper(ps, prefix, dict_):
return None


@deprecated("pex_policy is deprecated, prefer makePropertySet (will be removed after v19)",
category=FutureWarning)
def makePolicy(config):
"""Convert a configuration into a `lsst.pex.policy.Policy`.
Expand Down
6 changes: 4 additions & 2 deletions tests/test_Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,16 @@ class III(AAA):

@unittest.skipIf(pexPolicy is None, "lsst.pex.policy is required")
def testConvertPolicy(self):
pol = pexConfig.makePolicy(self.simple)
with self.assertWarns(FutureWarning):
pol = pexConfig.makePolicy(self.simple)
self.assertFalse(pol.exists("i"))
self.assertEqual(pol.get("f"), self.simple.f)
self.assertEqual(pol.get("b"), self.simple.b)
self.assertEqual(pol.get("c"), self.simple.c)
self.assertEqual(pol.getArray("ll"), list(self.simple.ll))

pol = pexConfig.makePolicy(self.comp)
with self.assertWarns(FutureWarning):
pol = pexConfig.makePolicy(self.comp)
self.assertEqual(pol.get("c.f"), self.comp.c.f)

@unittest.skipIf(dafBase is None, "lsst.daf.base is required")
Expand Down
1 change: 0 additions & 1 deletion ups/pex_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lsst.sconsUtils

dependencies = {
"required": ["daf_base", "pex_policy"],
"buildRequired": ["python", "pybind11"],
}

Expand Down

0 comments on commit c96e915

Please sign in to comment.