gaogaotiantian commented on code in PR #59359:
URL: https://github.com/apache/spark/pull/59359#discussion_r4418907313


##########
python/pyspark/sql/tests/test_functions.py:
##########
@@ -694,8 +700,12 @@ def test_try_make_timestamp(self):
             F.try_make_timestamp(timezone=df_dt.timezone)
 
     def test_try_make_timestamp_ltz(self):
-        # use local timezone here to avoid flakiness
-        data = [(2024, 5, 22, 10, 30, 0, 
datetime.datetime.now().astimezone().tzinfo.__str__())]
+        # Use the local UTC offset on the test date rather than the local tz 
abbreviation
+        # (e.g. CST, PDT), which Spark may misread or reject.
+        offset = datetime.datetime(2024, 5, 22, 10, 
30).astimezone().strftime("%z")
+        local_tz = f"{offset[:3]}:{offset[3:]}"  # e.g. +0800 -> +08:00

Review Comment:
   This is a bit too hacky. Can we utilize the new helper function 
`_utc_to_local` to make the test cleaner here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to