winIDEA SDK
test_export_import_project.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6import tempfile
7
8import isystem.connect as ic
9
10
11winidea_id = ''
12
13
14def test_exportImportProject():
15 connMgr = ic.ConnectionMgr()
16 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
17
18 projCtrl = ic.CProjectController(connMgr)
19
20 with tempfile.TemporaryDirectory() as tmpDir:
21 tmpFilePath = os.path.join(tmpDir, "proj.xml")
22
23 print(f"Exporting project to XML: {tmpFilePath}")
24 if projCtrl.exportProject(tmpFilePath) == -1:
25 print(f"\tWarnings: {projCtrl.getWarningMessage()}")
26
27 print(f"Importing project from XML: {tmpFilePath}")
28 if projCtrl.exportProject(tmpFilePath) == -1:
29 print(f"\tWarnings: {projCtrl.getWarningMessage()}")
30
31
32if __name__ == "__main__":
33 test_exportImportProject()