You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See this test failure where test_antistampede fails with an AssertionError:
_________________________ CacheTest.test_antistampede __________________________
self = <cherrypy.test.test_caching.CacheTest testMethod=test_antistampede>
def test_antistampede(self):
SECONDS = 4
slow_url = '/long_process?seconds={SECONDS}'.format(**locals())
# We MUST make an initial synchronous request in order to create the
# AntiStampedeCache object, and populate its selecting_headers,
# before the actual stampede.
self.getPage(slow_url)
self.assertBody('success!')
self.getPage('/clear_cache?path=' + quote(slow_url, safe=''))
self.assertStatus(200)
start = datetime.datetime.now()
def run():
self.getPage(slow_url)
# The response should be the same every time
self.assertBody('success!')
ts = [threading.Thread(target=run) for i in xrange(100)]
for t in ts:
t.start()
for t in ts:
t.join()
finish = datetime.datetime.now()
# Allow for overhead, two seconds for slow hosts
allowance = SECONDS + 2
> self.assertEqualDates(start, finish, seconds=allowance)
cherrypy/test/test_caching.py:317:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cherrypy.test.test_caching.CacheTest testMethod=test_antistampede>
dt1 = datetime.datetime(2016, 12, 23, 22, 18, 48, 495204)
dt2 = datetime.datetime(2016, 12, 23, 22, 18, 55, 718969), seconds = 6
def assertEqualDates(self, dt1, dt2, seconds=None):
"""Assert abs(dt1 - dt2) is within Y seconds."""
if seconds is None:
seconds = self.date_tolerance
if dt1 > dt2:
diff = dt1 - dt2
else:
diff = dt2 - dt1
if not diff < datetime.timedelta(seconds=seconds):
raise AssertionError('%r and %r are not within %r seconds.' %
> (dt1, dt2, seconds))
E AssertionError: datetime.datetime(2016, 12, 23, 22, 18, 48, 495204) and datetime.datetime(2016, 12, 23, 22, 18, 55, 718969) are not within 6 seconds.
cherrypy/test/helper.py:403: AssertionError
The text was updated successfully, but these errors were encountered:
See this test failure where test_antistampede fails with an AssertionError:
The text was updated successfully, but these errors were encountered: