PDB and tests

57 views
Skip to first unread message

Tim Lahey

unread,
Jul 8, 2014, 10:04:17 PM7/8/14
to SymPy
Hi,

Is there an easy way to run a test and trace the execution in PDB?
There's a test that fails intermittently and I'd like to run it with a
specific seed (which I know causes it to fail), but I want to run it
inside of PDB. Is there an option for bin/tests for it or do I just have
to load PDB and then run the test?

Thanks,

Tim.

Jason Moore

unread,
Jul 8, 2014, 11:53:30 PM7/8/14
to sy...@googlegroups.com
I typically use `ipython --pdb` then import and run the specific test
in the interpreter.

Jason
moorepants.info
+01 530-601-9791
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/9CE9526F-276E-405C-82F2-BF6BDF592252%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Björn Dahlgren

unread,
Jul 11, 2014, 6:44:47 AM7/11/14
to sy...@googlegroups.com


On Wednesday, 9 July 2014 05:53:30 UTC+2, Jason Moore wrote:
I typically use `ipython --pdb` then import and run the specific test
in the interpreter.

I do something similar, but I prefer pudb (pip install pudb):

$ PYTHONPATH=../../.. python -c "from test_finite_diff import test_apply_finite_diff as test; import pudb; pudb.set_trace(); test()"


Aaron Meurer

unread,
Jul 20, 2014, 2:51:41 AM7/20/14
to sy...@googlegroups.com
There is a --pdb flag to the SymPy test runner. It would be nice to
have it support pudb too.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/8179446f-585b-48b2-bace-e9f1a4ae0598%40googlegroups.com.

Joachim Durchholz

unread,
Jul 20, 2014, 4:12:07 AM7/20/14
to sy...@googlegroups.com
Am 20.07.2014 08:51, schrieb Aaron Meurer:
> There is a --pdb flag to the SymPy test runner. It would be nice to
> have it support pudb too.

My understanding is that pudb uses the same mechanisms as pdb, so I'd
expect anything special for pdb to work for pudb as well.
Am I mistaken?

Regards,
Jo

Aaron Meurer

unread,
Jul 20, 2014, 2:40:59 PM7/20/14
to sy...@googlegroups.com
PuDB subclasses pdb, so it keeps the same interface, so it's just a
question of replacing pdb.set_trace or pdb.post_mortem with
pudb.set_trace and pudb.post_mortem.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/53CB79D3.50606%40durchholz.org.
Reply all
Reply to author
Forward
0 new messages