[py-dev] using Python profiler with py.test
holger krekel
hpk at trillke.net
Fri Mar 4 08:06:15 CET 2005
Hi Matthew!
On Thu, Mar 03, 2005 at 13:39 -0600, Matthew Scott wrote:
> I'm having problems using the Python profiler with py.test
>
> If I write a simple one-liner as 'hello.py':
>
> import py; print py.path.local()
>
> Then run "python2.4 -m profile hello.py", I get a report from the profiler.
>
> However, if I run "python2.4 -m profile bin/py.test" from within the py
> directory, I get the output below.
>
> Any ideas or tips on using the Python profiler with py.test?
Hum, i can reproduce your problem but am not sure exactly what is
going on. If i take out the triggering assertion in profile.py
then it seems to work. Maybe the assertion somehow triggers
because of the lazy module loading in py/initpkg.py. Forgive me,
but I am not in the mood currently to examine how profile.py works ...
Anyway, i think that we should rather try to incorporate
hotshot rather than profile directly into py.test as this is the
recommended way of doing profiling these days ASFAIK. (Btw, I assume
we want to profile the tested application and not py.test itself ...)
Do you have a suggestion for a cmdline-API?
cheers,
holger
More information about the Pytest-dev
mailing list