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-14828: Update pybind11 wrappers for 2.2 #23

Merged
merged 3 commits into from
Jul 21, 2018
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.cache
.pytest_cache
pytest_session.txt
.coverage
.sconsign.dblite
config.log
.sconf_temp
Expand Down
6 changes: 1 addition & 5 deletions tests/testLib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ struct ListView {
std::vector<T> *v;
};

PYBIND11_PLUGIN(_testLib) {
pybind11::module mod("_testLib", "Tests for the pex_config library");

PYBIND11_MODULE(_testLib, mod) {
py::class_<ListView<std::string>>(mod, "ListView")
.def("append", [](ListView<std::string> &view, std::string value) {
view.v->push_back(value);
Expand Down Expand Up @@ -106,6 +104,4 @@ PYBIND11_PLUGIN(_testLib) {

mod.def("checkControl", &checkControl);
mod.def("checkNestedControl", &checkNestedControl);

return mod.ptr();
}
10 changes: 5 additions & 5 deletions tests/test_Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,16 @@ def testConvert(self):

ps = pexConfig.makePropertySet(self.simple)
self.assertEqual(ps.exists("i"), False)
self.assertEqual(ps.get("f"), self.simple.f)
self.assertEqual(ps.get("b"), self.simple.b)
self.assertEqual(ps.get("c"), self.simple.c)
self.assertEqual(list(ps.get("ll")), list(self.simple.ll))
self.assertEqual(ps.getScalar("f"), self.simple.f)
self.assertEqual(ps.getScalar("b"), self.simple.b)
self.assertEqual(ps.getScalar("c"), self.simple.c)
self.assertEqual(list(ps.getArray("ll")), list(self.simple.ll))

pol = pexConfig.makePolicy(self.comp)
self.assertEqual(pol.get("c.f"), self.comp.c.f)

ps = pexConfig.makePropertySet(self.comp)
self.assertEqual(ps.get("c.f"), self.comp.c.f)
self.assertEqual(ps.getScalar("c.f"), self.comp.c.f)

def testFreeze(self):
self.comp.freeze()
Expand Down