Monthly Archives: August 2014

Testing and profiling Python code simultaneously using pytest and cProfile

I’ve been using pytest for a few months now to help me to test individual functions and algorithms as I develop them.  So far I’ve been impressed by how easy it is to setup my tests.  Reading some of my previous posts would tell you that I like optimising code for speed (perhaps a little too much for my own good).  One particular algorithm was taking several minutes for each test case, so of course I had to fix this. Continue reading