Skip to content

Commit

Permalink
Stop time during tests
Browse files Browse the repository at this point in the history
Should fix random test failures on Jenkins, e.g.
https://jenkins.gedmin.as/job/profilehooks-on-windows/39/
  • Loading branch information
mgedmin committed Sep 26, 2014
1 parent edcce71 commit 10a5e79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test_profilehooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import unittest
import atexit
import textwrap
import time

try:
from cStringIO import StringIO
Expand Down Expand Up @@ -278,12 +279,15 @@ def setUp(test):
sys.stderr = stderr_wrapper
atexit.register = _register_exitfunc
del _exitfuncs[:]
test.real_time = time.time
time.time = lambda: 1411735756


def tearDown(test):
sys.stderr = test.real_stderr
atexit.register = test.real_register
del _exitfuncs[:]
time.time = test.real_time


def additional_tests():
Expand Down

0 comments on commit 10a5e79

Please sign in to comment.