PyTestLog2DB 0.3.0__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PKG-INFO +3 -1
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB/PyTestLog2DB.pdf +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB/pytestlog2db.py +11 -8
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB/version.py +2 -3
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB.egg-info/PKG-INFO +3 -1
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/README.rst +2 -1
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/LICENSE +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB/__init__.py +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB/__main__.py +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB/xsd/junit.xsd +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB.egg-info/SOURCES.txt +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB.egg-info/dependency_links.txt +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB.egg-info/requires.txt +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/PyTestLog2DB.egg-info/top_level.txt +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/setup.cfg +0 -0
- {PyTestLog2DB-0.3.0 → PyTestLog2DB-0.3.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyTestLog2DB
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Imports pytest result(s) to TestResultWebApp database
|
|
5
5
|
Home-page: https://github.com/test-fullautomation/python-pytestlog2db
|
|
6
6
|
Author: Tran Duy Ngoan
|
|
@@ -158,6 +158,8 @@ The usage should be showed as below:
|
|
|
158
158
|
--config CONFIG configuration json file for component mapping information.
|
|
159
159
|
--interface {db,rest}
|
|
160
160
|
database access interface.
|
|
161
|
+
--testrunurl TESTRUNURL
|
|
162
|
+
link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
|
|
161
163
|
|
|
162
164
|
The below command is simple usage with all required arguments to import
|
|
163
165
|
[pytest](https://docs.pytest.org) results into TestResultWebApp\'s
|
|
Binary file
|
|
@@ -37,13 +37,13 @@ import colorama as col
|
|
|
37
37
|
import json
|
|
38
38
|
from lxml import etree
|
|
39
39
|
from datetime import datetime, timedelta
|
|
40
|
+
from dateutil import parser
|
|
40
41
|
import platform
|
|
41
42
|
from pkg_resources import get_distribution
|
|
42
43
|
|
|
43
44
|
from TestResultDBAccess import DBAccessFactory
|
|
44
45
|
from PyTestLog2DB.version import VERSION, VERSION_DATE
|
|
45
46
|
|
|
46
|
-
PYTEST_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
|
|
47
47
|
DB_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|
48
48
|
|
|
49
49
|
def __current_user():
|
|
@@ -305,6 +305,7 @@ Avalable arguments in command line:
|
|
|
305
305
|
- `--versions` : metadata: Versions (Software;Hardware;Test) to be set for this import.
|
|
306
306
|
- `--config` : configuration json file for component mapping information.
|
|
307
307
|
- `--interface` : database access interface.
|
|
308
|
+
- `--testrunurl`: link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
|
|
308
309
|
|
|
309
310
|
**Arguments:**
|
|
310
311
|
|
|
@@ -337,6 +338,7 @@ Avalable arguments in command line:
|
|
|
337
338
|
cmdlineparser.add_argument('--versions', type=str, help='metadata: Versions (Software;Hardware;Test) to be set for this import (semicolon separated).')
|
|
338
339
|
cmdlineparser.add_argument('--config', type=str, help='configuration json file for component mapping information.')
|
|
339
340
|
cmdlineparser.add_argument('--interface', choices=['db', 'rest'], default='db', help='database access interface.')
|
|
341
|
+
cmdlineparser.add_argument('--testrunurl', type=str, default="", help='link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...')
|
|
340
342
|
|
|
341
343
|
return cmdlineparser.parse_args()
|
|
342
344
|
|
|
@@ -583,13 +585,13 @@ Besides, `starttime` and `endtime` are also calculated and added in the merged r
|
|
|
583
585
|
if oMergedTree == None:
|
|
584
586
|
oMergedTree = oTree
|
|
585
587
|
sStartTime = oMergedTree.getchildren()[0].get("timestamp")
|
|
586
|
-
dtStartTime =
|
|
588
|
+
dtStartTime = parser.parse(sStartTime)
|
|
587
589
|
dtEndTime = dtStartTime + timedelta(seconds=float(oMergedTree.getchildren()[0].get("time")))
|
|
588
590
|
else:
|
|
589
591
|
oAdditionalTree = etree.parse(item)
|
|
590
592
|
for oSuite in oAdditionalTree.getroot().iterchildren("testsuite"):
|
|
591
593
|
oMergedTree.append(oSuite)
|
|
592
|
-
dtTimestamp =
|
|
594
|
+
dtTimestamp = parser.parse(oSuite.get("timestamp"))
|
|
593
595
|
|
|
594
596
|
# check starttime and endtime for the execution result
|
|
595
597
|
if dtTimestamp < dtStartTime:
|
|
@@ -678,7 +680,7 @@ Get test result from provided Testcase object.
|
|
|
678
680
|
traceback_log = f"This test is skipped."
|
|
679
681
|
return_code = 20
|
|
680
682
|
|
|
681
|
-
return (main_result, base64.b64encode(traceback_log.encode()), return_code)
|
|
683
|
+
return (main_result, str(base64.b64encode(traceback_log.encode()), encoding='utf-8'), return_code)
|
|
682
684
|
|
|
683
685
|
def process_component_info(dConfig, sTestClassname):
|
|
684
686
|
"""
|
|
@@ -939,8 +941,8 @@ Process to the lowest suite level (test file):
|
|
|
939
941
|
_tbl_file_id = None
|
|
940
942
|
_tbl_file_tester_account = dConfig["tester"]
|
|
941
943
|
_tbl_file_tester_machine = suite.get("hostname")
|
|
942
|
-
|
|
943
|
-
|
|
944
|
+
test_start_time = parser.parse(suite.get("timestamp"))
|
|
945
|
+
_tbl_file_time_start = datetime.strftime(test_start_time, DB_DATETIME_FORMAT)
|
|
944
946
|
_tbl_file_time_end = datetime.strftime(test_start_time + timedelta(seconds=float(suite.get("time"))), DB_DATETIME_FORMAT)
|
|
945
947
|
|
|
946
948
|
test_number = 1
|
|
@@ -1076,6 +1078,7 @@ Flow to import PyTest results to database:
|
|
|
1076
1078
|
* `variant` : variant name to be set for this import.
|
|
1077
1079
|
* `versions` : metadata: Versions (Software;Hardware;Test) to be set for this import.
|
|
1078
1080
|
* `config` : configuration json file for component mapping information.
|
|
1081
|
+
* `testrunurl`: link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
|
|
1079
1082
|
|
|
1080
1083
|
**Returns:**
|
|
1081
1084
|
|
|
@@ -1176,7 +1179,7 @@ Flow to import PyTest results to database:
|
|
|
1176
1179
|
# Set version as start time of the execution if not provided in metadata
|
|
1177
1180
|
# Format: %Y%m%d_%H%M%S from %Y-%m-%d %H:%M:%S
|
|
1178
1181
|
if _tbl_result_version_sw_target=="":
|
|
1179
|
-
_tbl_result_version_sw_target = datetime.strftime(
|
|
1182
|
+
_tbl_result_version_sw_target = datetime.strftime(parser.parse(pytest_result.get("starttime")), "%Y%m%d_%H%M%S")
|
|
1180
1183
|
|
|
1181
1184
|
if not args.append:
|
|
1182
1185
|
Logger.log(f"Set project/variant to '{sVariant}' ({sMsgVarirantSetBy})")
|
|
@@ -1199,7 +1202,7 @@ Flow to import PyTest results to database:
|
|
|
1199
1202
|
|
|
1200
1203
|
# Process other info
|
|
1201
1204
|
_tbl_result_interpretation = ""
|
|
1202
|
-
_tbl_result_jenkinsurl =
|
|
1205
|
+
_tbl_result_jenkinsurl = args.testrunurl
|
|
1203
1206
|
_tbl_result_reporting_qualitygate = ""
|
|
1204
1207
|
|
|
1205
1208
|
# Check the UUID is existing or not
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyTestLog2DB
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Imports pytest result(s) to TestResultWebApp database
|
|
5
5
|
Home-page: https://github.com/test-fullautomation/python-pytestlog2db
|
|
6
6
|
Author: Tran Duy Ngoan
|
|
@@ -158,6 +158,8 @@ The usage should be showed as below:
|
|
|
158
158
|
--config CONFIG configuration json file for component mapping information.
|
|
159
159
|
--interface {db,rest}
|
|
160
160
|
database access interface.
|
|
161
|
+
--testrunurl TESTRUNURL
|
|
162
|
+
link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
|
|
161
163
|
|
|
162
164
|
The below command is simple usage with all required arguments to import
|
|
163
165
|
[pytest](https://docs.pytest.org) results into TestResultWebApp\'s
|
|
@@ -134,7 +134,8 @@ The usage should be showed as below:
|
|
|
134
134
|
--config CONFIG configuration json file for component mapping information.
|
|
135
135
|
--interface {db,rest}
|
|
136
136
|
database access interface.
|
|
137
|
-
|
|
137
|
+
--testrunurl TESTRUNURL
|
|
138
|
+
link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
|
|
138
139
|
|
|
139
140
|
The below command is simple usage with all required arguments to import
|
|
140
141
|
pytest_ results into TestResultWebApp's database:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|