Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-21065: Deprecate makePolicy #42

Merged
merged 2 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

daf_base isn't required anymore because it's solely a runtime-import Python dependency, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

"buildRequired": ["python", "pybind11"],
}

Expand Down