Skip to content

Commit d35b595

Browse files
committed
Merge pull request tobami#192 from tobami/python3
Python3
2 parents 41c943b + 3eddfc1 commit d35b595

7 files changed

Lines changed: 40 additions & 29 deletions

File tree

.travis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
language: python
22
python:
3-
- "2.7"
4-
3+
- 2.6
4+
- 2.7
5+
- 3.4
56
env:
67
- DJANGO_VERSION=1.8.5
78
- DJANGO_VERSION=1.6.11
89
- DJANGO_VERSION=1.4.22
9-
10+
matrix:
11+
exclude:
12+
- python: 2.6
13+
env: DJANGO_VERSION=1.8.5
14+
- python: 3.4
15+
env: DJANGO_VERSION=1.4.22
1016
install:
1117
- pip install -q Django==$DJANGO_VERSION
1218
- python setup.py install
13-
14-
# command to run tests
1519
script:
1620
- python setup.py test
1721
- python manage.py test codespeed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
== Change Log ==
22

3+
=== Version 0.11a0 ===
4+
* NEW #191: Django 1.7 and 1.8 support
5+
* NEW #192: Python 3.4 support
6+
* FIX #190: Upgrade to jqPlot 1.0.8 and jQuery 1.8
7+
8+
39
=== Version 0.10.1, November 1, 2015 ===
410
* NEW #169: nomeata added admin action to recalculate reports
511
* NEW #169: nomeata increased allowed length for benchmark names to 100 chars

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Codespeed
22
[![Build Status](https://travis-ci.org/tobami/codespeed.png?branch=master)](https://travis-ci.org/tobami/codespeed)
33

4-
A web application to monitor and analyze the performance of your code.
4+
Codespeed is a web application to monitor and analyze the performance of your code.
55

6-
Known to be used by [PyPy](http://speed.pypy.org), [Twisted](http://speed.twistedmatrix.com), [RubySpec](http://speed.rubyspec.org) and many more.
6+
Known to be used by [PyPy](http://speed.pypy.org), [Twisted](http://speed.twistedmatrix.com) and others.
77

88
For an overview of some application concepts see the [wiki page](https://github.com/tobami/codespeed/wiki/Overview)
99

1010
# Installation
1111

12-
You will need Python 2.7.
12+
You will need Python 2.7 or 3.4+.
1313

1414
To install dependencies and the codespeed Django app:
1515

@@ -33,13 +33,9 @@ can take a long time. Please be patient.
3333
the data to a database named `data.db`
3434
* Create the DB by typing from the root directory:
3535

36-
python manage.py syncdb
37-
38-
* Create an admin user in the process.
39-
* Execute DB migrations:
40-
4136
python manage.py migrate
4237

38+
* Create an admin user in the process.
4339
* For testing purposes, you can now start the development server:
4440

4541
python manage.py runserver 8000

codespeed/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def retrieve_revision(commit_id, username, project, revision=None):
3838
if commit_json is None:
3939
try:
4040
commit_json = json.load(urllib.urlopen(commit_url))
41-
except IOError, e:
41+
except IOError as e:
4242
logger.exception("Unable to load %s: %s",
4343
commit_url, e, exc_info=True)
4444
raise e

codespeed/tests/test_views.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_add_correct_result(self):
3636

3737
# Check that we get a success response
3838
self.assertEquals(response.status_code, 202)
39-
self.assertEquals(response.content, "Result data saved successfully")
39+
self.assertEquals(response.content.decode(), "Result data saved successfully")
4040

4141
# Check that the data was correctly saved
4242
e = Environment.objects.get(name='Dual Core')
@@ -68,7 +68,7 @@ def test_add_non_default_result(self):
6868
modified_data['min'] = 1.0
6969
response = self.client.post(self.path, modified_data)
7070
self.assertEquals(response.status_code, 202)
71-
self.assertEquals(response.content, "Result data saved successfully")
71+
self.assertEquals(response.content.decode(), "Result data saved successfully")
7272
e = Environment.objects.get(name='Dual Core')
7373
p = Project.objects.get(name='MyProject')
7474
branch = Branch.objects.get(name='default', project=p)
@@ -96,7 +96,8 @@ def test_bad_environment(self):
9696
self.data['environment'] = bad_name
9797
response = self.client.post(self.path, self.data)
9898
self.assertEquals(response.status_code, 400)
99-
self.assertEquals(response.content, "Environment " + bad_name + " not found")
99+
self.assertEquals(response.content.decode(),
100+
"Environment " + bad_name + " not found")
100101
self.data['environment'] = 'Dual Core'
101102

102103
def test_empty_argument(self):
@@ -107,7 +108,7 @@ def test_empty_argument(self):
107108
response = self.client.post(self.path, self.data)
108109
self.assertEquals(response.status_code, 400)
109110
self.assertEquals(
110-
response.content, 'Value for key "' + key + '" empty in request')
111+
response.content.decode(), 'Value for key "' + key + '" empty in request')
111112
self.data[key] = backup
112113

113114
def test_missing_argument(self):
@@ -118,7 +119,7 @@ def test_missing_argument(self):
118119
response = self.client.post(self.path, self.data)
119120
self.assertEquals(response.status_code, 400)
120121
self.assertEquals(
121-
response.content, 'Key "' + key + '" missing from request')
122+
response.content.decode(), 'Key "' + key + '" missing from request')
122123
self.data[key] = backup
123124

124125
def test_report_is_not_created(self):
@@ -155,7 +156,7 @@ def test_add_result_with_no_project(self):
155156
modified_data['executable'] = "My new executable"
156157
response = self.client.post(self.path, modified_data)
157158
self.assertEquals(response.status_code, 202)
158-
self.assertEquals(response.content, "Result data saved successfully")
159+
self.assertEquals(response.content.decode(), "Result data saved successfully")
159160

160161

161162
class TestAddJSONResults(TestCase):
@@ -212,7 +213,7 @@ def test_add_correct_results(self):
212213

213214
# Check that we get a success response
214215
self.assertEquals(response.status_code, 202)
215-
self.assertEquals(response.content,
216+
self.assertEquals(response.content.decode(),
216217
"All result data saved successfully")
217218

218219
# Check that the data was correctly saved
@@ -265,7 +266,7 @@ def test_bad_environment(self):
265266
{'json': json.dumps(self.data)})
266267

267268
self.assertEquals(response.status_code, 400)
268-
self.assertEquals(response.content, "Environment " + bad_name + " not found")
269+
self.assertEquals(response.content.decode(), "Environment " + bad_name + " not found")
269270
data['environment'] = 'bigdog'
270271

271272
def test_empty_argument(self):
@@ -277,7 +278,7 @@ def test_empty_argument(self):
277278
response = self.client.post(self.path,
278279
{'json': json.dumps(self.data)})
279280
self.assertEquals(response.status_code, 400)
280-
self.assertEquals(response.content, 'Value for key "' + key + '" empty in request')
281+
self.assertEquals(response.content.decode(), 'Value for key "' + key + '" empty in request')
281282
data[key] = backup
282283

283284
def test_missing_argument(self):
@@ -289,7 +290,7 @@ def test_missing_argument(self):
289290
response = self.client.post(self.path,
290291
{'json': json.dumps(self.data)})
291292
self.assertEquals(response.status_code, 400)
292-
self.assertEquals(response.content, 'Key "' + key + '" missing from request')
293+
self.assertEquals(response.content.decode(), 'Key "' + key + '" missing from request')
293294
data[key] = backup
294295

295296
def test_report_is_created(self):
@@ -335,7 +336,7 @@ def test_gettimelinedata(self):
335336
}
336337
response = self.client.get(path, data)
337338
self.assertEquals(response.status_code, 200)
338-
responsedata = json.loads(response.content)
339+
responsedata = json.loads(response.content.decode())
339340
self.assertEquals(
340341
responsedata['error'], "None", "there should be no errors")
341342
self.assertEquals(
@@ -379,9 +380,10 @@ def test_reports(self):
379380
response = self.client.get(reverse('codespeed.views.reports'))
380381

381382
self.assertEqual(response.status_code, 200)
382-
self.assertIn('Latest Results', response.content)
383-
self.assertIn('Latest Significant Results', response.content)
384-
self.assertIn(self.data['commitid'], response.content)
383+
content = response.content.decode()
384+
self.assertIn('Latest Results', content)
385+
self.assertIn('Latest Significant Results', content)
386+
self.assertIn(self.data['commitid'], content)
385387

386388
def test_reports_post_returns_405(self):
387389
response = self.client.post(reverse('codespeed.views.reports'), {})

codespeed/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def gettimelinedata(request):
234234
Http404()
235235

236236
benchmarks = []
237-
number_of_revs = data.get('revs', 10)
237+
number_of_revs = int(data.get('revs', 10))
238238

239239
if data['ben'] == 'grid':
240240
benchmarks = Benchmark.objects.all().order_by('name')

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
'Operating System :: OS Independent',
2323
'Programming Language :: Python',
2424
'Programming Language :: Python :: 2',
25+
'Programming Language :: Python :: 2.6',
2526
'Programming Language :: Python :: 2.7',
27+
'Programming Language :: Python :: 3',
28+
'Programming Language :: Python :: 3.4',
2629
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
2730
]
2831
)

0 commit comments

Comments
 (0)