Browse Source

Merge ""round" may bump 1 second to 2 if sleep takes more than 1.49 sec" into stable/train

changes/37/759937/1
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
b889f97e52
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      neutron/tests/unit/common/test_utils.py

+ 2
- 2
neutron/tests/unit/common/test_utils.py View File

@@ -544,13 +544,13 @@ class TimerTestCase(base.BaseTestCase):
def test__getattr(self):
with utils.Timer() as timer:
time.sleep(1)
self.assertEqual(1, round(timer.total_seconds(), 0))
self.assertLess(timer.total_seconds(), 2)
self.assertEqual(1, timer.delta.seconds)

def test__enter_with_timeout(self):
with utils.Timer(timeout=10) as timer:
time.sleep(1)
self.assertEqual(1, round(timer.total_seconds(), 0))
self.assertLess(timer.total_seconds(), 2)

def test__enter_with_timeout_exception(self):
msg = r'Timer timeout expired after 1 second\(s\).'


Loading…
Cancel
Save