Skip to content

Commit 8d9d91d

Browse files
Merge pull request #897 from allmightyspiff/broken_unites
Broken unit tests
2 parents 07806a2 + 005275c commit 8d9d91d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tests/managers/vs_tests.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ def test_iter_two_incomplete(self, _sleep, _time):
863863
{'activeTransaction': {'id': 1}},
864864
{'provisionDate': 'aaa'}
865865
]
866-
_time.side_effect = [0, 1, 2]
866+
# logging calls time.time as of pytest3.3, not sure if there is a better way of getting around that.
867+
_time.side_effect = [0, 0, 1, 1, 2, 2, 2]
867868
value = self.vs.wait_for_ready(1, 2, delay=1)
868869
self.assertFalse(value)
869870
_sleep.assert_called_once_with(1)
@@ -877,7 +878,8 @@ def test_iter_two_incomplete(self, _sleep, _time):
877878
def test_iter_20_incomplete(self, _sleep, _time):
878879
"""Wait for up to 20 seconds (sleeping for 10 seconds) for a server."""
879880
self.guestObject.return_value = {'activeTransaction': {'id': 1}}
880-
_time.side_effect = [0, 10, 20]
881+
# logging calls time.time as of pytest3.3, not sure if there is a better way of getting around that.
882+
_time.side_effect = [0, 0, 10, 10, 20, 20, 50, 60]
881883
value = self.vs.wait_for_ready(1, 20, delay=10)
882884
self.assertFalse(value)
883885
self.guestObject.assert_has_calls([mock.call(id=1, mask=mock.ANY)])
@@ -888,11 +890,12 @@ def test_iter_20_incomplete(self, _sleep, _time):
888890
@mock.patch('random.randint')
889891
@mock.patch('time.time')
890892
@mock.patch('time.sleep')
891-
def test_exception_from_api(self, _sleep, _time, _random, vs):
893+
def test_exception_from_api(self, _sleep, _time, _random, _vs):
892894
"""Tests escalating scale back when an excaption is thrown"""
893895
self.guestObject.return_value = {'activeTransaction': {'id': 1}}
894-
vs.side_effect = exceptions.TransportError(104, "Its broken")
895-
_time.side_effect = [0, 0, 2, 6, 14, 20, 100]
896+
_vs.side_effect = exceptions.TransportError(104, "Its broken")
897+
# logging calls time.time as of pytest3.3, not sure if there is a better way of getting around that.
898+
_time.side_effect = [0, 0, 0, 0, 2, 2, 2, 6, 6, 6, 14, 14, 14, 20, 20, 20, 100, 100, 100]
896899
_random.side_effect = [0, 0, 0, 0, 0]
897900
value = self.vs.wait_for_ready(1, 20, delay=1)
898901
_sleep.assert_has_calls([

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27,py33,py34,py35,py36,pypy,analysis,coverage
2+
envlist = py27,py35,py36,pypy,analysis,coverage
33

44
[flake8]
55
max-line-length=120

0 commit comments

Comments
 (0)