[Cubicweb] a py.test extension to gather DeprecatedWarnings

Laurent Peuch cortex at worlddomination.be
Thu May 2 15:44:34 CEST 2019


I promise, it's the last email (for now :p). When migrating a cube to
a newest version of cubicweb and its dependencies, one of the main
process is to look for DeprecatedWarnings (and
PendingDeprecatedWarnings) in py.test output. I don't know for you,
but the projects I've been working on have several hundreds if not
thousand lines of output in which to find those warnings and it's
prety unpracticable. So, I've made a py.test extension for that!

This extension gather all DeprecatedWarnings (and
PendingDeprecatedWarnings), sorted them, only keep one of each
iteration and print them all at once at the end of the test so you
don't have to look for them. It also saves them in a log file.

And it's super easy to uses!


    pip install pytest-capture-deprecatedwarnings 

And that's done, it will be automtically be used on the next launch of

Example screenshot https://raw.githubusercontent.com/Psycojoker/pytest-capture-deprecatedwarnings/master/screenshot.png

It's not done at all but that opens the way for:
- saving those warnings as json/data for further analysis (dashboard?)
- when possible automatic patch generation
- adding tests to ensure that there are no DeprecatedWarnings!

That's all for today folks,


Laurent Peuch -- Bram

More information about the Cubicweb mailing list