pythonfmu3 0.2.2__py3-none-any.whl → 0.2.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pythonfmu3 might be problematic. Click here for more details.
- pythonfmu3/__init__.py +8 -8
- pythonfmu3/__main__.py +52 -52
- pythonfmu3/_version.py +1 -1
- pythonfmu3/builder.py +260 -260
- pythonfmu3/default_experiment.py +7 -7
- pythonfmu3/deploy.py +118 -118
- pythonfmu3/enums.py +48 -48
- pythonfmu3/fmi3slave.py +438 -438
- pythonfmu3/logmsg.py +14 -14
- pythonfmu3/osutil.py +22 -22
- pythonfmu3/pythonfmu-export/.clang-format +35 -35
- pythonfmu3/pythonfmu-export/CMakeLists.txt +59 -59
- pythonfmu3/pythonfmu-export/build/ALL_BUILD.vcxproj +184 -0
- pythonfmu3/pythonfmu-export/build/ALL_BUILD.vcxproj.filters +8 -0
- pythonfmu3/pythonfmu-export/build/CMakeCache.txt +369 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/0ee4db0675778dfba98c7160896d5a45/generate.stamp.rule +1 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeCCompiler.cmake +72 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeCXXCompiler.cmake +83 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeDetermineCompilerABI_C.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeDetermineCompilerABI_CXX.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeRCCompiler.cmake +6 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CMakeSystem.cmake +15 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CMakeCCompilerId.c +838 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CompilerIdC.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/CompilerIdC.vcxproj +71 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.exe.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +826 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CompilerIdCXX.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/CompilerIdCXX.vcxproj +71 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/VCTargetsPath.txt +1 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/VCTargetsPath.vcxproj +31 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/x64/Debug/VCTargetsPath.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.24.0/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeCCompiler.cmake +81 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeCXXCompiler.cmake +101 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeDetermineCompilerABI_C.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeRCCompiler.cmake +6 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CMakeSystem.cmake +15 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CMakeCCompilerId.c +904 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CompilerIdC.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/CompilerIdC.vcxproj +72 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.exe.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +919 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CompilerIdCXX.exe +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/CompilerIdCXX.vcxproj +72 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/VCTargetsPath.txt +1 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/VCTargetsPath.vcxproj +31 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/x64/Debug/VCTargetsPath.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/3.30.2/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/CMakeConfigureLog.yaml +568 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/CMakeOutput.log +357 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/TargetDirectories.txt +3 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/cmake.check_cache +1 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp +1 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp.depend +28 -0
- pythonfmu3/pythonfmu-export/build/CMakeFiles/generate.stamp.list +2 -0
- pythonfmu3/pythonfmu-export/build/ZERO_CHECK.vcxproj +174 -0
- pythonfmu3/pythonfmu-export/build/ZERO_CHECK.vcxproj.filters +13 -0
- pythonfmu3/pythonfmu-export/build/cmake_install.cmake +50 -0
- pythonfmu3/pythonfmu-export/build/install_manifest.txt +0 -0
- pythonfmu3/pythonfmu-export/build/pythonfmu-export.sln +53 -0
- pythonfmu3/pythonfmu-export/build/src/CMakeFiles/generate.stamp +1 -0
- pythonfmu3/pythonfmu-export/build/src/CMakeFiles/generate.stamp.depend +2 -0
- pythonfmu3/pythonfmu-export/build/src/Debug/pythonfmu-export.pdb +0 -0
- pythonfmu3/pythonfmu-export/build/src/Release/pythonfmu-export.exp +0 -0
- pythonfmu3/pythonfmu-export/build/src/Release/pythonfmu-export.lib +0 -0
- pythonfmu3/pythonfmu-export/build/src/cmake_install.cmake +34 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/PySlaveInstance.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/cppfmu_cs.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/exports.def +1885 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/fmi_functions.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/objects.txt +3 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.command.1.tlog +10 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.read.1.tlog +1 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/CustomBuild.write.1.tlog +2 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.command.1.tlog +1 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.read.1.tlog +1 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.read.3.tlog +1 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/link.write.1.tlog +1 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/pythonfmu-export.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/pythonfmu-export.tlog/unsuccessfulbuild +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Debug/vc142.pdb +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/MinSizeRel/objects.txt +3 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/RelWithDebInfo/objects.txt +3 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/PySlaveInstance.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/cppfmu_cs.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/exports.def +538 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/fmi_functions.obj +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/objects.txt +3 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.dll.recipe +14 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CL.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.command.1.tlog +10 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.read.1.tlog +1 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/CustomBuild.write.1.tlog +2 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.command.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.delete.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.read.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/link.write.1.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/pythonfmu-export.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.dir/Release/pythonfmu-export.tlog/pythonfmu-export.write.1u.tlog +0 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.vcxproj +414 -0
- pythonfmu3/pythonfmu-export/build/src/pythonfmu-export.vcxproj.filters +48 -0
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +10 -0
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +29 -0
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +3 -0
- pythonfmu3/pythonfmu-export/build/x64/Debug/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.recipe +17 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/ALL_BUILD.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.command.1.tlog +10 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.read.1.tlog +27 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.write.1.tlog +2 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.recipe +11 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +10 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +29 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +3 -0
- pythonfmu3/pythonfmu-export/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +2 -0
- pythonfmu3/pythonfmu-export/build_unix.sh +4 -4
- pythonfmu3/pythonfmu-export/build_win.sh +4 -4
- pythonfmu3/pythonfmu-export/src/CMakeLists.txt +45 -45
- pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +161 -161
- pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp +192 -192
- pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp +185 -185
- pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +937 -937
- pythonfmu3/pythonfmu-export/src/fmi/fmi3FunctionTypes.h +638 -638
- pythonfmu3/pythonfmu-export/src/fmi/fmi3Functions.h +343 -343
- pythonfmu3/pythonfmu-export/src/fmi/fmi3PlatformTypes.h +94 -94
- pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp +17 -17
- pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +744 -744
- pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +111 -111
- pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp +84 -84
- pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
- pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
- pythonfmu3/resources/binaries/x86_64-windows1/pythonfmu-export.dll +0 -0
- pythonfmu3/tests/conftest.py +5 -5
- pythonfmu3/tests/data/csvdemo.csv +7 -7
- pythonfmu3/tests/slaves/PythonSlaveWithException.py +18 -18
- pythonfmu3/tests/slaves/localmodule.py +8 -8
- pythonfmu3/tests/slaves/pythonslave.py +52 -52
- pythonfmu3/tests/slaves/pythonslave_read_file.py +23 -23
- pythonfmu3/tests/slaves/slavewithdep.py +21 -21
- pythonfmu3/tests/test_builder.py +195 -195
- pythonfmu3/tests/test_deploy.py +48 -48
- pythonfmu3/tests/test_fmi3slave.py +152 -152
- pythonfmu3/tests/test_integration.py +350 -350
- pythonfmu3/tests/test_logger.py +180 -180
- pythonfmu3/tests/test_multiple_fmus.py +141 -141
- pythonfmu3/tests/test_variables.py +334 -334
- pythonfmu3/tests/utils.py +13 -13
- pythonfmu3/unit.py +62 -62
- pythonfmu3/variable_types.py +101 -101
- pythonfmu3/variables.py +400 -400
- pythonfmu3-0.2.2.dist-info/LICENSE → pythonfmu3-0.2.2.2.dist-info/LICENSE.txt +23 -23
- {pythonfmu3-0.2.2.dist-info → pythonfmu3-0.2.2.2.dist-info}/METADATA +9 -6
- pythonfmu3-0.2.2.2.dist-info/RECORD +200 -0
- {pythonfmu3-0.2.2.dist-info → pythonfmu3-0.2.2.2.dist-info}/WHEEL +1 -1
- {pythonfmu3-0.2.2.dist-info → pythonfmu3-0.2.2.2.dist-info}/entry_points.txt +1 -0
- pythonfmu3-0.2.2.dist-info/RECORD +0 -54
- {pythonfmu3-0.2.2.dist-info → pythonfmu3-0.2.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import math
|
|
2
|
-
from pythonfmu3.fmi3slave import Fmi3Slave, Fmi3Causality, Float64, Fmi3Variability
|
|
3
|
-
from localmodule import get_amplitude, get_time_constant
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class PythonSlaveWithDep(Fmi3Slave):
|
|
7
|
-
|
|
8
|
-
def __init__(self, **kwargs):
|
|
9
|
-
super().__init__(**kwargs)
|
|
10
|
-
|
|
11
|
-
self.realIn = 22.0
|
|
12
|
-
self.realOut = 0.0
|
|
13
|
-
self.time = 0
|
|
14
|
-
|
|
15
|
-
self.register_variable(Float64("time", causality=Fmi3Causality.independent, variability=Fmi3Variability.continuous))
|
|
16
|
-
self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
|
|
17
|
-
self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
|
|
18
|
-
|
|
19
|
-
def do_step(self, current_time, step_size):
|
|
20
|
-
self.realOut = self.realIn * get_amplitude() * math.exp((current_time + step_size) / get_time_constant())
|
|
21
|
-
return True
|
|
1
|
+
import math
|
|
2
|
+
from pythonfmu3.fmi3slave import Fmi3Slave, Fmi3Causality, Float64, Fmi3Variability
|
|
3
|
+
from localmodule import get_amplitude, get_time_constant
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PythonSlaveWithDep(Fmi3Slave):
|
|
7
|
+
|
|
8
|
+
def __init__(self, **kwargs):
|
|
9
|
+
super().__init__(**kwargs)
|
|
10
|
+
|
|
11
|
+
self.realIn = 22.0
|
|
12
|
+
self.realOut = 0.0
|
|
13
|
+
self.time = 0
|
|
14
|
+
|
|
15
|
+
self.register_variable(Float64("time", causality=Fmi3Causality.independent, variability=Fmi3Variability.continuous))
|
|
16
|
+
self.register_variable(Float64("realIn", causality=Fmi3Causality.input))
|
|
17
|
+
self.register_variable(Float64("realOut", causality=Fmi3Causality.output))
|
|
18
|
+
|
|
19
|
+
def do_step(self, current_time, step_size):
|
|
20
|
+
self.realOut = self.realIn * get_amplitude() * math.exp((current_time + step_size) / get_time_constant())
|
|
21
|
+
return True
|
pythonfmu3/tests/test_builder.py
CHANGED
|
@@ -1,195 +1,195 @@
|
|
|
1
|
-
import itertools
|
|
2
|
-
import platform
|
|
3
|
-
import tempfile
|
|
4
|
-
import zipfile
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
import pytest
|
|
8
|
-
|
|
9
|
-
import pythonfmu3
|
|
10
|
-
from pythonfmu3.builder import FmuBuilder, get_platform
|
|
11
|
-
|
|
12
|
-
PROJECT_TEST_CASES = [
|
|
13
|
-
("dummy.txt",),
|
|
14
|
-
("dummy.py", "subdir/dummy.txt"),
|
|
15
|
-
("dummy.py", "subdir/dummy.txt", "subdir/dummy2.txt"),
|
|
16
|
-
("dummy.py", "subdir/dummy.txt", "subdir2/dummy2.txt"),
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
lib_extension = ({"Darwin": "dylib", "Linux": "so", "Windows": "dll"}).get(
|
|
21
|
-
platform.system(), None
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def test_zip_content(tmp_path):
|
|
26
|
-
|
|
27
|
-
script_name = "pythonslave.py"
|
|
28
|
-
script_file = Path(__file__).parent / "slaves" / script_name
|
|
29
|
-
fmu = FmuBuilder.build_FMU(script_file, dest=tmp_path)
|
|
30
|
-
assert fmu.exists()
|
|
31
|
-
assert zipfile.is_zipfile(fmu)
|
|
32
|
-
|
|
33
|
-
with zipfile.ZipFile(fmu) as files:
|
|
34
|
-
names = files.namelist()
|
|
35
|
-
|
|
36
|
-
assert "modelDescription.xml" in names
|
|
37
|
-
assert "/".join(("resources", script_name)) in names
|
|
38
|
-
module_file = "/".join(("resources", "slavemodule.txt"))
|
|
39
|
-
assert module_file in names
|
|
40
|
-
|
|
41
|
-
nfiles = 20
|
|
42
|
-
if FmuBuilder.has_binary():
|
|
43
|
-
assert (
|
|
44
|
-
"/".join(("binaries", get_platform(), f"PythonSlave.{lib_extension}"))
|
|
45
|
-
in names
|
|
46
|
-
)
|
|
47
|
-
else:
|
|
48
|
-
nfiles -= 1
|
|
49
|
-
|
|
50
|
-
# Check sources
|
|
51
|
-
src_folder = Path(pythonfmu3.__path__[0]) / "pythonfmu-export"
|
|
52
|
-
for f in itertools.chain(
|
|
53
|
-
src_folder.rglob("*.hpp"),
|
|
54
|
-
src_folder.rglob("*.cpp"),
|
|
55
|
-
src_folder.rglob("CMakeLists.txt"),
|
|
56
|
-
):
|
|
57
|
-
if "build" in f.parts:
|
|
58
|
-
continue
|
|
59
|
-
assert "/".join(("sources", f.relative_to(src_folder).as_posix())) in names
|
|
60
|
-
|
|
61
|
-
# Check pythonfmu is embedded
|
|
62
|
-
pkg_folder = Path(pythonfmu3.__path__[0])
|
|
63
|
-
for f in pkg_folder.rglob("*.py"):
|
|
64
|
-
relative_f = f.relative_to(pkg_folder).as_posix()
|
|
65
|
-
if "test" not in relative_f:
|
|
66
|
-
assert "/".join(("resources", "pythonfmu3", relative_f)) in names
|
|
67
|
-
|
|
68
|
-
assert len(names) >= nfiles # Library + python script + XML + module name + sources
|
|
69
|
-
|
|
70
|
-
with files.open(module_file) as myfile:
|
|
71
|
-
assert myfile.read() == b"pythonslave"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@pytest.mark.parametrize("pfiles", PROJECT_TEST_CASES)
|
|
75
|
-
def test_project_files(tmp_path, pfiles):
|
|
76
|
-
pfiles = map(Path, pfiles)
|
|
77
|
-
script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
78
|
-
def build():
|
|
79
|
-
with tempfile.TemporaryDirectory() as project_dir:
|
|
80
|
-
project_dir = Path(project_dir)
|
|
81
|
-
|
|
82
|
-
project_files = set()
|
|
83
|
-
for f in pfiles:
|
|
84
|
-
full_name = project_dir / f
|
|
85
|
-
if full_name.suffix:
|
|
86
|
-
full_name.parent.mkdir(parents=True, exist_ok=True)
|
|
87
|
-
full_name.write_text("dummy content")
|
|
88
|
-
else:
|
|
89
|
-
full_name.mkdir(parents=True, exist_ok=True)
|
|
90
|
-
|
|
91
|
-
# Add subfolder and not file if common parent exits
|
|
92
|
-
to_remove = None
|
|
93
|
-
for p in project_files:
|
|
94
|
-
if p.parent == full_name.parent or p == full_name.parent:
|
|
95
|
-
to_remove = p
|
|
96
|
-
break
|
|
97
|
-
if to_remove is None:
|
|
98
|
-
project_files.add(full_name)
|
|
99
|
-
else:
|
|
100
|
-
project_files.remove(to_remove)
|
|
101
|
-
project_files.add(full_name.parent)
|
|
102
|
-
|
|
103
|
-
return FmuBuilder.build_FMU(script_file, dest=tmp_path, project_files=project_files)
|
|
104
|
-
|
|
105
|
-
fmu = build()
|
|
106
|
-
with zipfile.ZipFile(fmu) as files:
|
|
107
|
-
names = files.namelist()
|
|
108
|
-
|
|
109
|
-
parents = [p.parent for p in pfiles]
|
|
110
|
-
unique_folders = set(parents)
|
|
111
|
-
common_parents = set()
|
|
112
|
-
if len(unique_folders) < len(parents):
|
|
113
|
-
common_parents = set(filter(lambda f: parents.count(f) > 1, unique_folders))
|
|
114
|
-
|
|
115
|
-
pfiles = map(lambda f: f if f.parent in common_parents else f.name, pfiles)
|
|
116
|
-
|
|
117
|
-
for pfile in pfiles:
|
|
118
|
-
assert f"resources/{pfile!s}" in names
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
@pytest.mark.parametrize("pfiles", PROJECT_TEST_CASES)
|
|
122
|
-
def test_project_files_containing_script(tmp_path, pfiles):
|
|
123
|
-
orig_script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
124
|
-
pfiles = map(Path, pfiles)
|
|
125
|
-
|
|
126
|
-
def build():
|
|
127
|
-
with tempfile.TemporaryDirectory() as project_dir:
|
|
128
|
-
project_dir = Path(project_dir)
|
|
129
|
-
script_file = project_dir / "slave.py"
|
|
130
|
-
with open(orig_script_file) as script_f:
|
|
131
|
-
script_file.write_text(script_f.read())
|
|
132
|
-
|
|
133
|
-
for f in pfiles:
|
|
134
|
-
full_name = project_dir / f
|
|
135
|
-
if full_name.suffix:
|
|
136
|
-
full_name.parent.mkdir(parents=True, exist_ok=True)
|
|
137
|
-
full_name.write_text("dummy content")
|
|
138
|
-
else:
|
|
139
|
-
full_name.mkdir(parents=True, exist_ok=True)
|
|
140
|
-
|
|
141
|
-
return FmuBuilder.build_FMU(
|
|
142
|
-
script_file, dest=tmp_path, project_files=[script_file.parent]
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
fmu = build()
|
|
146
|
-
with zipfile.ZipFile(fmu) as files:
|
|
147
|
-
names = files.namelist()
|
|
148
|
-
|
|
149
|
-
parents = [p.parent for p in pfiles]
|
|
150
|
-
unique_folders = set(parents)
|
|
151
|
-
common_parents = set()
|
|
152
|
-
if len(unique_folders) < len(parents):
|
|
153
|
-
common_parents = set(filter(lambda f: parents.count(f) > 1, unique_folders))
|
|
154
|
-
|
|
155
|
-
pfiles = map(lambda f: f if f.parent in common_parents else f.name, pfiles)
|
|
156
|
-
|
|
157
|
-
for pfile in pfiles:
|
|
158
|
-
assert f"resources/{pfile!s}" in names
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def test_documentation(tmp_path):
|
|
162
|
-
script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
163
|
-
def build():
|
|
164
|
-
with tempfile.TemporaryDirectory() as documentation_dir:
|
|
165
|
-
doc_dir = Path(documentation_dir)
|
|
166
|
-
license_file = doc_dir / "licenses" / "license.txt"
|
|
167
|
-
license_file.parent.mkdir()
|
|
168
|
-
license_file.write_text("Dummy license")
|
|
169
|
-
index_file = doc_dir / "index.html"
|
|
170
|
-
index_file.write_text("dummy index")
|
|
171
|
-
return FmuBuilder.build_FMU(script_file, dest=tmp_path, documentation_folder=doc_dir)
|
|
172
|
-
|
|
173
|
-
fmu = build()
|
|
174
|
-
with zipfile.ZipFile(fmu) as files:
|
|
175
|
-
names = files.namelist()
|
|
176
|
-
|
|
177
|
-
assert "documentation/index.html" in names
|
|
178
|
-
assert "documentation/licenses/license.txt" in names
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
def test_terminals(tmp_path):
|
|
182
|
-
script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
183
|
-
def build():
|
|
184
|
-
with tempfile.TemporaryDirectory() as terminals_dir:
|
|
185
|
-
terminals_dir = Path(terminals_dir)
|
|
186
|
-
terminals = terminals_dir / "terminalsAndIcons.xml"
|
|
187
|
-
terminals.write_text("Dummy Terminal 1")
|
|
188
|
-
|
|
189
|
-
return FmuBuilder.build_FMU(script_file, dest=tmp_path, terminals=terminals)
|
|
190
|
-
|
|
191
|
-
fmu = build()
|
|
192
|
-
with zipfile.ZipFile(fmu) as files:
|
|
193
|
-
names = files.namelist()
|
|
194
|
-
|
|
195
|
-
assert "terminalsAndIcons/terminalsAndIcons.xml" in names
|
|
1
|
+
import itertools
|
|
2
|
+
import platform
|
|
3
|
+
import tempfile
|
|
4
|
+
import zipfile
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
import pythonfmu3
|
|
10
|
+
from pythonfmu3.builder import FmuBuilder, get_platform
|
|
11
|
+
|
|
12
|
+
PROJECT_TEST_CASES = [
|
|
13
|
+
("dummy.txt",),
|
|
14
|
+
("dummy.py", "subdir/dummy.txt"),
|
|
15
|
+
("dummy.py", "subdir/dummy.txt", "subdir/dummy2.txt"),
|
|
16
|
+
("dummy.py", "subdir/dummy.txt", "subdir2/dummy2.txt"),
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
lib_extension = ({"Darwin": "dylib", "Linux": "so", "Windows": "dll"}).get(
|
|
21
|
+
platform.system(), None
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_zip_content(tmp_path):
|
|
26
|
+
|
|
27
|
+
script_name = "pythonslave.py"
|
|
28
|
+
script_file = Path(__file__).parent / "slaves" / script_name
|
|
29
|
+
fmu = FmuBuilder.build_FMU(script_file, dest=tmp_path)
|
|
30
|
+
assert fmu.exists()
|
|
31
|
+
assert zipfile.is_zipfile(fmu)
|
|
32
|
+
|
|
33
|
+
with zipfile.ZipFile(fmu) as files:
|
|
34
|
+
names = files.namelist()
|
|
35
|
+
|
|
36
|
+
assert "modelDescription.xml" in names
|
|
37
|
+
assert "/".join(("resources", script_name)) in names
|
|
38
|
+
module_file = "/".join(("resources", "slavemodule.txt"))
|
|
39
|
+
assert module_file in names
|
|
40
|
+
|
|
41
|
+
nfiles = 20
|
|
42
|
+
if FmuBuilder.has_binary():
|
|
43
|
+
assert (
|
|
44
|
+
"/".join(("binaries", get_platform(), f"PythonSlave.{lib_extension}"))
|
|
45
|
+
in names
|
|
46
|
+
)
|
|
47
|
+
else:
|
|
48
|
+
nfiles -= 1
|
|
49
|
+
|
|
50
|
+
# Check sources
|
|
51
|
+
src_folder = Path(pythonfmu3.__path__[0]) / "pythonfmu-export"
|
|
52
|
+
for f in itertools.chain(
|
|
53
|
+
src_folder.rglob("*.hpp"),
|
|
54
|
+
src_folder.rglob("*.cpp"),
|
|
55
|
+
src_folder.rglob("CMakeLists.txt"),
|
|
56
|
+
):
|
|
57
|
+
if "build" in f.parts:
|
|
58
|
+
continue
|
|
59
|
+
assert "/".join(("sources", f.relative_to(src_folder).as_posix())) in names
|
|
60
|
+
|
|
61
|
+
# Check pythonfmu is embedded
|
|
62
|
+
pkg_folder = Path(pythonfmu3.__path__[0])
|
|
63
|
+
for f in pkg_folder.rglob("*.py"):
|
|
64
|
+
relative_f = f.relative_to(pkg_folder).as_posix()
|
|
65
|
+
if "test" not in relative_f:
|
|
66
|
+
assert "/".join(("resources", "pythonfmu3", relative_f)) in names
|
|
67
|
+
|
|
68
|
+
assert len(names) >= nfiles # Library + python script + XML + module name + sources
|
|
69
|
+
|
|
70
|
+
with files.open(module_file) as myfile:
|
|
71
|
+
assert myfile.read() == b"pythonslave"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@pytest.mark.parametrize("pfiles", PROJECT_TEST_CASES)
|
|
75
|
+
def test_project_files(tmp_path, pfiles):
|
|
76
|
+
pfiles = map(Path, pfiles)
|
|
77
|
+
script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
78
|
+
def build():
|
|
79
|
+
with tempfile.TemporaryDirectory() as project_dir:
|
|
80
|
+
project_dir = Path(project_dir)
|
|
81
|
+
|
|
82
|
+
project_files = set()
|
|
83
|
+
for f in pfiles:
|
|
84
|
+
full_name = project_dir / f
|
|
85
|
+
if full_name.suffix:
|
|
86
|
+
full_name.parent.mkdir(parents=True, exist_ok=True)
|
|
87
|
+
full_name.write_text("dummy content")
|
|
88
|
+
else:
|
|
89
|
+
full_name.mkdir(parents=True, exist_ok=True)
|
|
90
|
+
|
|
91
|
+
# Add subfolder and not file if common parent exits
|
|
92
|
+
to_remove = None
|
|
93
|
+
for p in project_files:
|
|
94
|
+
if p.parent == full_name.parent or p == full_name.parent:
|
|
95
|
+
to_remove = p
|
|
96
|
+
break
|
|
97
|
+
if to_remove is None:
|
|
98
|
+
project_files.add(full_name)
|
|
99
|
+
else:
|
|
100
|
+
project_files.remove(to_remove)
|
|
101
|
+
project_files.add(full_name.parent)
|
|
102
|
+
|
|
103
|
+
return FmuBuilder.build_FMU(script_file, dest=tmp_path, project_files=project_files)
|
|
104
|
+
|
|
105
|
+
fmu = build()
|
|
106
|
+
with zipfile.ZipFile(fmu) as files:
|
|
107
|
+
names = files.namelist()
|
|
108
|
+
|
|
109
|
+
parents = [p.parent for p in pfiles]
|
|
110
|
+
unique_folders = set(parents)
|
|
111
|
+
common_parents = set()
|
|
112
|
+
if len(unique_folders) < len(parents):
|
|
113
|
+
common_parents = set(filter(lambda f: parents.count(f) > 1, unique_folders))
|
|
114
|
+
|
|
115
|
+
pfiles = map(lambda f: f if f.parent in common_parents else f.name, pfiles)
|
|
116
|
+
|
|
117
|
+
for pfile in pfiles:
|
|
118
|
+
assert f"resources/{pfile!s}" in names
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@pytest.mark.parametrize("pfiles", PROJECT_TEST_CASES)
|
|
122
|
+
def test_project_files_containing_script(tmp_path, pfiles):
|
|
123
|
+
orig_script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
124
|
+
pfiles = map(Path, pfiles)
|
|
125
|
+
|
|
126
|
+
def build():
|
|
127
|
+
with tempfile.TemporaryDirectory() as project_dir:
|
|
128
|
+
project_dir = Path(project_dir)
|
|
129
|
+
script_file = project_dir / "slave.py"
|
|
130
|
+
with open(orig_script_file) as script_f:
|
|
131
|
+
script_file.write_text(script_f.read())
|
|
132
|
+
|
|
133
|
+
for f in pfiles:
|
|
134
|
+
full_name = project_dir / f
|
|
135
|
+
if full_name.suffix:
|
|
136
|
+
full_name.parent.mkdir(parents=True, exist_ok=True)
|
|
137
|
+
full_name.write_text("dummy content")
|
|
138
|
+
else:
|
|
139
|
+
full_name.mkdir(parents=True, exist_ok=True)
|
|
140
|
+
|
|
141
|
+
return FmuBuilder.build_FMU(
|
|
142
|
+
script_file, dest=tmp_path, project_files=[script_file.parent]
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
fmu = build()
|
|
146
|
+
with zipfile.ZipFile(fmu) as files:
|
|
147
|
+
names = files.namelist()
|
|
148
|
+
|
|
149
|
+
parents = [p.parent for p in pfiles]
|
|
150
|
+
unique_folders = set(parents)
|
|
151
|
+
common_parents = set()
|
|
152
|
+
if len(unique_folders) < len(parents):
|
|
153
|
+
common_parents = set(filter(lambda f: parents.count(f) > 1, unique_folders))
|
|
154
|
+
|
|
155
|
+
pfiles = map(lambda f: f if f.parent in common_parents else f.name, pfiles)
|
|
156
|
+
|
|
157
|
+
for pfile in pfiles:
|
|
158
|
+
assert f"resources/{pfile!s}" in names
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def test_documentation(tmp_path):
|
|
162
|
+
script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
163
|
+
def build():
|
|
164
|
+
with tempfile.TemporaryDirectory() as documentation_dir:
|
|
165
|
+
doc_dir = Path(documentation_dir)
|
|
166
|
+
license_file = doc_dir / "licenses" / "license.txt"
|
|
167
|
+
license_file.parent.mkdir()
|
|
168
|
+
license_file.write_text("Dummy license")
|
|
169
|
+
index_file = doc_dir / "index.html"
|
|
170
|
+
index_file.write_text("dummy index")
|
|
171
|
+
return FmuBuilder.build_FMU(script_file, dest=tmp_path, documentation_folder=doc_dir)
|
|
172
|
+
|
|
173
|
+
fmu = build()
|
|
174
|
+
with zipfile.ZipFile(fmu) as files:
|
|
175
|
+
names = files.namelist()
|
|
176
|
+
|
|
177
|
+
assert "documentation/index.html" in names
|
|
178
|
+
assert "documentation/licenses/license.txt" in names
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_terminals(tmp_path):
|
|
182
|
+
script_file = Path(__file__).parent / "slaves/pythonslave.py"
|
|
183
|
+
def build():
|
|
184
|
+
with tempfile.TemporaryDirectory() as terminals_dir:
|
|
185
|
+
terminals_dir = Path(terminals_dir)
|
|
186
|
+
terminals = terminals_dir / "terminalsAndIcons.xml"
|
|
187
|
+
terminals.write_text("Dummy Terminal 1")
|
|
188
|
+
|
|
189
|
+
return FmuBuilder.build_FMU(script_file, dest=tmp_path, terminals=terminals)
|
|
190
|
+
|
|
191
|
+
fmu = build()
|
|
192
|
+
with zipfile.ZipFile(fmu) as files:
|
|
193
|
+
names = files.namelist()
|
|
194
|
+
|
|
195
|
+
assert "terminalsAndIcons/terminalsAndIcons.xml" in names
|
pythonfmu3/tests/test_deploy.py
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from tempfile import TemporaryDirectory
|
|
3
|
-
from unittest.mock import patch
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
from pythonfmu3.builder import FmuBuilder
|
|
8
|
-
from pythonfmu3.deploy import deploy
|
|
9
|
-
|
|
10
|
-
PYTHON_SLAVE = Path(__file__).parent / "slaves/pythonslave.py"
|
|
11
|
-
|
|
12
|
-
@pytest.mark.parametrize("test_manager", [None, "pip", "conda"])
|
|
13
|
-
@pytest.mark.parametrize(
|
|
14
|
-
"requirements, test_requirements, expected", [
|
|
15
|
-
(None, None, ValueError),
|
|
16
|
-
(None, "requirements.txt", ValueError),
|
|
17
|
-
(None, "environment.yaml", ValueError),
|
|
18
|
-
("requirements.txt", None, "pip"),
|
|
19
|
-
("environment.yaml", None, "conda"),
|
|
20
|
-
("environment.yml", None, "conda"),
|
|
21
|
-
("req.txt", "req.txt", "pip"),
|
|
22
|
-
("env.yml", "env.yml", "conda"),
|
|
23
|
-
]
|
|
24
|
-
)
|
|
25
|
-
def test_deploy(tmp_path, test_manager, requirements, test_requirements, expected):
|
|
26
|
-
|
|
27
|
-
dummy_requirements = """numpy=1.16
|
|
28
|
-
scipy
|
|
29
|
-
"""
|
|
30
|
-
if requirements is not None:
|
|
31
|
-
with TemporaryDirectory() as tempd:
|
|
32
|
-
requirements_file = Path(tempd) / requirements
|
|
33
|
-
requirements_file.write_text(dummy_requirements)
|
|
34
|
-
fmu = FmuBuilder.build_FMU(PYTHON_SLAVE, dest=tmp_path, project_files=[requirements_file, ])
|
|
35
|
-
else:
|
|
36
|
-
fmu = FmuBuilder.build_FMU(PYTHON_SLAVE, dest=tmp_path)
|
|
37
|
-
assert fmu.exists()
|
|
38
|
-
|
|
39
|
-
with patch("subprocess.run") as run:
|
|
40
|
-
if isinstance(expected, type) and issubclass(expected, Exception):
|
|
41
|
-
with pytest.raises(expected):
|
|
42
|
-
deploy(fmu, environment=test_requirements, package_manager=test_manager)
|
|
43
|
-
run.assert_not_called()
|
|
44
|
-
else:
|
|
45
|
-
deploy(fmu, environment=test_requirements, package_manager=test_manager)
|
|
46
|
-
|
|
47
|
-
run.assert_called_once()
|
|
48
|
-
assert (test_manager or expected) in " ".join(run.call_args[0][0])
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from tempfile import TemporaryDirectory
|
|
3
|
+
from unittest.mock import patch
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from pythonfmu3.builder import FmuBuilder
|
|
8
|
+
from pythonfmu3.deploy import deploy
|
|
9
|
+
|
|
10
|
+
PYTHON_SLAVE = Path(__file__).parent / "slaves/pythonslave.py"
|
|
11
|
+
|
|
12
|
+
@pytest.mark.parametrize("test_manager", [None, "pip", "conda"])
|
|
13
|
+
@pytest.mark.parametrize(
|
|
14
|
+
"requirements, test_requirements, expected", [
|
|
15
|
+
(None, None, ValueError),
|
|
16
|
+
(None, "requirements.txt", ValueError),
|
|
17
|
+
(None, "environment.yaml", ValueError),
|
|
18
|
+
("requirements.txt", None, "pip"),
|
|
19
|
+
("environment.yaml", None, "conda"),
|
|
20
|
+
("environment.yml", None, "conda"),
|
|
21
|
+
("req.txt", "req.txt", "pip"),
|
|
22
|
+
("env.yml", "env.yml", "conda"),
|
|
23
|
+
]
|
|
24
|
+
)
|
|
25
|
+
def test_deploy(tmp_path, test_manager, requirements, test_requirements, expected):
|
|
26
|
+
|
|
27
|
+
dummy_requirements = """numpy=1.16
|
|
28
|
+
scipy
|
|
29
|
+
"""
|
|
30
|
+
if requirements is not None:
|
|
31
|
+
with TemporaryDirectory() as tempd:
|
|
32
|
+
requirements_file = Path(tempd) / requirements
|
|
33
|
+
requirements_file.write_text(dummy_requirements)
|
|
34
|
+
fmu = FmuBuilder.build_FMU(PYTHON_SLAVE, dest=tmp_path, project_files=[requirements_file, ])
|
|
35
|
+
else:
|
|
36
|
+
fmu = FmuBuilder.build_FMU(PYTHON_SLAVE, dest=tmp_path)
|
|
37
|
+
assert fmu.exists()
|
|
38
|
+
|
|
39
|
+
with patch("subprocess.run") as run:
|
|
40
|
+
if isinstance(expected, type) and issubclass(expected, Exception):
|
|
41
|
+
with pytest.raises(expected):
|
|
42
|
+
deploy(fmu, environment=test_requirements, package_manager=test_manager)
|
|
43
|
+
run.assert_not_called()
|
|
44
|
+
else:
|
|
45
|
+
deploy(fmu, environment=test_requirements, package_manager=test_manager)
|
|
46
|
+
|
|
47
|
+
run.assert_called_once()
|
|
48
|
+
assert (test_manager or expected) in " ".join(run.call_args[0][0])
|