|
@@ -7,7 +7,7 @@ import os
|
7
|
7
|
import subprocess
|
8
|
8
|
|
9
|
9
|
import fstools
|
10
|
|
-from unittest.output import STATUS_AVAILABLE, STATUS_CHANGED, STATUS_CLEAN, STATUS_EXISTS, STATUS_IN_WORK, STATUS_MISSING, STATUS_OLD, STATUS_RELEASED, STATUS_UNKNOWN
|
|
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
|
11
|
|
12
|
12
|
JSONLOG_FNAME = 'unittest.json'
|
13
|
13
|
|
|
@@ -57,7 +57,7 @@ TOBI_DEPENDENCIES = "Dependencies"
|
57
|
57
|
TOBI_DESCRIPTION = "Description"
|
58
|
58
|
TOBI_NAME = "Name"
|
59
|
59
|
TOBI_STATE = "State"
|
60
|
|
-TOBI_STATE_RELESED = 'Released'
|
|
60
|
+TOBI_STATE_RELEASED = 'Released'
|
61
|
61
|
TOBI_STATE_IN_DEVELOPMENT = 'In development'
|
62
|
62
|
TOBI_SUPP_INTERP = "Supported Interpreters"
|
63
|
63
|
TOBI_VERSION = "Version"
|
|
@@ -123,11 +123,12 @@ def __get_release_state__(ut_folder, lib):
|
123
|
123
|
return STATUS_MISSING
|
124
|
124
|
else:
|
125
|
125
|
ut_status = ut_data.get(MAIN_KEY_TESTOBJECT_INFO, {}).get(TOBI_STATE, 'unknown')
|
126
|
|
- if 'released' in ut_status.lower():
|
|
126
|
+ if ut_status == TOBI_STATE_RELEASED:
|
127
|
127
|
return STATUS_RELEASED
|
128
|
|
- elif 'work' in ut_status.lower():
|
|
128
|
+ elif ut_status == TOBI_STATE_IN_DEVELOPMENT:
|
129
|
129
|
return STATUS_IN_WORK
|
130
|
130
|
else:
|
|
131
|
+ print(ut_status)
|
131
|
132
|
return STATUS_UNKNOWN
|
132
|
133
|
|
133
|
134
|
|
|
@@ -155,7 +156,7 @@ def __get_testcase_integrity__(ut_folder, lib):
|
155
|
156
|
if tc_version == current_version:
|
156
|
157
|
return STATUS_CLEAN
|
157
|
158
|
else:
|
158
|
|
- return STATUS_CHANGED
|
|
159
|
+ return STATUS_IN_WORK
|
159
|
160
|
|
160
|
161
|
|
161
|
162
|
def get_lib_testcase_integrity(ut_folder):
|
|
@@ -193,31 +194,15 @@ def get_ut_src_integrity(ut_folder):
|
193
|
194
|
return __get_src_integrity__(ut_folder, False)
|
194
|
195
|
|
195
|
196
|
|
196
|
|
-def status_module(ut_folder):
|
197
|
|
- try:
|
198
|
|
- with open(get_lib_jsonlog(ut_folder), 'r') as fh:
|
199
|
|
- ut_lib = json.loads(fh.read())
|
200
|
|
- except IOError:
|
|
197
|
+def status_lib_unittest(ut_folder):
|
|
198
|
+ if get_lib_release_state(ut_folder) == STATUS_RELEASED and get_lib_src_integrity(ut_folder) == STATUS_CLEAN and get_lib_testcase_integrity(ut_folder) == STATUS_CLEAN:
|
|
199
|
+ return STATUS_CLEAN
|
|
200
|
+ elif get_lib_release_state(ut_folder) == STATUS_MISSING and get_lib_src_integrity(ut_folder) == STATUS_MISSING and get_lib_testcase_integrity(ut_folder) == STATUS_MISSING:
|
201
|
201
|
return STATUS_MISSING
|
|
202
|
+ elif get_lib_release_state(ut_folder) == STATUS_IN_WORK or get_lib_src_integrity(ut_folder) == STATUS_IN_WORK or get_lib_testcase_integrity(ut_folder) == STATUS_IN_WORK:
|
|
203
|
+ return STATUS_IN_WORK
|
202
|
204
|
else:
|
203
|
|
- try:
|
204
|
|
- with open(get_ut_jsonlog(ut_folder), 'r') as fh:
|
205
|
|
- ut_ut = json.loads(fh.read())
|
206
|
|
- except IOError:
|
207
|
|
- return STATUS_UNKNOWN
|
208
|
|
- else:
|
209
|
|
- tested_version = ut_lib.get(MAIN_KEY_TESTOBJECT_INFO, {}).get(TOBI_VERSION)
|
210
|
|
- current_version = module_uid(get_lib_folder(ut_folder))
|
211
|
|
- if ut_ut[MAIN_KEY_TESTOBJECT_INFO] != ut_lib[MAIN_KEY_TESTOBJECT_INFO] or ut_ut[MAIN_KEY_UNITTEST_INFO] != ut_lib[MAIN_KEY_UNITTEST_INFO] or tested_version != current_version:
|
212
|
|
- return STATUS_OLD
|
213
|
|
- else:
|
214
|
|
- ut_status = ut_lib.get(MAIN_KEY_TESTOBJECT_INFO, {}).get(TOBI_STATE, 'unknown')
|
215
|
|
- if 'released' in ut_status.lower():
|
216
|
|
- return STATUS_RELEASED
|
217
|
|
- elif 'work' in ut_status.lower():
|
218
|
|
- return STATUS_IN_WORK
|
219
|
|
- else:
|
220
|
|
- return STATUS_UNKNOWN
|
|
205
|
+ return STATUS_UNKNOWN
|
221
|
206
|
|
222
|
207
|
|
223
|
208
|
def versions_module(ut_folder):
|