diff --git a/tests/flytekit/unit/bin/test_python_entrypoint.py b/tests/flytekit/unit/bin/test_python_entrypoint.py index bbb33ec962..323770bed7 100644 --- a/tests/flytekit/unit/bin/test_python_entrypoint.py +++ b/tests/flytekit/unit/bin/test_python_entrypoint.py @@ -526,17 +526,20 @@ def test_get_container_error_timestamp(monkeypatch) -> None: assert get_container_error_timestamp(FlyteException("foo", timestamp=10.5)) == Timestamp(seconds=10, nanos=500000000) - current_dtime = datetime.now() + current_timestamp = Timestamp() + current_timestamp.GetCurrentTime() error_timestamp = get_container_error_timestamp(RuntimeError("foo")) - assert error_timestamp.ToDatetime() >= current_dtime + assert error_timestamp.ToDatetime() >= current_timestamp.ToDatetime() - current_dtime = datetime.now() + current_timestamp = Timestamp() + current_timestamp.GetCurrentTime() error_timestamp = get_container_error_timestamp(FlyteException("foo")) - assert error_timestamp.ToDatetime() >= current_dtime + assert error_timestamp.ToDatetime() >= current_timestamp.ToDatetime() - current_dtime = datetime.now() + current_timestamp = Timestamp() + current_timestamp.GetCurrentTime() error_timestamp = get_container_error_timestamp(None) - assert error_timestamp.ToDatetime() >= current_dtime + assert error_timestamp.ToDatetime() >= current_timestamp.ToDatetime() def get_flyte_context(tmp_path_factory, outputs_path):