Mock datetime instead of redefining standard library
This fixes up the test to mock the datetime calls specifically in
the test that needs to mock them, rather than the prior approach
which was redefining the behavior of the standard library function
globally.
Additionally, to fix the py310 unit tests, jsonschema is pinned to
the latest version that doesn't depend (indirectly) on Rust. This
is not part of the original cherry-pick but is needed in this change
in order to fix py310 unit tests. This is not needed for stable/2023.1
and above, where commit da0f33c95bbf93d09011990847d2ff10ba3358f1 (Fix
charm for tox4 compatibility) fixed this issue. Stable branches
prior to stable/2023.1 pinned tox to < 4.0.0.
Closes-Bug: #2045588
Change-Id: I9c585c91c5527a61e4a8dbcba0a8a01108cd9b2e
(cherry picked from commit 72e22a94ed4966ff6fb2fba41bac1b204dbd4c14)
Reviewed: https:/ /review. opendev. org/c/openstack /charm- swift-storage/ +/902662 /opendev. org/openstack/ charm-swift- storage/ commit/ 897e34f1dfa79cc 2826d40adf18e92 9476bf9def
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/zed
commit 897e34f1dfa79cc 2826d40adf18e92 9476bf9def
Author: Corey Bryant <email address hidden>
Date: Mon Dec 4 15:47:20 2023 -0500
Mock datetime instead of redefining standard library
This fixes up the test to mock the datetime calls specifically in
the test that needs to mock them, rather than the prior approach
which was redefining the behavior of the standard library function
globally.
Additionally, to fix the py310 unit tests, jsonschema is pinned to 09011990847d2ff 10ba3358f1 (Fix
the latest version that doesn't depend (indirectly) on Rust. This
is not part of the original cherry-pick but is needed in this change
in order to fix py310 unit tests. This is not needed for stable/2023.1
and above, where commit da0f33c95bbf93d
charm for tox4 compatibility) fixed this issue. Stable branches
prior to stable/2023.1 pinned tox to < 4.0.0.
Closes-Bug: #2045588 61e4a8dbcba0a8a 01108cd9b2e f6fb2fba41bac1b 204dbd4c14)
Change-Id: I9c585c91c5527a
(cherry picked from commit 72e22a94ed4966f