[hacking]Do not mock threading.Event

Such mock is too wide and will cause issues with our basic libraries and
test infrastructure leading to race conditions and threads leaked across
tests.

We needed to remove a bunch of such mocks found by the new rule. In some
cases we needed to make the mocking more specific for a given Event
instance, in other case the mock was not needed at all and the test case
was still not taking excessive time.

Related-Bug: #2136815
Change-Id: I3ae3740eb07bade4e0883db3e02c0a81e92b9a36
Signed-off-by: Balazs Gibizer <gibi@redhat.com>
This commit is contained in:
Balazs Gibizer
2025-12-18 17:48:10 +01:00
parent d840c63a18
commit 19203d684d
7 changed files with 124 additions and 65 deletions
+2
View File
@@ -81,6 +81,8 @@ Nova Specific Commandments
from stdlib instead. E.g. eventlet.sleep => time.sleep
- [N374] Don't use time.sleep(0) to trigger eventlet yielding.
Use nova.utils.cooperative_yield() instead.
- [N375] Don't mock threading.Event directly, target the mock to your
specific Event instance.
Creating Unit Tests
-------------------