It's generally good practice to run unit tests with warnings turned into errors to ensure deprecation warnings are honoured in a timely manner. Despite often coming across people saying that this can be done with a command line flag, after a bit of searching around I couldn't find a simple example of how to do this.
After a bit of trial and error it turns out to be very simple:
python -W error foo.py
The above flag will turn all warnings into errors.
For more complex usage Doug Hellman has a good write up: http://doughellmann.com/PyMOTW/warnings/
No comments:
Post a Comment