mock.reset()


此函数恢复了此 MockTracker 之前创建的所有模拟的默认行为,并解除了模拟与 MockTracker 实例的关联。 一旦解除关联,模拟仍然可以使用,但 MockTracker 实例不能再用于重置它们的行为或以其他方式与它们交互。

每次测试完成后,都会在测试上下文的 MockTracker 上调用此函数。 如果广泛使用全局 MockTracker,建议手动调用该函数。

This function restores the default behavior of all mocks that were previously created by this MockTracker and disassociates the mocks from the MockTracker instance. Once disassociated, the mocks can still be used, but the MockTracker instance can no longer be used to reset their behavior or otherwise interact with them.

After each test completes, this function is called on the test context's MockTracker. If the global MockTracker is used extensively, calling this function manually is recommended.