Unverified Commit 805cd336 authored by Miquel Torres's avatar Miquel Torres Committed by GitHub
Browse files

Merge pull request #230 from tobami/django-111

Django 1.11 support
parents cd75999b bbebb3af
language: python
python:
- 2.7
- 3.4
- 3.5
branches:
only:
- master
......@@ -9,8 +9,8 @@ env:
global:
- DJANGO_SETTINGS_MODULE=sample_project.settings
matrix:
- DJANGO_VERSION=1.8.18
- DJANGO_VERSION=1.9.13
- DJANGO_VERSION=1.8
- DJANGO_VERSION=1.11
install:
- pip install flake8
- pip install -q Django==$DJANGO_VERSION
......
{% load static %}
<!DOCTYPE html>
<html>
<head>
......@@ -5,7 +6,7 @@
<meta name="description" content="{% block description %}A performance analysis tool for software projects. It shows performance regresions and allows comparing different applications or implementations{% endblock %}">
<meta name="keywords" content="performance, test, plots, charts">
<meta charset="UTF-8">
<link href="{{ STATIC_URL }}css/main.css" rel="stylesheet" type="text/css">
<link href="{% static 'css/main.css' %}" rel="stylesheet" type="text/css">
{% block extra_head %}{% endblock %}
</head>
<body>
......@@ -15,7 +16,7 @@
{% block page_header %}
<a href="{% url 'home' %}">
{% block logo %}
<img src="{{ STATIC_URL }}images/logo.png" height="48" alt="logo"/>
<img src="{% static 'images/logo.png' %}" height="48" alt="logo"/>
{% endblock logo %}
</a>
<h2>{% block page_title %}SPEED CENTER{% endblock page_title %}</h2>
......@@ -48,11 +49,8 @@
{% endblock %}
</div>
<script type='text/javascript'>
var STATIC_URL = '{{ STATIC_URL }}';
</script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery-1.12.3.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/codespeed.js"></script>
<script type="text/javascript" src="{% static 'js/jquery-1.12.3.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/codespeed.js' %}"></script>
{% block extra_body %}{% endblock %}
</body>
</html>
{% extends "codespeed/base_site.html" %}
{% load static %}
{% block title %}{{ block.super }}: Changes{% endblock %}
{% block description %}{% if pagedesc %}{{ pagedesc }}{% else %}{{ block.super }}{% endif %}{% endblock %}
......@@ -65,8 +67,8 @@
{% block extra_body %}
{{ block.super }}
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/changes.js"></script>
<script type="text/javascript" src="{% static 'js/jquery.tablesorter.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/changes.js' %}"></script>
<script type="text/javascript">
var TIMELINE_URL = "{% url "timeline" %}";
......
{% extends "codespeed/base_site.html" %}
{% load static %}
{% block title %}{{ block.super }}: Comparison{% endblock %}
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}js/jqplot/jquery.jqplot.min.css" />
<link rel="stylesheet" type="text/css" href="{% static 'js/jqplot/jquery.jqplot.min.css' %}" />
{% endblock %}
{% block navigation %}
......@@ -80,14 +82,14 @@
{% block extra_body %}
{{ block.super }}
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="{{ STATIC_URL }}js/jqplot/excanvas.min.js"></script><![endif]-->
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.barRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.categoryAxisRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.canvasAxisTickRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.canvasAxisLabelRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/comparison.js"></script>
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="{% static 'js/jqplot/excanvas.min.js' %}"></script><![endif]-->
<script type="text/javascript" src="{% static 'js/jqplot/jquery.jqplot.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.barRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.categoryAxisRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.canvasTextRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.canvasAxisTickRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.canvasAxisLabelRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/comparison.js' %}"></script>
<script type="text/javascript">
$(function() {
......
{% extends "codespeed/base_site.html" %}
{% load static %}
{% block title %}{{ block.super }}: Timeline{% endblock %}
{% block description %}{% if pagedesc %}{{ pagedesc }}{% else %}{{ block.super }}{% endif %}{% endblock %}
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/timeline.css" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}js/jqplot/jquery.jqplot.min.css" />
<link rel="stylesheet" type="text/css" href="{% static '/css/timeline.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'js/jqplot/jquery.jqplot.min.css' %}" />
{% endblock %}
{% block navigation %}
......@@ -106,19 +108,19 @@
{% block extra_body %}
{{ block.super }}
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="{{ STATIC_URL }}js/jqplot/excanvas.min.js"></script><![endif]-->
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.address-1.6.min.js?autoUpdate=0"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.cursor.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.highlighter.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.categoryAxisRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jqplot/jqplot.canvasAxisLabelRenderer.min.js"></script>
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="{% static 'js/jqplot/excanvas.min.js' %}"></script><![endif]-->
<script type="text/javascript" src="{% static 'js/jquery.address-1.6.min.js' %}?autoUpdate=0"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jquery.jqplot.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.cursor.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.highlighter.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.dateAxisRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.categoryAxisRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.canvasTextRenderer.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jqplot/jqplot.canvasAxisLabelRenderer.min.js' %}"></script>
<script type="text/javascript">
var CHANGES_URL = "{% url "changes" %}";
</script>
<script type="text/javascript" src="{{ STATIC_URL }}js/timeline.js"></script>
<script type="text/javascript" src="{% static 'js/timeline.js' %}"></script>
<script type="text/javascript">
$(function() {
Timeline.init({
......@@ -135,4 +137,3 @@
});
</script>
{% endblock %}
......@@ -14,7 +14,7 @@ from codespeed.models import (Project, Benchmark, Revision, Branch, Executable,
class TestAddResult(TestCase):
def setUp(self):
self.path = reverse('codespeed.views.add_result')
self.path = reverse('add-result')
self.e = Environment.objects.create(name='Dual Core',
cpu='Core 2 Duo 8200')
temp = datetime.today()
......@@ -167,12 +167,13 @@ class TestAddResult(TestCase):
class TestAddJSONResults(TestCase):
def setUp(self):
self.path = reverse('codespeed.views.add_json_results')
self.path = reverse('add-json-results')
self.e = Environment(name='bigdog', cpu='Core 2 Duo 8200')
self.e.save()
temp = datetime.today()
self.cdate = datetime(
temp.year, temp.month, temp.day, temp.hour, temp.minute, temp.second)
temp.year, temp.month, temp.day, temp.hour, temp.minute,
temp.second)
self.data = [
{'commitid': '123',
......@@ -332,10 +333,17 @@ class TestTimeline(TestCase):
results = benchmarks[0].results.all()
self.assertEquals(len(results), 8)
def test_timeline(self):
path = reverse('timeline')
response = self.client.get(path)
self.assertEquals(response.status_code, 200)
responsedata = response.content.decode()
self.assertIn('My Own Title\n: Timeline', responsedata)
def test_gettimelinedata(self):
"""Test that gettimelinedata returns correct timeline data
"""
path = reverse('codespeed.views.gettimelinedata')
path = reverse('gettimelinedata')
data = {
"exe": "1,2",
"base": "2+4",
......@@ -382,16 +390,16 @@ class TestReports(TestCase):
'environment': 'Dual Core',
'result_value': 200,
}
resp = self.client.post(reverse('codespeed.views.add_result'),
resp = self.client.post(reverse('add-result'),
self.data)
self.assertEqual(resp.status_code, 202)
self.data['commitid'] = "abcd2"
self.data['result_value'] = 150
self.client.post(reverse('codespeed.views.add_result'), self.data)
self.client.post(reverse('add-result'), self.data)
self.assertEqual(resp.status_code, 202)
def test_reports(self):
response = self.client.get(reverse('codespeed.views.reports'))
response = self.client.get(reverse('reports'))
self.assertEqual(response.status_code, 200)
content = response.content.decode()
......@@ -400,7 +408,7 @@ class TestReports(TestCase):
self.assertIn(self.data['commitid'], content)
def test_reports_post_returns_405(self):
response = self.client.post(reverse('codespeed.views.reports'), {})
response = self.client.post(reverse('reports'), {})
self.assertEqual(response.status_code, 405)
......
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.views.generic import TemplateView
from codespeed import views
from codespeed.feeds import LatestEntries, LatestSignificantEntries
urlpatterns = patterns('',
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'),
url(r'^about/$',
TemplateView.as_view(template_name='about.html'), name='about'),
# RSS for reports
url(r'^feeds/latest/$', LatestEntries(), name='latest-results'),
url(r'^feeds/latest_significant/$', LatestSignificantEntries(),
name='latest-significant-results'),
)
]
urlpatterns += patterns('codespeed.views',
url(r'^reports/$', 'reports', name='reports'),
url(r'^changes/$', 'changes', name='changes'),
url(r'^changes/table/$', 'getchangestable', name='getchangestable'),
url(r'^changes/logs/$', 'displaylogs', name='displaylogs'),
url(r'^timeline/$', 'timeline', name='timeline'),
url(r'^timeline/json/$', 'gettimelinedata', name='gettimelinedata'),
url(r'^comparison/$', 'comparison', name='comparison'),
url(r'^comparison/json/$', 'getcomparisondata', name='getcomparisondata'),
url(r'^makeimage/$', 'makeimage', name='makeimage'),
)
urlpatterns += [
url(r'^reports/$', views.reports, name='reports'),
url(r'^changes/$', views.changes, name='changes'),
url(r'^changes/table/$', views.getchangestable, name='getchangestable'),
url(r'^changes/logs/$', views.displaylogs, name='displaylogs'),
url(r'^timeline/$', views.timeline, name='timeline'),
url(r'^timeline/json/$', views.gettimelinedata, name='gettimelinedata'),
url(r'^comparison/$', views.comparison, name='comparison'),
url(r'^comparison/json/$', views.getcomparisondata, name='getcomparisondata'),
url(r'^makeimage/$', views.makeimage, name='makeimage'),
]
urlpatterns += patterns('codespeed.views',
urlpatterns += [
# URLs for adding results
url(r'^result/add/json/$', 'add_json_results'),
url(r'^result/add/$', 'add_result'),
)
url(r'^result/add/json/$', views.add_json_results, name='add-json-results'),
url(r'^result/add/$', views.add_result, name='add-result'),
]
......@@ -14,7 +14,6 @@ from django.db.models import F
from django.shortcuts import get_object_or_404, render_to_response
from django.views.decorators.http import require_GET, require_POST
from django.views.decorators.csrf import csrf_exempt
from django.template import RequestContext
from .auth import basic_auth_required
from .models import (Environment, Report, Project, Revision, Result,
......@@ -36,7 +35,7 @@ def no_environment_error(request):
'message': ('You need to configure at least one Environment. '
'Please go to the '
'<a href="%s">admin interface</a>' % admin_url)
}, context_instance=RequestContext(request))
})
def no_default_project_error(request):
......@@ -46,19 +45,19 @@ def no_default_project_error(request):
'default (checked "Track changes" field).<br />'
'Please go to the '
'<a href="%s">admin interface</a>' % admin_url)
}, context_instance=RequestContext(request))
})
def no_executables_error(request):
return render_to_response('codespeed/nodata.html', {
'message': 'There needs to be at least one executable'
}, context_instance=RequestContext(request))
})
def no_data_found(request):
return render_to_response('codespeed/nodata.html', {
'message': 'No data found'
}, context_instance=RequestContext(request))
})
@require_GET
......@@ -223,7 +222,7 @@ def comparison(request):
'selectedbaseline': selectedbaseline,
'selectedchart': selectedchart,
'selecteddirection': selecteddirection
}, context_instance=RequestContext(request))
})
@require_GET
......@@ -503,7 +502,7 @@ def timeline(request):
'defaultquarts': defaultquarts,
'defaultextr': defaultextr,
'use_median_bands': use_median_bands,
}, context_instance=RequestContext(request))
})
@require_GET
......@@ -577,7 +576,7 @@ def getchangestable(request):
'env': environment,
'prev': prevrev,
'next': nextrev,
}, context_instance=RequestContext(request))
})
@require_GET
......@@ -688,7 +687,7 @@ def changes(request):
'projectmatrix': projectmatrix,
'revisionlists': revisionlists,
'trends': trends,
}, context_instance=RequestContext(request))
})
@require_GET
......@@ -702,8 +701,7 @@ def reports(request):
colorcode__in=('red', 'green')
).order_by('-revision__date')[:10]
return render_to_response('codespeed/reports.html', context,
context_instance=RequestContext(request))
return render_to_response('codespeed/reports.html', context)
@require_GET
......@@ -753,8 +751,7 @@ def displaylogs(request):
{
'error': error, 'logs': logs,
'show_email_address': settings.SHOW_AUTHOR_EMAIL_ADDRESS
},
context_instance=RequestContext(request))
})
@csrf_exempt
......
Django>=1.6,<1.10
Django>=1.7,<2.0
isodate>=0.4.7,<0.6
matplotlib>=1.4.3,<2.0
......@@ -3,7 +3,6 @@
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASEDIR = os.path.abspath(os.path.dirname(__file__))
TOPDIR = os.path.split(BASEDIR)[1]
......@@ -39,10 +38,6 @@ ADMIN_MEDIA_PREFIX = '/static/admin/'
SECRET_KEY = 'as%n_m#)^vee2pe91^^@c))sl7^c6t-9r8n)_69%)2yt+(la2&'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
......@@ -54,34 +49,40 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = '{0}.urls'.format(TOPDIR)
TEMPLATE_DIRS = (
os.path.join(BASEDIR, 'templates'),
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.request',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASEDIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.staticfiles',
'codespeed',
)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASEDIR, "sitestatic")
STATICFILES_DIRS = (
os.path.join(BASEDIR, 'static'),
)
# Codespeed settings that can be overwritten here.
from codespeed.settings import *
# -*- coding: utf-8 -*-
import os.path
from django.conf import settings
from django.conf.urls import patterns, include
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^', include('codespeed.urls')),
)
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('codespeed.urls'))
]
if settings.DEBUG:
# needed for development server
......
......@@ -9,7 +9,7 @@ setup(
download_url="https://github.com/tobami/codespeed/tags",
license='GNU Lesser General Public License version 2.1',
keywords=['benchmarking', 'visualization'],
install_requires=['django>=1.6,<1.10', 'isodate>=0.4.7,<0.6', 'matplotlib>=1.4.3,<2.0'],
install_requires=['django>=1.8,<2.0', 'isodate>=0.4.7,<0.6', 'matplotlib>=1.4.3,<2.0'],
packages=find_packages(exclude=['ez_setup', 'sample_project']),
setup_requires=['setuptools-markdown'],
long_description_markdown_filename='README.md',
......
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