Test & Code

125: pytest 6 - Anthony Sottile


Listen Later

pytest 6 is out. Specifically, 6.0.1, as of July 31.

And there's lots to be excited about.
Anthony Sottile joins the show to discuss features, improvements, documentation updates and more.

Full release notes / changelog

Some of what we talk about:

  • How to update (at least, how I do it)
    • Run your test suites with 5.4.3 or whatever the last version you were using
    • Update to 6
    • Run again. Same output? Probably good.
    • If there are any warnings, maybe fix those.
    • You can also run with pytest -W error to turn warnings into errors.
    • Then find out all the cool stuff you can do now
    • New Features
      • pytest now supports pyproject.toml files for configuration.
        • but remember, toml syntax is different than ini files. mostly quotes are needed
        • pytest now includes inline type annotations and exposes them to user programs.
          • Most of the user-facing API is covered, as well as internal code.
          • New command-line flags --no-header and --no-summary
          • A warning is now shown when an unknown key is read from a config INI file.
            • The --strict-config flag has been added to treat these warnings as errors.
            • New required_plugins configuration option allows the user to specify a list of plugins,
            • including version information, that are required for pytest to run.
              An error is raised if any required plugins are not found when running pytest.
            • Improvements
              • You can now pass output to things like less and head that close the pipe passed to them.
                • thank you!!!
                • Improved precision of test durations measurement.
                  • use --durations=10 -vv to capture and show durations
                  • Rich comparison for dataclasses and attrs-classes is now recursive.
                  • pytest --version now displays just the pytest version,
                    • while pytest --version --version displays more verbose information including plugins.
                    • --junitxml now includes the exception cause in the message XML
                    • attribute for failures during setup and teardown.
                    • Improved Documentation
                      • Add a note about --strict and --strict-markers and the preference for the latter one.
                      • Explain indirect parametrization and markers for fixtures.
                      • Bug Fixes
                      • Deprecations
                      • Trivial/Internal Changes
                      • Breaking Changes you might need to care about before upgrading
                        • PytestDeprecationWarning are now errors by default.
                          • Check the deprecations and removals
                          • page if you are curious.
                          • -k and -m internals were rewritten to stop using eval(), this results in a few slight changes but overall makes them much more consistent
                          • testdir.run().parseoutcomes() now always returns the parsed nouns in plural form.
                            • I'd say that's an improvement
                            • Special Guest: Anthony Sottile.

                              Sponsored By:

                              • Datadog: Modern monitoring & security. See inside any stack, any app, at any scale, anywhere.
                              Visit testandcode.com/datadog to get started.

                              Links:

                              • pytest Changelog / Release Notes
                              • Deprecations and Removals — pytest documentation
                              ★ Support this podcast on Patreon ★
                              ...more
                              View all episodesView all episodes
                              Download on the App Store

                              Test & CodeBy Brian Okken

                              • 4.7
                              • 4.7
                              • 4.7
                              • 4.7
                              • 4.7

                              4.7

                              70 ratings


                              More shows like Test & Code

                              View all
                              Software Engineering Radio - the podcast for professional software developers by se-radio@computer.org

                              Software Engineering Radio - the podcast for professional software developers

                              272 Listeners

                              The Changelog: Software Development, Open Source by Changelog Media

                              The Changelog: Software Development, Open Source

                              283 Listeners

                              Thoughtworks Technology Podcast by Thoughtworks

                              Thoughtworks Technology Podcast

                              41 Listeners

                              Data Skeptic by Kyle Polich

                              Data Skeptic

                              483 Listeners

                              Talk Python To Me by Michael Kennedy

                              Talk Python To Me

                              592 Listeners

                              Software Engineering Daily by Software Engineering Daily

                              Software Engineering Daily

                              624 Listeners

                              Soft Skills Engineering by Jamison Dance and Dave Smith

                              Soft Skills Engineering

                              269 Listeners

                              Python Bytes by Michael Kennedy and Brian Okken

                              Python Bytes

                              213 Listeners

                              Data Engineering Podcast by Tobias Macey

                              Data Engineering Podcast

                              142 Listeners

                              Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

                              Syntax - Tasty Web Development Treats

                              982 Listeners

                              Practical AI by Practical AI LLC

                              Practical AI

                              190 Listeners

                              The Stack Overflow Podcast by The Stack Overflow Podcast

                              The Stack Overflow Podcast

                              64 Listeners

                              The Real Python Podcast by Real Python

                              The Real Python Podcast

                              140 Listeners

                              Oxide and Friends by Oxide Computer Company

                              Oxide and Friends

                              47 Listeners

                              The Pragmatic Engineer by Gergely Orosz

                              The Pragmatic Engineer

                              52 Listeners