##// END OF EJS Templates
Added MockPlugin PB11 wrapper...
jeandet -
r1366:1cb2144d2987
parent child
Show More
@@ -0,0 +1,85
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SciQLOP Software
3 -- Copyright (C) 2018, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
22 #include <string>
23 #include <sstream>
24 #include <memory>
25
26 #include <pybind11/pybind11.h>
27 #include <pybind11/operators.h>
28 #include <pybind11/embed.h>
29 #include <pybind11/numpy.h>
30 #include <pybind11/chrono.h>
31
32 #include <SqpApplication.h>
33 #include <Variable/VariableController2.h>
34 #include <Time/TimeController.h>
35 #include <Data/DateTimeRange.h>
36 #include <Data/DataSeriesType.h>
37 #include <Common/DateUtils.h>
38 #include <Variable/Variable.h>
39 #include <Data/ScalarSeries.h>
40 #include <Data/VectorSeries.h>
41
42 #include <MockPlugin.h>
43 #include <CosinusProvider.h>
44
45 #include <QFile>
46
47 #include <pywrappers_common.h>
48 #include <CoreWrappers.h>
49
50
51
52 using namespace std::chrono;
53 namespace py = pybind11;
54
55
56
57 PYBIND11_MODULE(pytestmockplugin, m){
58
59 int argc = 0;
60 char ** argv=nullptr;
61 SqpApplication::setOrganizationName("LPP");
62 SqpApplication::setOrganizationDomain("lpp.fr");
63 SqpApplication::setApplicationName("SciQLop");
64 static SqpApplication app(argc, argv);
65
66 auto qtmod = py::module::import("sciqlopqt");
67 auto sciqlopmod = py::module::import("pysciqlopcore");
68
69 m.doc() = "";
70
71 py::class_<VariableController2>(m, "VariableController2").def_static("createVariable",[](const QString &name,
72 std::shared_ptr<IDataProvider> provider, const DateTimeRange& range){
73 return sqpApp->variableController().createVariable(name, {{"cosinusType", "spectrogram"}, {"cosinusFrequency", "1.0"}}, provider, range);
74 });
75
76 py::class_<TimeController>(m,"TimeController")
77 .def_static("setTime", [](DateTimeRange range){sqpApp->timeController().setDateTimeRange(range);});
78
79 auto mock_provider = std::make_shared<CosinusProvider>();
80 m.def("mock_provider",[mock_provider](){return mock_provider;}, py::return_value_policy::copy);
81
82 py::class_<CosinusProvider, std::shared_ptr<CosinusProvider>, IDataProvider>(m, "CosinusProvider");
83
84 }
85
@@ -1,1 +1,1
1 Subproject commit cc47cd67a7b3418c7c0b065e7cb178abb63b0036
1 Subproject commit 70eb884a0ee3f19fb2a7dc91d2f25f6348d4167d
@@ -26,4 +26,6 include(sciqlop_tests)
26 add_definitions(-DMOCKPLUGIN_TESTS_RESOURCES_DIR="${CMAKE_CURRENT_LIST_DIR}/tests-resources")
26 add_definitions(-DMOCKPLUGIN_TESTS_RESOURCES_DIR="${CMAKE_CURRENT_LIST_DIR}/tests-resources")
27
27
28 #declare_test(TestCosinusAcquisition TestCosinusAcquisition tests/TestCosinusAcquisition.cpp "mockplugin;Qt5::Test")
28 #declare_test(TestCosinusAcquisition TestCosinusAcquisition tests/TestCosinusAcquisition.cpp "mockplugin;Qt5::Test")
29
29 pybind11_add_module(pytestmockplugin tests/PyTestMockPluginWrapper.cpp)
30 target_link_libraries(pytestmockplugin PUBLIC mockplugin)
31 target_link_libraries(pytestmockplugin PUBLIC pysciqlop)
General Comments 0
You need to be logged in to leave comments. Login now