Skip to content

209: Testing argparse Applications

16 min Episode 209
209: Testing argparse Applications

Listen to “209: Testing argparse Applications”

Episode 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

ZARZA Studio — Your station on air today: library, music clock, schedule, studio and reports, from the browser.

Meet ZARZA Studio
— on air now — stations in the catalogue 2,025,417 podcasts — countries