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

--profile-svg doesn't work on windows, fails silently #52

Open
enthdegree opened this issue Apr 2, 2017 · 5 comments
Open

--profile-svg doesn't work on windows, fails silently #52

enthdegree opened this issue Apr 2, 2017 · 5 comments

Comments

@enthdegree
Copy link

enthdegree commented Apr 2, 2017

pytest-profile uses pipes.py to create a pipe that converts a .prof file to an .svg using external programs, but pipes.py only produces posix-shell commands. The pipe is defined by pytest-profile as follows:

t = pipes.Template()
t.append("gprof2dot -f pstats $IN", "f-")
t.append("dot -Tsvg -o $OUT", "-f")
t.copy(self.combined, self.svg_name)

At the last line of the above snippet, pipes.py calls os.system( str_command ) with str_command being the following literal:

IN='<self.combined>'; gprof2dot -f pstats $IN |
{ OUT='<self.svg_name>'; dot -Tsvg -o $OUT; }

...which isn't valid Windows batch syntax.

@smarie
Copy link
Contributor

smarie commented Aug 2, 2017

Here is a temporary fix that worked for me: after the pytest run, execute the two following commands:

gprof2dot -f pstats prof/combined.prof > prof/tmp
dot -Tsvg -o prof/combined.svg prof/tmp

Note that for the 'dot' command to be available you need to install http://www.graphviz.org and add its bin directory to the path. The gprof2dot command is added to your python installation when you install pytest-profile.

@eeaston
Copy link
Collaborator

eeaston commented Mar 8, 2018

Hi guys, thanks for raising this. This is related in part to #70 in that it doesn't raise sensible errors when the dot executable is missing. Also you're right that we don't support Windows properly, this is on my list (just noticed these guys which looks promising https://www.appveyor.com )

@smarie
Copy link
Contributor

smarie commented Aug 2, 2019

For reference I fixed this in PR #99 by using a proper subprocess.Popen to have a real cross-platform interoperability.

@naught101
Copy link

This also happens on OSX - it says that the svg has been saved, but it hasn't.

@smarie
Copy link
Contributor

smarie commented Feb 3, 2021

PR #99 was merged a long time ago so the only thing that is missing is ... a new release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants