def test_1(self):
    assert time.clock() == 1
assert time.clock() == 2

@patch('time.clock', MagicMock(side_effects=[1, 2]))
def test_2(self):
    assert time.clock() == 1
Patching a function using Mock