Skip to content

Commit

Permalink
Merge pull request #192 from tobami/python3
Browse files Browse the repository at this point in the history
Python3
  • Loading branch information
tobami committed Nov 1, 2015
2 parents 41c943b + 3eddfc1 commit d35b595
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 29 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion codespeed/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 16 additions & 14 deletions codespeed/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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'), {})
Expand Down
2 changes: 1 addition & 1 deletion codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
)

0 comments on commit d35b595

Please sign in to comment.