comparison tests/conftest.py @ 788:276030ea7972

tests: Try and finally fix the time-based tests.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 05 Sep 2016 21:02:03 -0700
parents 97c1dc568810
children 8ac2d6045d1d
comparison
equal deleted inserted replaced
787:f6f9a284a5f3 788:276030ea7972
544 if i in left_time_indices: 544 if i in left_time_indices:
545 # This is where the time starts. Let's compare that the time 545 # This is where the time starts. Let's compare that the time
546 # values are within a few seconds of each other (usually 0 or 1). 546 # values are within a few seconds of each other (usually 0 or 1).
547 right_time_str = right[i:i + len(test_time_iso8601)] 547 right_time_str = right[i:i + len(test_time_iso8601)]
548 right_time = time.strptime(right_time_str, '%Y-%m-%dT%H:%M:%SZ') 548 right_time = time.strptime(right_time_str, '%Y-%m-%dT%H:%M:%SZ')
549 left_time = time.gmtime(ctx.time) 549 left_time = time.localtime(ctx.time)
550 difference = time.mktime(left_time) - time.mktime(right_time) 550 difference = time.mktime(left_time) - time.mktime(right_time)
551 print("Got time difference: %d" % difference) 551 print("Got time difference: %d" % difference)
552 if abs(difference) <= 2: 552 if abs(difference) <= 2:
553 print("(good enough, moving to end of timestamp)") 553 print("(good enough, moving to end of timestamp)")
554 skip_for = len(test_time_iso8601) - 1 554 skip_for = len(test_time_iso8601) - 1