edwardwang888 opened a new pull request #18343: URL: https://github.com/apache/airflow/pull/18343
This test uses the current time and a sleep to test retry delay. However, this is nondeterministic and fails on my local machine as it takes longer than 3 seconds to execute the first two runs. I think the reason for this was that the code was originally written using `datetime.datetime.now` (see https://github.com/apache/airflow/commit/8051aa988d315ab5c54bf5dd8f6e931356c07c2e#diff-969c0712020e8472d8d78ae32190692cc1e8a3e16dc17f6977c8f87a1328adb7R163), which cannot be easily patched without affecting other parts of the code that use `datetime.datetime`. However, now that there is the `timezone.utc` function, patching is possible. The downside is that we need to duplicate the logic, though it is only two lines. https://github.com/apache/airflow/blob/87e98652d58198e4ef7146bdc7e1e8d87a7d2bae/airflow/utils/timezone.py#L53-L65 <!-- Thank you for contributing! Please make sure that your code changes are covered with tests. And in case of new features or big changes remember to adjust the documentation. Feel free to ping committers for the review! In case of existing issue, reference it using one of the following: closes: #ISSUE related: #ISSUE How to write a good git commit message: http://chris.beams.io/posts/git-commit/ --> --- **^ Add meaningful description above** Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information. In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed. In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md). -- 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]
