Bug 1209474 - Change Django TIME_ZONE setting to UTC (#1972)

This commit is contained in:
Tiramisu 1993 2016-11-07 22:07:27 +08:00 коммит произвёл William Lachance
Родитель b023a585bd
Коммит 0c952d370f
13 изменённых файлов: 36 добавлений и 36 удалений

Просмотреть файл

@ -224,7 +224,7 @@ def test_load_generic_data(test_project, test_repository,
perf_datum = datum['blob']
push_timestamp = perf_job_data['fake_job_guid']['push_timestamp']
pushtime = datetime.datetime.fromtimestamp(push_timestamp)
pushtime = datetime.datetime.utcfromtimestamp(push_timestamp)
for suite in perf_datum['suites']:
# verify summary, then subtests
_verify_signature(test_repository.name,
@ -263,7 +263,7 @@ def test_load_generic_data(test_project, test_repository,
signature = PerformanceSignature.objects.get(
suite=perf_datum['suites'][0]['name'],
test=perf_datum['suites'][0]['subtests'][0]['name'])
signature.last_updated == datetime.datetime.fromtimestamp(push_timestamp + 1)
signature.last_updated == datetime.datetime.utcfromtimestamp(push_timestamp + 1)
def test_no_performance_framework(test_project, test_repository,

Просмотреть файл

@ -40,7 +40,7 @@ def test_detect_alerts_in_series(test_project, test_repository,
result_set_id=t,
job_id=t,
signature=test_perf_signature,
push_timestamp=datetime.datetime.fromtimestamp(now + t),
push_timestamp=datetime.datetime.utcfromtimestamp(now + t),
value=v)
generate_new_alerts_in_series(test_perf_signature)
@ -67,7 +67,7 @@ def test_detect_alerts_in_series(test_project, test_repository,
result_set_id=t,
job_id=0,
signature=test_perf_signature,
push_timestamp=datetime.datetime.fromtimestamp(now + t),
push_timestamp=datetime.datetime.utcfromtimestamp(now + t),
value=v)
generate_new_alerts_in_series(test_perf_signature)
@ -100,7 +100,7 @@ def test_detect_alerts_in_series_with_retriggers(
result_set_id=t,
job_id=j,
signature=test_perf_signature,
push_timestamp=datetime.datetime.fromtimestamp(now + t),
push_timestamp=datetime.datetime.utcfromtimestamp(now + t),
value=v)
generate_new_alerts_in_series(test_perf_signature)
_verify_alert(1, 2, 1, test_perf_signature, 0.5, 1.0, True,
@ -119,7 +119,7 @@ def test_no_alerts_with_old_data(
result_set_id=t,
job_id=t,
signature=test_perf_signature,
push_timestamp=datetime.datetime.fromtimestamp(t),
push_timestamp=datetime.datetime.utcfromtimestamp(t),
value=v)
generate_new_alerts_in_series(test_perf_signature)
@ -148,7 +148,7 @@ def test_custom_alert_threshold(
result_set_id=t,
job_id=t,
signature=test_perf_signature,
push_timestamp=datetime.datetime.fromtimestamp(now + t),
push_timestamp=datetime.datetime.utcfromtimestamp(now + t),
value=v)
generate_new_alerts_in_series(test_perf_signature)

Просмотреть файл

@ -342,15 +342,15 @@ def test_text_log_steps_and_errors(webapp, eleven_jobs_stored, jm, test_reposito
job = Job.objects.get(project_specific_id=jm.get_job(1)[0]['id'])
TextLogStep.objects.create(job=job,
name='step1',
started=datetime.datetime.fromtimestamp(0),
finished=datetime.datetime.fromtimestamp(100),
started=datetime.datetime.utcfromtimestamp(0),
finished=datetime.datetime.utcfromtimestamp(100),
started_line_number=1,
finished_line_number=100,
result=TextLogStep.SUCCESS)
step2 = TextLogStep.objects.create(job=job,
name='step2',
started=datetime.datetime.fromtimestamp(101),
finished=datetime.datetime.fromtimestamp(200),
started=datetime.datetime.utcfromtimestamp(101),
finished=datetime.datetime.utcfromtimestamp(200),
started_line_number=101,
finished_line_number=200,
result=TextLogStep.TEST_FAILED)
@ -367,12 +367,12 @@ def test_text_log_steps_and_errors(webapp, eleven_jobs_stored, jm, test_reposito
assert resp.json == [
{
'errors': [],
'finished': '1969-12-31T16:01:40',
'finished': '1970-01-01T00:01:40',
'finished_line_number': 100,
'id': 1,
'name': 'step1',
'result': 'success',
'started': '1969-12-31T16:00:00',
'started': '1970-01-01T00:00:00',
'started_line_number': 1
},
{
@ -398,12 +398,12 @@ def test_text_log_steps_and_errors(webapp, eleven_jobs_stored, jm, test_reposito
}
}
],
'finished': '1969-12-31T16:03:20',
'finished': '1970-01-01T00:03:20',
'finished_line_number': 200,
'id': 2,
'name': 'step2',
'result': 'testfailed',
'started': '1969-12-31T16:01:41',
'started': '1970-01-01T00:01:41',
'started_line_number': 101
}
]
@ -414,15 +414,15 @@ def test_text_log_errors(webapp, eleven_jobs_stored, jm, test_repository):
job = Job.objects.get(project_specific_id=jm.get_job(1)[0]['id'])
TextLogStep.objects.create(job=job,
name='step1',
started=datetime.datetime.fromtimestamp(0),
finished=datetime.datetime.fromtimestamp(100),
started=datetime.datetime.utcfromtimestamp(0),
finished=datetime.datetime.utcfromtimestamp(100),
started_line_number=1,
finished_line_number=100,
result=TextLogStep.SUCCESS)
step2 = TextLogStep.objects.create(job=job,
name='step2',
started=datetime.datetime.fromtimestamp(101),
finished=datetime.datetime.fromtimestamp(200),
started=datetime.datetime.utcfromtimestamp(101),
finished=datetime.datetime.utcfromtimestamp(200),
started_line_number=101,
finished_line_number=200,
result=TextLogStep.TEST_FAILED)

Просмотреть файл

@ -87,7 +87,7 @@ def test_performance_platforms(webapp, test_perf_signature):
def test_performance_platforms_expired_test(webapp, test_perf_signature):
# check that we have no performance platform if the signatures are too old
test_perf_signature.last_updated = datetime.datetime.fromtimestamp(0)
test_perf_signature.last_updated = datetime.datetime.utcfromtimestamp(0)
test_perf_signature.save()
resp = webapp.get(reverse('performance-signatures-platforms-list',
kwargs={

Просмотреть файл

@ -219,8 +219,8 @@ def test_resultset_list_filter_by_date(webapp, test_repository,
u'count': 4,
u'enddate': u'2013-08-13',
u'filter_params': {
u'push_timestamp__gte': 1376118000.0,
u'push_timestamp__lt': 1376463600.0
u'push_timestamp__gte': 1376092800.0,
u'push_timestamp__lt': 1376438400.0
},
u'repository': test_project,
u'startdate': u'2013-08-10'}

Просмотреть файл

@ -34,7 +34,7 @@ SITE_ID = 1
ROOT_URLCONF = "treeherder.config.urls"
WSGI_APPLICATION = 'treeherder.config.wsgi.application'
TIME_ZONE = "America/Los_Angeles"
TIME_ZONE = "UTC"
USE_I18N = False
USE_L10N = True

Просмотреть файл

@ -84,7 +84,7 @@ def _load_perf_artifact(project_name, reference_data, job_data, job_guid,
# data for performance series
job_id = job_data[job_guid]['id']
result_set_id = job_data[job_guid]['result_set_id']
push_timestamp = datetime.datetime.fromtimestamp(
push_timestamp = datetime.datetime.utcfromtimestamp(
job_data[job_guid]['push_timestamp'])
try:

Просмотреть файл

@ -79,7 +79,7 @@ class Command(BaseCommand):
job_id=job_id_mapping[ds_job_id],
bug_id=ds_bug_id,
user_id=email_mapping.get(ds_email),
created=datetime.datetime.fromtimestamp(ds_timestamp)))
created=datetime.datetime.utcfromtimestamp(ds_timestamp)))
BugJobMap.objects.bulk_create(migrated_bug_job_maps)
#
@ -105,5 +105,5 @@ class Command(BaseCommand):
failure_classification_id=ds_failure_classification_id,
user_id=email_mapping.get(ds_email),
text=ds_note_text,
created=datetime.datetime.fromtimestamp(ds_timestamp)))
created=datetime.datetime.utcfromtimestamp(ds_timestamp)))
JobNote.objects.bulk_create(migrated_job_notes)

Просмотреть файл

@ -67,7 +67,7 @@ class Command(BaseCommand):
revision=revision,
revision_hash=revision_hash,
author=self._get_unicode_string(author),
time=datetime.datetime.fromtimestamp(push_timestamp))
time=datetime.datetime.utcfromtimestamp(push_timestamp))
#
# update any jobs

Просмотреть файл

@ -92,7 +92,7 @@ def generate_new_alerts_in_series(signature):
prev_result_set_id=prev_testrun_id,
defaults={
'manually_created': False,
'last_updated': datetime.datetime.fromtimestamp(
'last_updated': datetime.datetime.utcfromtimestamp(
cur.push_timestamp)
})

Просмотреть файл

@ -39,5 +39,5 @@ Type 'yes' to continue, or 'no' to cancel: """)
result_set_id=t,
job_id=t,
signature=s,
push_timestamp=datetime.datetime.fromtimestamp(now + (t * 60 * 60)),
push_timestamp=datetime.datetime.utcfromtimestamp(now + (t * 60 * 60)),
value=v)

Просмотреть файл

@ -56,7 +56,7 @@ def _add_series(pc, project_name, signature_hash, signature_props, verbosity,
'framework': framework,
'extra_properties': extra_properties,
'has_subtests': signature_props.get('has_subtests', False),
'last_updated': datetime.datetime.fromtimestamp(0)
'last_updated': datetime.datetime.utcfromtimestamp(0)
}
if parent_hash:
@ -86,9 +86,9 @@ def _add_series(pc, project_name, signature_hash, signature_props, verbosity,
try:
new_series = []
latest_timestamp = datetime.datetime.fromtimestamp(0)
latest_timestamp = datetime.datetime.utcfromtimestamp(0)
for datum in series:
timestamp = datetime.datetime.fromtimestamp(datum['push_timestamp'])
timestamp = datetime.datetime.utcfromtimestamp(datum['push_timestamp'])
new_series.append(PerformanceDatum(
repository=repository,
result_set_id=datum['result_set_id'],
@ -112,7 +112,7 @@ def _add_series(pc, project_name, signature_hash, signature_props, verbosity,
job_id=datum['job_id'],
signature=signature,
value=datum['value'],
push_timestamp=datetime.datetime.fromtimestamp(datum['push_timestamp']))
push_timestamp=datetime.datetime.utcfromtimestamp(datum['push_timestamp']))
class Command(BaseCommand):

Просмотреть файл

@ -72,7 +72,7 @@ class PerformanceSignatureViewSet(viewsets.ViewSet):
if interval:
signature_data = signature_data.filter(
last_updated__gte=datetime.datetime.fromtimestamp(
last_updated__gte=datetime.datetime.utcfromtimestamp(
int(time.time() - int(interval))))
if start_date:
@ -135,7 +135,7 @@ class PerformancePlatformViewSet(viewsets.ViewSet):
interval = request.query_params.get('interval')
if interval:
signature_data = signature_data.filter(
last_updated__gte=datetime.datetime.fromtimestamp(
last_updated__gte=datetime.datetime.utcfromtimestamp(
int(time.time() - int(interval))))
frameworks = request.query_params.getlist('framework')
@ -198,7 +198,7 @@ class PerformanceDatumViewSet(viewsets.ViewSet):
if interval:
datums = datums.filter(
push_timestamp__gt=datetime.datetime.fromtimestamp(
push_timestamp__gt=datetime.datetime.utcfromtimestamp(
int(time.time() - int(interval))))
if start_date: