2323from ...utils .launchable_client import LaunchableClient
2424from ...utils .logger import Logger
2525from ...utils .no_build import NO_BUILD_BUILD_NAME , NO_BUILD_TEST_SESSION_ID
26- from ...utils .typer_types import validate_datetime_with_tz
2726from ..helper import get_session_id , parse_session
2827from .case_event import CaseEvent , CaseEventType
2928
@@ -56,19 +55,18 @@ def tests_main(
5655 "--session" ,
5756 help = "test session name"
5857 )],
59- base_path : Annotated [Optional [Path ], typer .Option (
58+ build_name : Annotated [str | None , typer .Option (
59+ "--build" ,
60+ help = "build name"
61+ )] = None ,
62+ base_path : Annotated [Path | None , typer .Option (
6063 "--base" ,
6164 help = "(Advanced) base directory to make test names portable" ,
6265 exists = True ,
6366 file_okay = False ,
6467 dir_okay = True ,
6568 resolve_path = True
6669 )] = None ,
67- build_name : Annotated [Optional [str ], typer .Option (
68- "--build" ,
69- help = "build name" ,
70- hidden = True
71- )] = None ,
7270 post_chunk : Annotated [int , typer .Option (
7371 "--post-chunk" ,
7472 help = "Post chunk"
@@ -92,33 +90,18 @@ def tests_main(
9290 "Use with --dry-run" ,
9391 hidden = True
9492 )] = False ,
95- group : Annotated [Optional [ str ] , typer .Option (
93+ group : Annotated [str | None , typer .Option (
9694 help = "Grouping name for test results"
9795 )] = "" ,
9896 is_allow_test_before_build : Annotated [bool , typer .Option (
9997 "--allow-test-before-build" ,
10098 help = "" ,
10199 hidden = True
102100 )] = False ,
103- links : Annotated [List [str ], typer .Option (
104- "--link" ,
105- help = "Set external link of title and url"
106- )] = [],
107101 is_no_build : Annotated [bool , typer .Option (
108102 "--no-build" ,
109103 help = "If you want to only send test reports, please use this option"
110104 )] = False ,
111- lineage : Annotated [Optional [str ], typer .Option (
112- help = "Set lineage name. This option value will be passed to the record session command if a session isn't created yet."
113- )] = None ,
114- test_suite : Annotated [Optional [str ], typer .Option (
115- "--test-suite" ,
116- help = "Set test suite name. This option value will be passed to the record session command if a session isn't created yet."
117- )] = "" ,
118- timestamp : Annotated [Optional [str ], typer .Option (
119- help = "Used to overwrite the test executed times when importing historical data. Note: Format must be "
120- "`YYYY-MM-DDThh:mm:ssTZD` or `YYYY-MM-DDThh:mm:ss` (local timezone applied)"
121- )] = None ,
122105):
123106 logger = Logger ()
124107
@@ -133,7 +116,7 @@ def tests_main(
133116 # In NestedCommand, the test runner name should be available from the command structure
134117 # For now, temporarily extract from command chain
135118 command_chain = []
136- current_ctx : Optional [ typer .Context ] = ctx
119+ current_ctx : typer .Context | None = ctx
137120 while current_ctx :
138121 if current_ctx .info_name :
139122 command_chain .append (current_ctx .info_name )
@@ -157,28 +140,12 @@ def tests_main(
157140 else :
158141 raise typer .BadParameter (f"Expected a key-value pair formatted as --option key=value, but got '{ kv } '" )
159142
160- links_tuples = []
161- for kv in links :
162- if '=' in kv :
163- parts = kv .split ('=' , 1 )
164- links_tuples .append ((parts [0 ].strip (), parts [1 ].strip ()))
165- elif ':' in kv :
166- parts = kv .split (':' , 1 )
167- links_tuples .append ((parts [0 ].strip (), parts [1 ].strip ()))
168- else :
169- raise typer .BadParameter (f"Expected a key-value pair formatted as --option key=value, but got '{ kv } '" )
170-
171143 # Validate group if provided and ensure it's never None
172144 if group is None :
173145 group = ""
174146 elif group :
175147 group = _validate_group (group )
176148
177- # Validate and convert timestamp if provided
178- parsed_timestamp = None
179- if timestamp :
180- parsed_timestamp = validate_datetime_with_tz (timestamp )
181-
182149 app_instance = ctx .obj
183150 tracking_client = TrackingClient (Tracking .Command .RECORD_TESTS , app = app_instance )
184151 client = LaunchableClient (test_runner = test_runner , app = app_instance , tracking_client = tracking_client )
@@ -359,7 +326,6 @@ def report(self, junit_report_file: str):
359326 if (
360327 not self .is_allow_test_before_build # nlqa: W503
361328 and not self .is_no_build # noqa: W503
362- and parsed_timestamp is None # noqa: W503
363329 and self .check_timestamp # noqa: W503
364330 and ctime .timestamp () < record_start_at .timestamp () # noqa: W503
365331 ):
@@ -394,9 +360,7 @@ def testcases(reports: List[str]) -> Generator[CaseEventType, None, None]:
394360 if len (tc .get ('testPath' , [])) == 0 :
395361 continue
396362
397- # Set specific time for importing historical data
398- if parsed_timestamp is not None :
399- tc ["createdAt" ] = parsed_timestamp .isoformat ()
363+ # Timestamp option has been removed
400364
401365 yield tc
402366
@@ -516,7 +480,7 @@ def recorded_result() -> Tuple[int, int, int, float]:
516480 cases = chunk ,
517481 test_runner = test_runner ,
518482 group = group ,
519- test_suite_name = test_suite if test_suite else "" ,
483+ test_suite_name = "" , # test_suite option was removed
520484 flavors = dict (flavor_tuples ),
521485 )
522486
0 commit comments