Explorar el Código

publish conditions implemented

master
Dirk Alders hace 3 años
padre
commit
5417bf1cba
Se han modificado 3 ficheros con 38 adiciones y 18 borrados
  1. 8
    4
      jsonlog.py
  2. 2
    0
      output.py
  3. 28
    14
      run.py

+ 8
- 4
jsonlog.py Ver fichero

@@ -4,10 +4,11 @@
4 4
 
5 5
 import json
6 6
 import os
7
+import report
7 8
 import subprocess
8 9
 
9 10
 import fstools
10
-from unittest.output import STATUS_AVAILABLE, STATUS_CHANGED, STATUS_CLEAN, STATUS_EXISTS, STATUS_FAILED, STATUS_IN_WORK, STATUS_MISSING, STATUS_OLD, STATUS_RELEASED, STATUS_UNKNOWN
11
+from unittest.output import STATUS_AVAILABLE, STATUS_CHANGED, STATUS_CLEAN, STATUS_EXISTS, STATUS_FAILED, STATUS_IN_WORK, STATUS_MISSING, STATUS_OLD, STATUS_RELEASED, STATUS_UNKNOWN, STATUS_INCOMPLETE
11 12
 
12 13
 JSONLOG_FNAME = 'unittest.json'
13 14
 
@@ -65,6 +66,7 @@ TOBI_VERSION = "Version"
65 66
 # SUBKEYS FOR MAIN_KEY_TESTRUNS
66 67
 #
67 68
 TRUN_TESTCASES = 'testcases'
69
+TRUN_EXEC_LVL = 'testcase_execution_level'
68 70
 #
69 71
 # SUBKEYS FOR MAIN_KEY_UNITTEST_INFO
70 72
 #
@@ -123,12 +125,14 @@ def __get_release_state__(ut_folder, lib):
123 125
         return STATUS_MISSING
124 126
     else:
125 127
         ut_status = ut_data.get(MAIN_KEY_TESTOBJECT_INFO, {}).get(TOBI_STATE, 'unknown')
126
-        if ut_status == TOBI_STATE_RELEASED:
128
+        ut_level = ut_data.get(MAIN_KEY_TESTRUNS, [{}, {}])[0].get(TRUN_EXEC_LVL, report.TCEL_SINGLE)
129
+        if ut_status == TOBI_STATE_RELEASED and ut_level == report.TCEL_FULL:
127 130
             return STATUS_RELEASED
128
-        elif ut_status == TOBI_STATE_IN_DEVELOPMENT:
131
+        elif ut_status != TOBI_STATE_RELEASED:
129 132
             return STATUS_IN_WORK
133
+        elif ut_level != report.TCEL_FULL:
134
+            return STATUS_INCOMPLETE
130 135
         else:
131
-            print(ut_status)
132 136
             return STATUS_UNKNOWN
133 137
 
134 138
 

+ 2
- 0
output.py Ver fichero

@@ -14,6 +14,7 @@ STATUS_CHANGED = 'CHANGED'
14 14
 STATUS_EXISTS = 'EXISTS'
15 15
 STATUS_IN_WORK = 'IN_WORK'
16 16
 STATUS_OLD = 'OLD'
17
+STATUS_INCOMPLETE = 'INCOMPLETE'
17 18
 #
18 19
 STATUS_FAILED = 'FAILED'
19 20
 STATUS_MISSING = 'MISSING'
@@ -41,6 +42,7 @@ STATUS_COLORS = {
41 42
     STATUS_EXISTS: termcolors.WARNING,
42 43
     STATUS_IN_WORK: termcolors.WARNING,
43 44
     STATUS_OLD: termcolors.WARNING,
45
+    STATUS_INCOMPLETE: termcolors.WARNING,
44 46
     #
45 47
     STATUS_FAILED: termcolors.FAIL,
46 48
     STATUS_MISSING: termcolors.FAIL,

+ 28
- 14
run.py Ver fichero

@@ -325,21 +325,35 @@ def unittest_finalise(ut_folder):
325 325
 
326 326
 def unittest_publish(ut_folder):
327 327
     config = imp.load_source('', jsonlog.get_ut_config(ut_folder))
328
-    #
329
-    output.print_header('Copy unittest files to library')
330
-    target_folder = os.path.join(config.lib_path, '_testresults_')
331
-    output.print_action('Copying Unittest Files to  %s' % target_folder)
332
-    if not os.path.exists(target_folder):
333
-        output.print_info('Creating folder %s' % target_folder)
334
-        fstools.mkdir(target_folder)
328
+    output.print_header('Checking testrun state')
329
+    output.print_action('Release State...')
330
+    rs = jsonlog.get_ut_release_state(ut_folder)
331
+    output.print_info(rs)
332
+    output.print_action('Testcase Integrity...')
333
+    tci = jsonlog.get_ut_testcase_integrity(ut_folder)
334
+    output.print_info(tci)
335
+    output.print_action('Source Integrity...')
336
+    sri = jsonlog.get_ut_src_integrity(ut_folder)
337
+    output.print_info(sri)
338
+
339
+    if rs == jsonlog.STATUS_RELEASED and tci == jsonlog.STATUS_CLEAN and sri == jsonlog.STATUS_CLEAN:
340
+        output.print_header('Copy unittest files to library')
341
+        target_folder = os.path.join(config.lib_path, '_testresults_')
342
+        output.print_action('Copying Unittest Files to  %s' % target_folder)
343
+        if not os.path.exists(target_folder):
344
+            output.print_info('Creating folder %s' % target_folder)
345
+            fstools.mkdir(target_folder)
346
+        else:
347
+            for fn in os.listdir(target_folder):
348
+                remove_file(os.path.join(target_folder, fn))
349
+        for fn in REPORT_FILES:
350
+            src = testresults_filename(ut_folder, fn)
351
+            dst = os.path.join(target_folder, fn)
352
+            output.print_info('copying %s -> %s' % (src, dst))
353
+            shutil.copyfile(src, dst)
335 354
     else:
336
-        for fn in os.listdir(target_folder):
337
-            remove_file(os.path.join(target_folder, fn))
338
-    for fn in REPORT_FILES:
339
-        src = testresults_filename(ut_folder, fn)
340
-        dst = os.path.join(target_folder, fn)
341
-        output.print_info('copying %s -> %s' % (src, dst))
342
-        shutil.copyfile(src, dst)
355
+        output.print_action('Proceed Conditions...')
356
+        output.print_info(output.STATUS_FAILED)
343 357
 
344 358
 
345 359
 def unittest_status(ut_folder):

Loading…
Cancelar
Guardar