Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 1.47 KB

File metadata and controls

44 lines (36 loc) · 1.47 KB
layout title
page
Testing, debugging, and profiling

Prerequisites {.prereq}

This lesson covers testing, debugging and optimization of Python code. If you have basic knowledge of Python and numpy (mostly used for illustrating examples), then you are ready to go.

If you have already written a test suite, used a symbolic debugger and profiled your Python code to find performance bottlenecks, then this lesson is probably too basic for you.

Getting ready {.getready}

This lesson is based on Python 3, numpy, and ipython (or the jupyter notebook) and introduces a few tools: pytest, line_profiler, and snakeviz (all included in a standard installation of Anaconda).

Material: Example files (zip)

Topics

  1. Introduction

Part 1: Testing

  1. Exceptions
  2. Assertions
  3. Unit tests
  4. Running tests with pytest
  5. Summary

Part 2: Debugging

  1. Introduction
  2. Post-mortem debugging
  3. Step-by-step debugging

Part 3: Profiling

  1. Introduction
  2. Total runtime measurements
  3. Detailed runtime measurements