Skip to content

Commit 908bf95

Browse files
committed
Updates for added raise steps to do version protection.
1 parent 12210b4 commit 908bf95

14 files changed

+33
-304
lines changed

src/main/resources/scripts/cobertura.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
try:
2727
from vector.apps.DataAPI.vcproject_api import VCProjectApi
2828
from vector.apps.DataAPI.vcproject_models import VCProject
29+
from vector.apps.DataAPI.cover_api import CoverApi
2930
except:
3031
pass
31-
from vector.apps.DataAPI.cover_api import CoverApi
3232
try:
3333
from vector.apps.DataAPI.unit_test_api import UnitTestApi
3434
except:
@@ -768,7 +768,8 @@ def generateCoverageResults(inFile, azure = False, xml_data_dir = "xml_data", ve
768768
if __name__ == '__main__':
769769

770770
if not checkVectorCASTVersion(21):
771-
raise ImportError ("Cannot create Cobertura metrics. Please upgrade VectorCAST")
771+
print ("Cannot create Cobertura metrics. Please upgrade VectorCAST")
772+
sys.exit(0)
772773

773774
parser = argparse.ArgumentParser()
774775
parser.add_argument('ManageProject', help='Manager Project Name')

src/main/resources/scripts/generate-results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def buildReports(FullManageProjectName = None,
507507

508508
# make sure the project exists
509509
if not os.path.isfile(FullManageProjectName) and not os.path.isfile(FullManageProjectName + ".vcm"):
510-
raise IOError(FullManageProjectName + ' does not exist')
510+
raise FileNotFoundError(FullManageProjectName + ' does not exist')
511511
return
512512

513513
manageProjectName = os.path.splitext(os.path.basename(FullManageProjectName))[0]

src/main/resources/scripts/generate_lcov.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
try:
2727
from vector.apps.DataAPI.vcproject_api import VCProjectApi
2828
from vector.apps.DataAPI.vcproject_models import VCProject
29+
from vector.apps.DataAPI.cover_api import CoverApi
2930
except:
3031
pass
3132
try:
3233
from vector.apps.DataAPI.unit_test_api import UnitTestApi
3334
except:
3435
from vector.apps.DataAPI.api import Api as UnitTestApi
3536

36-
from vector.apps.DataAPI.cover_api import CoverApi
3737
import sys, os
3838
from collections import defaultdict
3939
from pprint import pprint
@@ -346,7 +346,8 @@ def generateCoverageResults(inFile, xml_data_dir = "xml_data", verbose = False,
346346
if __name__ == '__main__':
347347

348348
if not checkVectorCASTVersion(21):
349-
raise ImportError("Cannot create LCOV metrics. Please upgrade VectorCAST")
349+
print("Cannot create LCOV metrics. Please upgrade VectorCAST")
350+
sys.exit(0)
350351

351352
parser = argparse.ArgumentParser()
352353
parser.add_argument('vcProjectName', help='VectorCAST Project Name', action="store")

src/main/resources/scripts/generate_sonarqube_testresults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545

4646
try:
4747
from vector.apps.DataAPI.vcproject_api import VCProjectApi
48+
from vector.apps.DataAPI.cover_api import CoverApi
4849
except:
4950
pass
5051

5152
from vector.enums import ENVIRONMENT_STATUS_TYPE_T
5253

53-
from vector.apps.DataAPI.cover_api import CoverApi
5454
try:
5555
from vector.apps.ReportBuilder.custom_report import fmt_percent
5656
except:

src/main/resources/scripts/generate_xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444

4545
try:
4646
from vector.apps.DataAPI.vcproject_api import VCProjectApi
47+
from vector.apps.DataAPI.cover_api import CoverApi
4748
except:
4849
pass
4950

50-
from vector.apps.DataAPI.cover_api import CoverApi
5151
try:
5252
from vector.apps.ReportBuilder.custom_report import fmt_percent
5353
except:

src/main/resources/scripts/getjobs.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,8 @@ def printEnvInfoNoDataAPI(ManageProjectName, printData = True, printEnvType = Fa
227227

228228
return output
229229

230-
def printEnvironmentInfo(ManageProjectName, printData = True, printEnvType = False, legacy = False):
230+
def printEnvironmentInfo(ManageProjectName, printData = True, printEnvType = False):
231231
try:
232-
if (legacy): raise KeyError
233-
234232
from vector.apps.DataAPI.vcproject_api import VCProjectApi
235233
with VCProjectApi(ManageProjectName) as vcproj:
236234
ret_info = printEnvInfoDataAPI(vcproj, printData, printEnvType)
@@ -246,8 +244,7 @@ def printEnvironmentInfo(ManageProjectName, printData = True, printEnvType = Fal
246244
parser = argparse.ArgumentParser()
247245
parser.add_argument('ManageProject', help='Manager Project Name')
248246
parser.add_argument('-t', '--type', help='Displays the type of environemnt (Unit test or System test)', action="store_true", default = False)
249-
parser.add_argument('-l', '--legacy', help='Use the legacy report parsing method - testing only)', action="store_true", default = False)
250247

251248
args = parser.parse_args()
252249

253-
printEnvironmentInfo(args.ManageProject, True, args.type, args.legacy)
250+
printEnvironmentInfo(args.ManageProject, True, args.type)

src/main/resources/scripts/incremental_build_report_aggregator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def log(msg, level="info"):
189189
log("[INFO] Retrying parse with original encoding fallback.")
190190

191191
if len(main_soup.find_all('table')) < 1:
192-
raise Exception("No <table> elements found in {}".format(current_file))
192+
raise LookupError("No <table> elements found in {}".format(current_file))
193193

194194
if main_soup.find(id="report-title"):
195195
main_manage_api_report = True

src/main/resources/scripts/parallel_full_reports.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131

3232
encFmt = getVectorCASTEncoding()
3333

34-
if not checkVectorCASTVersion(20, quiet = True):
35-
raise ImportError("Full reports generated by previous call to generate-results.py")
34+
if not checkVectorCASTVersion(20, quiet = False):
35+
if __name__ != "__main__":
36+
raise ImportError("Full reports generated by previous call to generate-results.py")
37+
else:
38+
print("Full reports generated by previous call to generate-results.py")
39+
sys.exit(0)
40+
3641
else:
3742
import multiprocessing
3843
from vector.apps.DataAPI.unit_test_api import UnitTestApi

src/main/resources/scripts/parse_traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ def parse(tb, print_exc = False, compiler = "Compiler" , testsuite = "TestSuite"
6161

6262
import traceback
6363
try:
64-
raise TypeError
64+
raise UserWarning("This is a test warning")
6565
except:
6666
parse(traceback.format_exc(), False, "Compiler" , "testsuite", "env", "build_dir")

src/main/resources/scripts/patch_rgw_directory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def getReqRepo(VC_Manage_Project):
1919
break
2020

2121
if reqRepoDir is None:
22-
raise("Requirements Repository Directory not set")
22+
raise EnvironmentError("Requirements Repository Directory not set")
2323

2424
reqRepoDir = reqRepoDir.replace("\\","/").strip()
2525

@@ -41,7 +41,7 @@ def updateReqRepo(VC_Manage_Project, VC_Workspace, top_level):
4141
newPath = os.path.join(VC_Workspace, reqRepoDir.replace(basePath,"")).replace("\\","/")
4242

4343
if not os.path.exists(newPath):
44-
raise Exception("Patch ReqRepo Path " + newPath + " not found")
44+
raise FileNotFoundError("Patch ReqRepo Path " + newPath + " not found")
4545

4646
command_line= "--project \"" + VC_Manage_Project + "\" --config VCAST_REPOSITORY=\"" + newPath + "\""
4747
manageWait = ManageWait(False, command_line, 30, 1)

0 commit comments

Comments
 (0)