winIDEA SDK
test_coverage_save.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6
7import isystem.connect as ic
8
9
10winidea_id = ''
11
12
13def test_save():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16
17 DOC_NAME = "test_save.trd"
18 covCtrl = ic.CCoverageController2(connMgr, DOC_NAME, "w")
19 wksFolder = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_DIR)
20 filePath = os.path.join(wksFolder, DOC_NAME)
21
22 covCtrl.save()
23 print(f"Document '{DOC_NAME}' saved: {filePath}")
24
25 covCtrl.saveAs(filePath, True)
26 print(f"Document '{DOC_NAME}' forcibly overwritten (saved): {filePath}")
27
28 DOC_NAME_2 = "test_save_2.trd"
29 newFilePath = os.path.join(wksFolder, DOC_NAME_2)
30 covCtrl.saveCopy(DOC_NAME_2)
31 print(f"A copy of document '{DOC_NAME}' saved to: {newFilePath}")
32
33 print(f"Optionally, user can save document with prompt by using '.saveAsPrompt()' function.")
34
35
36if __name__ == "__main__":
37 test_save()