diff --git a/pynesci/src/CMakeLists.txt b/pynesci/src/CMakeLists.txt index febeafdfb0e1941bd6f5c5ad709f287ce563f7e2..0c4480487ad6d25c571058520e6f290536ad186c 100644 --- a/pynesci/src/CMakeLists.txt +++ b/pynesci/src/CMakeLists.txt @@ -38,4 +38,5 @@ add_python_module( OUTPUT_DIRECTORY ${PYNESCI_OUTPUT_DIR} ) +add_subdirectory(testing) add_subdirectory(consumer) diff --git a/pynesci/src/testing/CMakeLists.txt b/pynesci/src/testing/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db67d364376aa6edd3170e545af00c546d148a1 --- /dev/null +++ b/pynesci/src/testing/CMakeLists.txt @@ -0,0 +1,39 @@ +# ------------------------------------------------------------------------------- +# nesci -- neuronal simulator conan interface +# +# Copyright (c) 2018 RWTH Aachen University, Germany, +# Virtual Reality & Immersive Visualization Group. +# ------------------------------------------------------------------------------- +# License +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------------------------- + +file(GLOB SOURCES *.cpp) +file(GLOB HEADERS *.hpp) +file(GLOB PYTHON_SOURCES *.py) + +set(PYNESCI_TESTING_OUTPUT_DIR + ${CMAKE_CURRENT_BINARY_DIR}/../../pynesci/testing + CACHE PATH "Output path for pynesci python module" + ) + +add_python_module( + NAME _pynesci_testing + SOURCES ${SOURCES} + HEADERS ${HEADERS} + PYTHON_SOURCES ${PYTHON_SOURCES} + INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} + LINK_LIBRARIES Boost::python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} Boost::disable_autolinking conduit nesci::nesci nesci::testing + OUTPUT_DIRECTORY ${PYNESCI_TESTING_OUTPUT_DIR} + ) diff --git a/pynesci/src/testing/__init__.py b/pynesci/src/testing/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..21638a9ea3c5aca6dc7ec9fbab106f5100b374c0 --- /dev/null +++ b/pynesci/src/testing/__init__.py @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------- +# nesci -- neuronal simulator conan interface +# +# Copyright (c) 2018 RWTH Aachen University, Germany, +# Virtual Reality & Immersive Visualization Group. +# ------------------------------------------------------------------------------- +# License +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------------------------- + +from . _pynesci_testing import * diff --git a/pynesci/src/testing/pynesci_testing.cpp b/pynesci/src/testing/pynesci_testing.cpp new file mode 100644 index 0000000000000000000000000000000000000000..829623ed106e8875927cb3df3daa22cfd7b208be --- /dev/null +++ b/pynesci/src/testing/pynesci_testing.cpp @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// nesci -- neuronal simulator conan interface +// +// Copyright (c) 2017-2018 RWTH Aachen University, Germany, +// Virtual Reality & Immersive Visualisation Group. +//------------------------------------------------------------------------------ +// License +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//------------------------------------------------------------------------------ + +#include "boost/python.hpp" +#include "nesci/testing/data.hpp" +#include "pynesci/suppress_warnings.hpp" + +namespace pynesci { +namespace testing { + +SUPPRESS_WARNINGS_BEGIN + +// cppcheck-suppress unusedFunction +BOOST_PYTHON_MODULE(_pynesci_testing) { + using boost::noncopyable; + using boost::python::args; + using boost::python::bases; + using boost::python::class_; + using boost::python::def; + using boost::python::enum_; + using boost::python::init; + using boost::python::no_init; + using boost::python::pure_virtual; + using boost::python::scope; + using boost::python::wrapper; + + def("CreateNestMultimeterDataNode", + &nesci::testing::CreateNestMultimeterDataNode); + + def("CreateNestMultimeterDataNode", + &nesci::testing::CreateSpikeDetectorDataNode); +} +SUPPRESS_WARNINGS_END + +} // namespace testing +} // namespace pynesci diff --git a/pynesci/tests/test_pynesci_consumer_device_data_view.py b/pynesci/tests/test_pynesci_consumer_device_data_view.py index d0a65674ca87777809b9a533dd35eb8fec84df2e..6be3fbdbe1702bd03730f273519a6b9f027f757a 100644 --- a/pynesci/tests/test_pynesci_consumer_device_data_view.py +++ b/pynesci/tests/test_pynesci_consumer_device_data_view.py @@ -20,12 +20,13 @@ # ------------------------------------------------------------------------------- import pynesci +import CreateSpikeDetectorDataNode from pynesci.testing def test_pynesci_consumer_device_data_view(): - device = pynesci.consumer.DeviceDataView("SomeDeviceName") + device = pynesci.consumer.DeviceDataView(CreateSpikeDetectorDataNode()) def test_pynesci_consumer_device_data_view_get_device_name(): - device = pynesci.consumer.DeviceDataView("SomeDeviceName") + device = pynesci.consumer.DeviceDataView(CreateSpikeDetectorDataNode()) assert device.GetDeviceName() == "SomeDeviceName"