Exploring Python Inspect: Enriching Stack Traces and Testing the Untestable
- Track:
- Python Core, Internals, Extensions
- Type:
- Talk
- Level:
- intermediate
- Room:
- S3B
- Start:
- 11:40 on Wednesday, 15 July 2026
- End:
- 12:10 on Wednesday, 15 July 2026
- Duration:
- 30 minutes
Abstract
If your stack traces are missing crucial information about the runtime state of your program(s) or if you are developing tests which assert beyond the possibilities of common testing frameworks, then Python's inspect module can help you out. The inspect standard library puts the power to analyze the current execution context at your fingertips. For instance, you can supercharge your stack traces by enriching them with relevant variable values from any level of the call stack, saving you valuable time trying to debug and reproduce critical issues. In addition, inspect makes it easy to perform complex assertions about the execution of your code, such as from where a function is being called, whether a nested function behaves correctly, and what signature and context generated functions have.