58
58
QGIS_APP = start_app ()
59
59
60
60
LONG_LOADING_TIME = 10 # seconds
61
- ONLY_OUTPUT_TYPE = os .environ .get ('ONLY_OUTPUT_TYPE' )
61
+ ONLY_OUTPUT_TYPE = (
62
+ False if os .environ .get ('ONLY_OUTPUT_TYPE' ) != '1' else True )
63
+ OQ_CHECK_MISSING_OUTPUTS = (
64
+ False if os .environ .get ('OQ_CHECK_MISSING_OUTPUTS' ) != '1' else True )
65
+ OQ_TEST_RUN_CALC = (
66
+ False if os .environ .get ('OQ_TEST_RUN_CALC' ) != '1' else True )
62
67
63
68
64
69
def run_all ():
70
+ print (f'{ ONLY_OUTPUT_TYPE = } ' )
71
+ print (f'{ OQ_CHECK_MISSING_OUTPUTS = } ' )
72
+ print (f'{ OQ_TEST_RUN_CALC = } ' )
65
73
suite = unittest .TestSuite ()
66
74
# OQ_CSV_TO_LAYER_TYPES
67
75
suite .addTest (unittest .makeSuite (LoadAggRiskTestCase , 'test' ))
@@ -142,7 +150,7 @@ def setUpClass(cls):
142
150
if cls .only_calc_id is not None :
143
151
cls .calc_list = [calc for calc in cls .calc_list
144
152
if calc ['id' ] == cls .only_calc_id ]
145
- cls .only_output_type = os . environ . get ( ' ONLY_OUTPUT_TYPE' )
153
+ cls .only_output_type = ONLY_OUTPUT_TYPE
146
154
if not cls .only_output_type :
147
155
print ('ONLY_OUTPUT_TYPE was not set. Running tests for all'
148
156
' the available output types' )
@@ -928,10 +936,11 @@ class AllLoadableOutputsFoundInDemosTestCase(LoadOqEngineOutputsTestCase):
928
936
'only testing output type %s' % ONLY_OUTPUT_TYPE )
929
937
def test_all_loadable_output_types_found_in_demos (self ):
930
938
self .list_calculations_and_outputs ()
931
- if self .only_calc_id or self .only_output_type :
932
- print ('Skipping test checking if all loadable outputs are found'
933
- ' in demos' )
934
- return
939
+ if (self .only_calc_id or self .only_output_type
940
+ or not OQ_CHECK_MISSING_OUTPUTS ):
941
+ self .skipTest (
942
+ 'Skipping test checking if all loadable outputs are found'
943
+ ' in demos' )
935
944
loadable_output_types_found = set ()
936
945
loadable_output_types_not_found = set ()
937
946
for loadable_output_type in OQ_ALL_TYPES :
@@ -982,8 +991,8 @@ class AllLoadersAreImplementedTestCase(LoadOqEngineOutputsTestCase):
982
991
def test_all_loaders_are_implemented (self ):
983
992
self .list_calculations_and_outputs ()
984
993
if self .only_calc_id or self .only_output_type :
985
- print ( 'Skipping test checking if any loaders are not implemented' )
986
- return
994
+ self . skipTest (
995
+ 'Skipping test checking if any loaders are not implemented' )
987
996
not_implemented_loaders = set ()
988
997
for calc in self .calc_list :
989
998
for output in self .output_list [calc ['id' ]]:
@@ -1002,9 +1011,9 @@ class RunCalculationTestCase(LoadOqEngineOutputsTestCase):
1002
1011
@unittest .skipIf (ONLY_OUTPUT_TYPE ,
1003
1012
'only testing output type %s' % ONLY_OUTPUT_TYPE )
1004
1013
def test_run_calculation (self ):
1005
- if self .only_calc_id or self .only_output_type :
1006
- print ( 'Skipping test running a new calculation' )
1007
- return
1014
+ if ( self .only_calc_id or self .only_output_type
1015
+ or not OQ_TEST_RUN_CALC ):
1016
+ self . skipTest ( 'Skipping test running a new calculation' )
1008
1017
risk_demos_path = os .path .join (
1009
1018
os .pardir , 'oq-engine' , 'demos' , 'risk' )
1010
1019
risk_demos_dirs = glob .glob (os .path .join (risk_demos_path , "*" , "" ))
0 commit comments