From f4247ddd7d5a3bfd794d07bc353a102e2dfe3653 Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Sun, 1 Nov 2015 18:25:04 +0100 Subject: [PATCH 1/6] Fix old-style exception handling --- codespeed/github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codespeed/github.py b/codespeed/github.py index 10444f29..0f73c78f 100644 --- a/codespeed/github.py +++ b/codespeed/github.py @@ -38,7 +38,7 @@ def retrieve_revision(commit_id, username, project, revision=None): if commit_json is None: try: commit_json = json.load(urllib.urlopen(commit_url)) - except IOError, e: + except IOError as e: logger.exception("Unable to load %s: %s", commit_url, e, exc_info=True) raise e From fb96a701df6dcfa4dfcb5d1621593c6167159c79 Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Sun, 1 Nov 2015 18:28:23 +0100 Subject: [PATCH 2/6] Use response.content.decode intests for P3K compatibility --- codespeed/tests/test_views.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/codespeed/tests/test_views.py b/codespeed/tests/test_views.py index bcafaad4..b1daad3e 100644 --- a/codespeed/tests/test_views.py +++ b/codespeed/tests/test_views.py @@ -36,7 +36,7 @@ def test_add_correct_result(self): # Check that we get a success response self.assertEquals(response.status_code, 202) - self.assertEquals(response.content, "Result data saved successfully") + self.assertEquals(response.content.decode(), "Result data saved successfully") # Check that the data was correctly saved e = Environment.objects.get(name='Dual Core') @@ -68,7 +68,7 @@ def test_add_non_default_result(self): modified_data['min'] = 1.0 response = self.client.post(self.path, modified_data) self.assertEquals(response.status_code, 202) - self.assertEquals(response.content, "Result data saved successfully") + self.assertEquals(response.content.decode(), "Result data saved successfully") e = Environment.objects.get(name='Dual Core') p = Project.objects.get(name='MyProject') branch = Branch.objects.get(name='default', project=p) @@ -96,7 +96,8 @@ def test_bad_environment(self): self.data['environment'] = bad_name response = self.client.post(self.path, self.data) self.assertEquals(response.status_code, 400) - self.assertEquals(response.content, "Environment " + bad_name + " not found") + self.assertEquals(response.content.decode(), + "Environment " + bad_name + " not found") self.data['environment'] = 'Dual Core' def test_empty_argument(self): @@ -107,7 +108,7 @@ def test_empty_argument(self): response = self.client.post(self.path, self.data) self.assertEquals(response.status_code, 400) self.assertEquals( - response.content, 'Value for key "' + key + '" empty in request') + response.content.decode(), 'Value for key "' + key + '" empty in request') self.data[key] = backup def test_missing_argument(self): @@ -118,7 +119,7 @@ def test_missing_argument(self): response = self.client.post(self.path, self.data) self.assertEquals(response.status_code, 400) self.assertEquals( - response.content, 'Key "' + key + '" missing from request') + response.content.decode(), 'Key "' + key + '" missing from request') self.data[key] = backup def test_report_is_not_created(self): @@ -155,7 +156,7 @@ def test_add_result_with_no_project(self): modified_data['executable'] = "My new executable" response = self.client.post(self.path, modified_data) self.assertEquals(response.status_code, 202) - self.assertEquals(response.content, "Result data saved successfully") + self.assertEquals(response.content.decode(), "Result data saved successfully") class TestAddJSONResults(TestCase): @@ -212,7 +213,7 @@ def test_add_correct_results(self): # Check that we get a success response self.assertEquals(response.status_code, 202) - self.assertEquals(response.content, + self.assertEquals(response.content.decode(), "All result data saved successfully") # Check that the data was correctly saved @@ -265,7 +266,7 @@ def test_bad_environment(self): {'json': json.dumps(self.data)}) self.assertEquals(response.status_code, 400) - self.assertEquals(response.content, "Environment " + bad_name + " not found") + self.assertEquals(response.content.decode(), "Environment " + bad_name + " not found") data['environment'] = 'bigdog' def test_empty_argument(self): @@ -277,7 +278,7 @@ def test_empty_argument(self): response = self.client.post(self.path, {'json': json.dumps(self.data)}) self.assertEquals(response.status_code, 400) - self.assertEquals(response.content, 'Value for key "' + key + '" empty in request') + self.assertEquals(response.content.decode(), 'Value for key "' + key + '" empty in request') data[key] = backup def test_missing_argument(self): @@ -289,7 +290,7 @@ def test_missing_argument(self): response = self.client.post(self.path, {'json': json.dumps(self.data)}) self.assertEquals(response.status_code, 400) - self.assertEquals(response.content, 'Key "' + key + '" missing from request') + self.assertEquals(response.content.decode(), 'Key "' + key + '" missing from request') data[key] = backup def test_report_is_created(self): @@ -335,7 +336,7 @@ def test_gettimelinedata(self): } response = self.client.get(path, data) self.assertEquals(response.status_code, 200) - responsedata = json.loads(response.content) + responsedata = json.loads(response.content.decode()) self.assertEquals( responsedata['error'], "None", "there should be no errors") self.assertEquals( @@ -379,9 +380,10 @@ def test_reports(self): response = self.client.get(reverse('codespeed.views.reports')) self.assertEqual(response.status_code, 200) - self.assertIn('Latest Results', response.content) - self.assertIn('Latest Significant Results', response.content) - self.assertIn(self.data['commitid'], response.content) + content = response.content.decode() + self.assertIn('Latest Results', content) + self.assertIn('Latest Significant Results', content) + self.assertIn(self.data['commitid'], content) def test_reports_post_returns_405(self): response = self.client.post(reverse('codespeed.views.reports'), {}) From b64029ee7ce8de0c4871ac4caf608208ea2c9a07 Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Sun, 1 Nov 2015 18:30:20 +0100 Subject: [PATCH 3/6] Cast revs url parameter to int --- codespeed/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codespeed/views.py b/codespeed/views.py index 07e4a4b1..1bf22393 100644 --- a/codespeed/views.py +++ b/codespeed/views.py @@ -234,7 +234,7 @@ def gettimelinedata(request): Http404() benchmarks = [] - number_of_revs = data.get('revs', 10) + number_of_revs = int(data.get('revs', 10)) if data['ben'] == 'grid': benchmarks = Benchmark.objects.all().order_by('name') From 07947ff8305a21775ab76a9d506d53f64c52875a Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Sun, 1 Nov 2015 18:33:44 +0100 Subject: [PATCH 4/6] Add Python 3.4 to travis matrix. Re-add 2.6 --- .travis.yml | 14 +++++++++----- setup.py | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b0b57ce..f62daf4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,21 @@ language: python python: - - "2.7" - + - 2.6 + - 2.7 + - 3.4 env: - DJANGO_VERSION=1.8.5 - DJANGO_VERSION=1.6.11 - DJANGO_VERSION=1.4.22 - +matrix: + exclude: + - python: 2.6 + env: DJANGO_VERSION=1.8.5 + - python: 3.4 + env: DJANGO_VERSION=1.4.22 install: - pip install -q Django==$DJANGO_VERSION - python setup.py install - -# command to run tests script: - python setup.py test - python manage.py test codespeed diff --git a/setup.py b/setup.py index 3f7238f9..c0a67aa9 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,10 @@ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', ] ) From 7bd2b211387e76a193a3798b5ebedf1fe8b273af Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Sun, 1 Nov 2015 18:49:44 +0100 Subject: [PATCH 5/6] Add Python 3.4 support to README --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f88c899a..257d5ef9 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ # Codespeed [![Build Status](https://travis-ci.org/tobami/codespeed.png?branch=master)](https://travis-ci.org/tobami/codespeed) -A web application to monitor and analyze the performance of your code. +Codespeed is a web application to monitor and analyze the performance of your code. -Known to be used by [PyPy](http://speed.pypy.org), [Twisted](http://speed.twistedmatrix.com), [RubySpec](http://speed.rubyspec.org) and many more. +Known to be used by [PyPy](http://speed.pypy.org), [Twisted](http://speed.twistedmatrix.com) and others. For an overview of some application concepts see the [wiki page](https://github.com/tobami/codespeed/wiki/Overview) # Installation -You will need Python 2.7. +You will need Python 2.7 or 3.4+. To install dependencies and the codespeed Django app: @@ -33,13 +33,9 @@ can take a long time. Please be patient. the data to a database named `data.db` * Create the DB by typing from the root directory: - python manage.py syncdb - -* Create an admin user in the process. -* Execute DB migrations: - python manage.py migrate +* Create an admin user in the process. * For testing purposes, you can now start the development server: python manage.py runserver 8000 From 3eddfc1e7b21d079bc571a7108357a86355927b5 Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Sun, 1 Nov 2015 18:52:44 +0100 Subject: [PATCH 6/6] Update CHANGELOG --- CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index c206dde0..66275b74 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ == Change Log == +=== Version 0.11a0 === +* NEW #191: Django 1.7 and 1.8 support +* NEW #192: Python 3.4 support +* FIX #190: Upgrade to jqPlot 1.0.8 and jQuery 1.8 + + === Version 0.10.1, November 1, 2015 === * NEW #169: nomeata added admin action to recalculate reports * NEW #169: nomeata increased allowed length for benchmark names to 100 chars