PyTestLog2DB 0.3.1__py3-none-any.whl → 0.3.4__py3-none-any.whl

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.
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 = datetime.strptime(sStartTime, PYTEST_DATETIME_FORMAT)
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 = datetime.strptime(oSuite.get("timestamp"), PYTEST_DATETIME_FORMAT)
594
+ dtTimestamp = parser.parse(oSuite.get("timestamp"))
593
595
 
594
596
  # check starttime and endtime for the execution result
595
597
  if dtTimestamp < dtStartTime:
@@ -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
- _tbl_file_time_start = suite.get("timestamp")
943
- test_start_time = datetime.strptime(_tbl_file_time_start, PYTEST_DATETIME_FORMAT)
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(datetime.strptime(pytest_result.get("starttime"), DB_DATETIME_FORMAT), "%Y%m%d_%H%M%S")
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
PyTestLog2DB/version.py CHANGED
@@ -18,6 +18,5 @@
18
18
  #
19
19
  # Version and date of PyTestLog2DB
20
20
  #
21
- VERSION = "0.3.1"
22
- VERSION_DATE = "20.05.2024"
23
-
21
+ VERSION = "0.3.4"
22
+ VERSION_DATE = "02.08.2024"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyTestLog2DB
3
- Version: 0.3.1
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
@@ -161,6 +161,8 @@ The usage should be showed as below:
161
161
  --config CONFIG configuration json file for component mapping information.
162
162
  --interface {db,rest}
163
163
  database access interface.
164
+ --testrunurl TESTRUNURL
165
+ link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
164
166
 
165
167
  The below command is simple usage with all required arguments to import
166
168
  [pytest](https://docs.pytest.org) results into TestResultWebApp\'s
@@ -0,0 +1,11 @@
1
+ PyTestLog2DB/PyTestLog2DB.pdf,sha256=zxEL67Uk-jG0-ytTd-V2MjVvwfR0WrDQf6Hjf_1xewA,522565
2
+ PyTestLog2DB/__init__.py,sha256=YKDTJjDsnQkr5X-gjjO8opwKUVKm6kc8sIUpURYMk48,596
3
+ PyTestLog2DB/__main__.py,sha256=YCrS2paaKQlHRlq2d_HKHnsQHs9uVudKN51L84mKd74,693
4
+ PyTestLog2DB/pytestlog2db.py,sha256=IGIslw6td-TKsxQGbHJlNmAMZQZhEAv3Bh9K2o5GDTE,43947
5
+ PyTestLog2DB/version.py,sha256=l1MnmQswsjfjXT_LmUY84W7K5AyVMx5XaQpwSevzMeg,916
6
+ PyTestLog2DB/xsd/junit.xsd,sha256=16vVXGy8p1afl2YbgX61g528x4x8Vy3Lf0qqKY9IAZs,6847
7
+ PyTestLog2DB-0.3.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ PyTestLog2DB-0.3.4.dist-info/METADATA,sha256=AMKe0ETbmmztnOG1w9_yUhQPkOjSfeSaQ2GTL0q06-g,11077
9
+ PyTestLog2DB-0.3.4.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
10
+ PyTestLog2DB-0.3.4.dist-info/top_level.txt,sha256=WN8NnXKE7lkjhVq7yi3WQwIh54rVKUQdecci-Yy4pog,13
11
+ PyTestLog2DB-0.3.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +0,0 @@
1
- PyTestLog2DB/PyTestLog2DB.pdf,sha256=_SWxi7NpwGw5B5ST_PYTRlG3ThL9ZgDnogMXqeS1caw,520598
2
- PyTestLog2DB/__init__.py,sha256=YKDTJjDsnQkr5X-gjjO8opwKUVKm6kc8sIUpURYMk48,596
3
- PyTestLog2DB/__main__.py,sha256=YCrS2paaKQlHRlq2d_HKHnsQHs9uVudKN51L84mKd74,693
4
- PyTestLog2DB/pytestlog2db.py,sha256=uy8brtKt54b2SeDylFrcPL5HvbOKZ0Ip0GVUsZcBe80,43712
5
- PyTestLog2DB/version.py,sha256=CTc-wU56FDKToufjb5eraZi_hMlI64EDwByvf6UVPZE,917
6
- PyTestLog2DB/xsd/junit.xsd,sha256=16vVXGy8p1afl2YbgX61g528x4x8Vy3Lf0qqKY9IAZs,6847
7
- PyTestLog2DB-0.3.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
- PyTestLog2DB-0.3.1.dist-info/METADATA,sha256=23IYCfYo0G4XywE-RkoF33A4lcTr35Ev9YO_Hgy8r5s,10956
9
- PyTestLog2DB-0.3.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
10
- PyTestLog2DB-0.3.1.dist-info/top_level.txt,sha256=WN8NnXKE7lkjhVq7yi3WQwIh54rVKUQdecci-Yy4pog,13
11
- PyTestLog2DB-0.3.1.dist-info/RECORD,,