Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: stdout is bytes on python3 #272

Open
wants to merge 75 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
753d53c
Custom PyPy about.html
tobami Jul 17, 2011
a80a280
Merge commit 'f5447b41ddd74e45af1a776369a8c0d474214b46' into pypy
tobami Jul 17, 2011
578ec57
Merge commit '7d966f80d3f331d80b2bce2364c0de591adf80d4' into pypy
tobami Jul 17, 2011
a7aaa64
Custom PyPy settings
tobami Jul 17, 2011
be786bd
Merge branch 'master' into pypy
tobami Jul 17, 2011
a6b36a0
Add custom PyPy homepage
tobami Jul 17, 2011
69d3f62
Add Google Analytics script
tobami Jul 17, 2011
5029db8
Add pointlabels jqplot plugin for Home page plot
tobami Jul 17, 2011
96160f3
Add PyPy favicon
tobami Jul 17, 2011
b7e214b
Add legend to first "home" plot
tobami Jul 17, 2011
5e0fecf
Merge remote branch 'origin/master' into pypy
tobami Jul 18, 2011
148f927
Merge remote branch 'origin/master' into pypy
tobami Jul 18, 2011
9f75a70
Don't choose a revision that doesn't have results for pypy-c-jit
tobami Jul 18, 2011
6016259
Improve pypy branch query, set WEBSITE_NAME and project name in template
tobami Aug 21, 2011
55030e2
Merge remote-tracking branch 'origin/master' into pypy
tobami Sep 4, 2011
eaea00d
Merge remote-tracking branch 'origin/master' into pypy
tobami Sep 4, 2011
224babe
Use the proper key for CPython data
tobami May 17, 2012
e491908
Invert plot 2
tobami Jun 8, 2012
2d9325e
Add reference to paper explaining geometric mean for normalized results
tobami Jun 8, 2012
51d4b63
exec wrapper script.
coderanger Jan 6, 2013
9da7418
unix is hard.
coderanger Jan 6, 2013
2084839
No really, I'm bad at unix.
coderanger Jan 6, 2013
b2056a7
Incrase the size of a field
Jan 7, 2013
5dfa14f
tilt xlabels on Plot 2
mattip Nov 28, 2014
301a98d
Merge pull request #1 from mattip/pypy
alex Nov 29, 2014
3875765
whoops
mattip Nov 29, 2014
85afa28
Merge pull request #2 from mattip/pypy
alex Nov 29, 2014
5a3bb8c
test, fix angling x-axis on cpythonplot2
mattip Dec 26, 2014
d5d8a0c
Merge pull request #3 from mattip/pypy
alex Dec 26, 2014
97f81b6
add a deploy-requirements.txt
ewdurbin Feb 22, 2019
36086d3
add wsgi entrypoint
ewdurbin Feb 22, 2019
4fc00dd
allow local_settings.py overrides
ewdurbin Feb 22, 2019
bcd4480
seems that this isn't handling Django > 1.4...
ewdurbin Feb 22, 2019
fa1abb4
don't use a relative import
ewdurbin Feb 22, 2019
b07808f
make it so
ewdurbin Feb 22, 2019
aae7f89
Custom PyPy about.html
tobami Jul 17, 2011
9c3ec4d
Custom PyPy settings
tobami Jul 17, 2011
34f7def
Add custom PyPy homepage
tobami Jul 17, 2011
ab6063c
Add Google Analytics script
tobami Jul 17, 2011
4adbb14
Add pointlabels jqplot plugin for Home page plot
tobami Jul 17, 2011
de207b9
Add PyPy favicon
tobami Jul 17, 2011
e2b197f
Add legend to first "home" plot
tobami Jul 17, 2011
209dab0
Don't choose a revision that doesn't have results for pypy-c-jit
tobami Jul 18, 2011
b5b96d1
Improve pypy branch query, set WEBSITE_NAME and project name in template
tobami Aug 21, 2011
3e9c67f
Use the proper key for CPython data
tobami May 17, 2012
23d5aaf
Invert plot 2
tobami Jun 8, 2012
c15ab3b
Add reference to paper explaining geometric mean for normalized results
tobami Jun 8, 2012
cdb2941
exec wrapper script.
coderanger Jan 6, 2013
10bec19
unix is hard.
coderanger Jan 6, 2013
29dec69
No really, I'm bad at unix.
coderanger Jan 6, 2013
92fd0b1
Incrase the size of a field
Jan 7, 2013
65a938d
tilt xlabels on Plot 2
mattip Nov 28, 2014
3de9041
whoops
mattip Nov 29, 2014
92d277d
test, fix angling x-axis on cpythonplot2
mattip Dec 26, 2014
bfccbec
add a deploy-requirements.txt
ewdurbin Feb 22, 2019
5f4eeed
add wsgi entrypoint
ewdurbin Feb 22, 2019
f15a605
allow local_settings.py overrides
ewdurbin Feb 22, 2019
f7cbe31
seems that this isn't handling Django > 1.4...
ewdurbin Feb 22, 2019
a586c60
don't use a relative import
ewdurbin Feb 22, 2019
1e08ed1
make it so
ewdurbin Feb 22, 2019
e411982
merge default into branch
mattip Apr 1, 2019
984b0d8
fix merge and update
mattip Apr 2, 2019
ba2fd71
ENH: handle environment for historical data
mattip Apr 3, 2019
a5beed6
merge speed.pypy.org from python/codespeed
mattip Apr 4, 2019
039f99e
remove file from old data model
mattip Apr 4, 2019
f3b5c84
fix merge
mattip Apr 4, 2019
4751450
move from sample_project to speed_pypy
mattip Apr 8, 2019
ffa154f
Merge pull request #1 from mattip/speed.pypy.org
ewdurbin Apr 8, 2019
e065bbd
Update wsgi.py
ewdurbin Apr 8, 2019
09aa41c
update manage.py settings
ewdurbin Apr 8, 2019
a709f47
make this directory so collectstatic doesn't complain
ewdurbin Apr 8, 2019
2f3ee82
BUG: stdout is bytes, convert to str
mattip Apr 19, 2019
47c2062
Merge pull request #2 from mattip/fix-hg
mattip May 7, 2019
5e1bdae
BUG: stdout is bytes on python3
mattip Apr 18, 2019
a4919d4
Merge branch 'speed.pypy.org' into mercurial
mattip May 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codespeed/commits/mercurial.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def getlogs(endrev, startrev):
if p.returncode != 0:
raise CommitLogError(str(stderr))
else:
stdout = stdout.rstrip('\n') # Remove last newline
stdout = stdout.decode('utf-8').rstrip('\n') # Remove last newline
logs = []
for log in stdout.split("=newlog=\n"):
elements = []
Expand Down
2 changes: 1 addition & 1 deletion codespeed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def get_changes_table(self, trend_depth=10, force_save=False):
val_max = "-"

# Calculate percentage change relative to previous result
result = resobj.value
result = max(resobj.value, 0)
change = "-"
if len(change_list):
c = change_list.filter(benchmark=bench)
Expand Down
2 changes: 1 addition & 1 deletion codespeed/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Default settings for Codespeed"""

## General default options ##
WEBSITE_NAME = "MySpeedSite" # This name will be used in the reports RSS feed
WEBSITE_NAME = "PyPy's Speed Center" # This name will be used in the reports RSS feed

DEF_ENVIRONMENT = None # Name of the environment which should be selected as default

Expand Down
2 changes: 1 addition & 1 deletion codespeed/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ div#presentation div.menubox {
}
div#presentation div.menubox:hover { border: 5px solid #FFCE9C; }

div#presentation p { height: 5em; padding-left: 120px; }
div#presentation div.menubox p { height: 5em; padding-left: 120px; }

div#presentation div#changes p {
background: url(../images/changes.png) no-repeat;
Expand Down
Binary file added codespeed/static/images/favicon.ico
Binary file not shown.
3 changes: 2 additions & 1 deletion codespeed/static/js/jqplot/jqplot.pointLabels.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions codespeed/tests/test_commits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import subprocess
import tempfile
import os

from django.test import TestCase, override_settings
from django.urls import reverse

from codespeed.models import (Project, Benchmark, Revision, Branch, Executable,
Environment, Result, Report)

hgdir = ''

def setUpModule():
global hgdir
hgdir = tempfile.TemporaryDirectory()
subprocess.check_call(['hg', 'init'], cwd=hgdir.name)
# Add some commits
readme = os.path.join(hgdir.name, 'README.md')
file1 = os.path.join(hgdir.name, 'file1.py')
with open(readme, 'w') as hg_file:
hg_file.write('readme')
subprocess.check_call(['hg', 'add', readme], cwd=hgdir.name)
subprocess.check_call(['hg', 'commit', '-m', "first commit"], cwd=hgdir.name)
with open(file1, 'w') as hg_file:
hg_file.write('value = 10')
subprocess.check_call(['hg', 'add', file1], cwd=hgdir.name)
subprocess.check_call(['hg', 'commit', '-m', "second commit"], cwd=hgdir.name)

def tearDownModule():
hgdir.cleanup()

class TestMercurial(TestCase):

def setUp(self):
self.days = 0
self.hgdir = hgdir.name
self.starttime = datetime.now() + timedelta(days=-100)

Project(repo_type='M', name='pro',
repo_path=str(self.hgdir)).save()
self.pro = Project.objects.get(name='pro')

Branch(project=self.pro, name='default').save()
self.b = Branch.objects.get(name='default')

Environment(name='Walden Pond').save()
Executable(name='walden', project=self.pro).save()
Benchmark(name='TestBench').save()

self.env = Environment.objects.get(name='Walden Pond')
self.exe = Executable.objects.get(name='walden')
self.bench = Benchmark.objects.get(name='TestBench')
cmd = ['hg', '-R', self.hgdir, 'id', '-r', '1']
self.cid = subprocess.check_output(cmd).split()[0]
Revision(commitid=self.cid.decode('utf-8'), date=self.starttime, branch=self.b,
project=self.pro).save()

def test_hg(self):
response = self.client.get(reverse('displaylogs'), {'revisionid':1})
assert response.status_code == 200, 'expected 200 got %d' % response.status_code
36 changes: 21 additions & 15 deletions codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,20 @@ def gethistoricaldata(request):
# Fetch Baseline data
baseline_exe = Executable.objects.get(
name=settings.DEF_BASELINE['executable'])
baseline_lastrev = Revision.objects.filter(
branch__project=baseline_exe.project).order_by('-date')[0]
baseline_revs = Revision.objects.filter(
branch__project=baseline_exe.project).order_by('-date')
baseline_lastrev = baseline_revs[0]
for rev in baseline_revs:
baseline_results = Result.objects.filter(
executable=baseline_exe, revision=rev, environment=env)
if baseline_results:
baseline_lastrev = rev
break
if len(baseline_results) == 0:
logger.error('Could not find results for {} rev="{}" env="{}"'.format(
baseline_exe, baseline_lastrev, env))
data['baseline'] = '{} {}'.format(
settings.DEF_BASELINE['executable'], baseline_lastrev.tag)
baseline_results = Result.objects.filter(
executable=baseline_exe, revision=baseline_lastrev, environment=env)

default_exe = Executable.objects.get(name=settings.DEF_EXECUTABLE)
default_branch = Branch.objects.get(
Expand All @@ -108,21 +116,24 @@ def gethistoricaldata(request):

# Fetch tagged revisions for default executable
default_taggedrevs = Revision.objects.filter(
branch=default_branch
).exclude(tag="").order_by('date')
data['tagged_revs'] = [rev.tag for rev in default_taggedrevs]
branch=default_branch
).exclude(tag="").order_by('date')
default_results = {}
for rev in default_taggedrevs:
default_results[rev.tag] = Result.objects.filter(
res = Result.objects.filter(
executable=default_exe, revision=rev, environment=env)

if not res:
logger.info('no results for %s %s %s' % (str(default_exe), str(rev), str(env)))
continue
default_results[rev.tag] = res
data['tagged_revs'] = [rev.tag for rev in default_taggedrevs if rev.tag in default_results]
# Fetch data for latest results
revs = Revision.objects.filter(
branch=default_branch).order_by('-date')[:5]
default_lastrev = None
for i in range(4):
default_lastrev = revs[i]
if default_lastrev.results.filter(executable=default_exe):
if default_lastrev.results.filter(executable=default_exe, environment=env):
break
default_lastrev = None
if default_lastrev is None:
Expand Down Expand Up @@ -892,7 +903,6 @@ def add_result(request):
return HttpResponseBadRequest(response)
else:
create_report_if_enough_data(response[0], response[1], response[2])
logger.debug("add_result: completed")
return HttpResponse("Result data saved successfully", status=202)


Expand All @@ -917,15 +927,11 @@ def add_json_results(request):
else:
unique_reports.add(response)

logger.debug("add_json_results: about to create reports")
for rep in unique_reports:
create_report_if_enough_data(rep[0], rep[1], rep[2])

logger.debug("add_json_results: completed")

return HttpResponse("All result data saved successfully", status=202)


def django_has_content_type():
return (django.VERSION[0] > 1 or
(django.VERSION[0] == 1 and django.VERSION[1] >= 6))
Expand Down
3 changes: 3 additions & 0 deletions deploy-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.
psycopg2==2.7.7
gunicorn==19.9.0
Binary file added example/override/static/images/favicon.ico
Binary file not shown.
Loading