Skip to content
This repository has been archived by the owner on Dec 9, 2021. It is now read-only.

Commit

Permalink
FIX #1: universal_newlines and add tests around flamegrph.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Lopker committed Oct 18, 2015
1 parent be4c01c commit bcc4a3a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Makefile
Expand Up @@ -7,14 +7,15 @@ endef

VERSION ?= $(shell python -c '$(VERSION_SCR)')
EXBIN = example/env/bin
PYTHON ?= python

all: test

example: example/env
$(EXBIN)/python example/manage.py runserver --nothreading --noreload

example/env:
virtualenv example/env
virtualenv --python=$(PYTHON) example/env
$(EXBIN)/pip install -r example/requirements.txt
$(EXBIN)/pip install -e `pwd`
$(EXBIN)/python example/manage.py migrate
Expand Down Expand Up @@ -43,7 +44,7 @@ lint:
flake8 djdt_flamegraph tests

test:
tox -e py27
tox

release:
@$(MAKE) test
Expand Down
1 change: 0 additions & 1 deletion djdt_flamegraph/flamegraph.pl
Expand Up @@ -598,7 +598,6 @@ sub flow {
<![CDATA[
var details, searchbtn, matchedtxt, svg;
function init(evt) {
console.log('yo')
details = document.getElementById("details").firstChild;
searchbtn = document.getElementById("search");
matchedtxt = document.getElementById("matched");
Expand Down
3 changes: 2 additions & 1 deletion djdt_flamegraph/flamegraph.py
Expand Up @@ -11,6 +11,7 @@ def stats_to_svg(stats):
args=[FLAMEGRAPH_PL, '--title', ' '],
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT,
universal_newlines=True)
out, _ = proc.communicate(stats)
return out
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -16,7 +16,7 @@

setup(
name='djdt_flamegraph',
version='0.2.7',
version='0.2.9',
description='Flamegraphs for Django Debug Toolbar',
long_description=readme + '\n\n' + history,
author='Bo Lopker',
Expand Down
7 changes: 5 additions & 2 deletions tests/test_djdt_flamegraph.py
Expand Up @@ -9,15 +9,18 @@

from djdt_flamegraph import djdt_flamegraph
from djdt_flamegraph import FlamegraphPanel
from djdt_flamegraph import flamegraph


class TestDjdtFlamegraph(unittest.TestCase):

def setUp(self):
pass

def tearDown(self):
pass
def test_subprocess(self):
stack = 'unix`_sys_sysenter_post_swapgs;genunix`close 5'
res = flamegraph.stats_to_svg(stack)
self.assertIn('svg version="1.1"', res)

def test_000_something(self):
pass

0 comments on commit bcc4a3a

Please sign in to comment.