[Rt-commit] rt branch 4.4/test-mocktime-hires created. rt-4.4.6-51-g8a2430fea5

BPS Git Server git at git.bestpractical.com
Mon Jan 9 18:56:27 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/test-mocktime-hires has been created
        at  8a2430fea5f565039f161c8485ac34496c2ad588 (commit)

- Log -----------------------------------------------------------------
commit 8a2430fea5f565039f161c8485ac34496c2ad588
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Jan 9 13:46:58 2023 -0500

    Switch to Test::MockTime::HiRes in date api test
    
    Version 1.14 of DateTime::Format::Natural added support for
    milliseconds, which involved changing DateTime calls to
    DateTime::HiRes. DateTime::HiRes uses Time::HiRes::time(),
    and Test::MockTime doesn't overload that time function. This
    resulted in test times being returned as "now" rather than the
    mocked time.
    
    Switch to Test::MockTime::HiRes, which does overload the HiRes
    time functions. This module also overloads the same time functions
    as Test::MockTime, so this change should be compatible with
    earlier versions of DateTime::Format::Natural.

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index e3e02c9708..db8d51b6c7 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -235,6 +235,7 @@ Test::Email
 Test::Expect 0.31
 Test::LongString
 Test::MockTime
+Test::MockTime::HiRes
 Test::NoWarnings
 Test::Pod
 Test::Warn
diff --git a/t/api/date.t b/t/api/date.t
index aee517d9c1..7f7ecd7016 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -1,5 +1,5 @@
 
-use Test::MockTime qw(set_fixed_time restore_time);
+use Test::MockTime::HiRes qw(set_fixed_time restore_time);
 use DateTime;
 
 use warnings;

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list