From 619fb38f415c9c8eb97281ba769e7c4194bd9318 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 26 Sep 2024 09:57:17 -0500 Subject: [PATCH 1/2] does this work on GitHub? --- src/python/module/export_module_base.cpp | 1 + tests/python/unit_tests/module/test_module_base.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/python/module/export_module_base.cpp b/src/python/module/export_module_base.cpp index 1956f7586..475e8a44e 100644 --- a/src/python/module/export_module_base.cpp +++ b/src/python/module/export_module_base.cpp @@ -40,6 +40,7 @@ void export_module_base(py_module_reference m) { .def("property_types", &ModuleBase::property_types) .def("get_desc", &ModuleBase::get_desc) .def("citations", &ModuleBase::citations) + .def("get_runtime", &ModuleBase::get_runtime) // //.def("set_cache", &ModuleBase::set_cache) // .def("get_cache", &ModuleBase::get_cache) // .def("reset_internal_cache", &ModuleBase::reset_internal_cache) diff --git a/tests/python/unit_tests/module/test_module_base.py b/tests/python/unit_tests/module/test_module_base.py index 2fdc1f136..abb72d2ad 100644 --- a/tests/python/unit_tests/module/test_module_base.py +++ b/tests/python/unit_tests/module/test_module_base.py @@ -13,6 +13,7 @@ # limitations under the License. import pluginplay as pp +import parallelzone as pz import py_test_pluginplay as test_pp import unittest @@ -52,6 +53,10 @@ def test_run_as(self): r = self.mm.run_as(test_pp.OneInOneOut(), self.mod_key, 1) self.assertEqual(r, 3) + def test_get_runtime(self): + mod = self.mm.at(self.mod_key) + self.assertEqual(mod.get_runtime(), pz.runtime.RuntimeView()) + def setUp(self): self.defaulted = pp.ModuleBase() self.mm = test_pp.get_mm() From a4df518d571589729c2d3ba7e52a81870a219ae2 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Thu, 26 Sep 2024 11:02:00 -0500 Subject: [PATCH 2/2] move the assertion --- CMakeLists.txt | 12 ++++-------- tests/python/unit_tests/module/test_module_base.py | 5 +---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14256666a..97393d132 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ nwx_cxx_api_docs("README.md" "${project_inc_dir}" "${project_src_dir}") ### Options ### cmaize_option_list( BUILD_TESTING OFF "Should we build unit tests?" - BUILD_PYBIND11_PYBINDINGS OFF "Build Pybind11 Python bindings?" + BUILD_PYBIND11_PYBINDINGS ON "Build Pybind11 Python bindings?" BUILD_ROCKSDB OFF "Enable RocksDB backend of the cache?" ) @@ -152,10 +152,6 @@ if("${BUILD_TESTING}") ### Python Tests ### set(python_test_dir "${CMAKE_CURRENT_LIST_DIR}/tests/python") - cmaize_find_or_build_dependency( - tox - PACKAGE_MANAGER pip - ) # In the python tests we will pass Python into PluginPlay, we will then # need to know that C++ can handle those Python types. To this end we @@ -166,11 +162,11 @@ if("${BUILD_TESTING}") INSTALL OFF SOURCE_DIR "${python_test_dir}/unit_tests" INCLUDE_DIRS "${project_inc_dir}" - DEPENDS ${PROJECT_NAME} tox + DEPENDS ${PROJECT_NAME} ) - nwx_tox_test( - py_pluginplay ${python_test_dir}/unit_tests + nwx_pybind11_tests( + py_pluginplay ${python_test_dir}/unit_tests/test_pluginplay.py SUBMODULES parallelzone ) diff --git a/tests/python/unit_tests/module/test_module_base.py b/tests/python/unit_tests/module/test_module_base.py index abb72d2ad..6a35fcbed 100644 --- a/tests/python/unit_tests/module/test_module_base.py +++ b/tests/python/unit_tests/module/test_module_base.py @@ -34,6 +34,7 @@ def run_(self, inputs, submods): i0, = pt.unwrap_inputs(inputs) i1 = inputs["An extra input"].value() + assert (self.get_runtime() == pz.runtime.RuntimeView()) r0 = submods["A submodule"].run_as(pt, i0 + i1) rv = self.results() @@ -53,10 +54,6 @@ def test_run_as(self): r = self.mm.run_as(test_pp.OneInOneOut(), self.mod_key, 1) self.assertEqual(r, 3) - def test_get_runtime(self): - mod = self.mm.at(self.mod_key) - self.assertEqual(mod.get_runtime(), pz.runtime.RuntimeView()) - def setUp(self): self.defaulted = pp.ModuleBase() self.mm = test_pp.get_mm()