Test & Code - Python Testing & Development
209: Testing argparse Applications
- Author: Vários
- Narrator: Vários
- Publisher: Podcast
- Duration: 0:16:19
- More information
Informações:
Synopsis
How do you test the argument parsing bit of an application that uses argparse?This episode covers:Design for Test: Structuring your app or script so it's easier to test.pytest & capsys for testing stdoutAdding debug and preview flags for debugging and testingAnd reverting to subprocess.run if you can't modify the code under testAlso, there's a full writeup and code samples available:Blog post: Testing argparse Applications Code Repo