How to Run a Python Program with Warnings Without Ignoring Them? or Best Way to Handle Warnings When

20 Replies, 1186 Views

Pro tip: Use `pytest` with `-p no:warnings` to suppress ‘em during tests, but keep `-W default` for normal runs.

Kinda niche, but if you python run program with warnings *sometimes*, this keeps things clean.

Also, `catch_warnings` context manager is great for temporary silencing.

Messages In This Thread



Users browsing this thread: 1 Guest(s)