Commit 012a5b5d authored by Miquel Torres's avatar Miquel Torres Committed by GitHub
Browse files

Merge pull request #215 from tobami/fix-timeline-def-branch

Fix timeline not respecting default branch
Contributed by victor.stinner@gmail.com
parents 7955cd21 985ab316
This diff is collapsed.
......@@ -4,11 +4,10 @@
## General default options ##
WEBSITE_NAME = "MySpeedSite" # This name will be used in the reports RSS feed
DEF_ENVIRONMENT = None #Name of the environment which should be selected as default
DEF_ENVIRONMENT = None # Name of the environment which should be selected as default
DEF_BRANCH = "default" # Defines the default branch to be used.
# In git projects, this branch is usually be calles
# "master"
DEF_BRANCH = "master" # Defines the default branch to be used.
# In git projects, this branch is usually called "master"
DEF_BASELINE = None # Which executable + revision should be default as a baseline
# Given as the name of the executable and commitid of the revision
......
......@@ -3,6 +3,7 @@ from datetime import datetime, timedelta
import copy
import json
from django.conf import settings
from django.test import TestCase, override_settings
from django.core.urlresolvers import reverse
......@@ -351,16 +352,16 @@ class TestTimeline(TestCase):
self.assertEquals(
len(responsedata['timelines']), 1, "there should be 1 benchmark")
self.assertEquals(
len(responsedata['timelines'][0]['branches']['default']),
len(responsedata['timelines'][0]['branches']['master']),
2,
"there should be 2 timelines")
self.assertEquals(
len(responsedata['timelines'][0]['branches']['default']['1']),
len(responsedata['timelines'][0]['branches']['master']['1']),
2,
"There are 2 datapoints")
self.assertEquals(
responsedata['timelines'][0]['branches']['default']['1'][1],
[u'2011/04/13 17:04:22 ', 2000.0, 1.11111, u'2', u'', u'default'])
responsedata['timelines'][0]['branches']['master']['1'][1],
[u'2011/04/13 17:04:22 ', 2000.0, 1.11111, u'2', u'', u'master'])
@override_settings(ALLOW_ANONYMOUS_POST=True)
......@@ -370,7 +371,7 @@ class TestReports(TestCase):
Environment.objects.create(name='Dual Core', cpu='Core 2 Duo 8200')
self.data = {
'commitid': 'abcd1',
'branch': 'default',
'branch': settings.DEF_BRANCH,
'project': 'MyProject',
'executable': 'myexe O3 64bits',
'benchmark': 'float',
......
......@@ -401,7 +401,7 @@ def timeline(request):
branch_list.sort()
defaultbranch = ""
if "default" in branch_list:
if settings.DEF_BRANCH in branch_list:
defaultbranch = settings.DEF_BRANCH
if data.get('bran') in branch_list:
defaultbranch = data.get('bran')
......
......@@ -54,7 +54,7 @@ def send(data):
f = urllib2.urlopen(SPEEDURL + 'result/add/', params)
response = f.read()
f.close()
except urllib2.URLError, e:
except urllib2.URLError as e:
if hasattr(e, 'reason'):
response = '\n We failed to reach a server\n'
response += ' Reason: ' + str(e.reason)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment