Friday, August 7, 2020

Test and Code: 125: pytest 6 - Anthony Sottile

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.
    • -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:

Support Test & Code : Python Testing for Software Engineering

Links:

<p>pytest 6 is out. Specifically, 6.0.1, as of July 31.<br><br> And there&#39;s lots to be excited about.<br> Anthony Sottile joins the show to discuss features, improvements, documentation updates and more.</p> <p><a href="https://ift.tt/3iiIaVt" rel="nofollow">Full release notes / changelog</a></p> <p>Some of what we talk about:</p> <ul> <li>How to update (at least, how I do it) <ul> <li>Run your test suites with 5.4.3 or whatever the last version you were using</li> <li>Update to 6</li> <li>Run again. Same output? Probably good.</li> <li>If there are any warnings, maybe fix those.</li> <li>You can also run with <code>pytest -W error</code> to turn warnings into errors.</li> <li>Then find out all the cool stuff you can do now</li> </ul></li> <li>New Features <ul> <li>pytest now supports pyproject.toml files for configuration. <ul> <li>but remember, toml syntax is different than ini files. mostly quotes are needed </li> </ul></li> <li>pytest now includes inline type annotations and exposes them to user programs. <ul> <li>Most of the user-facing API is covered, as well as internal code.</li> </ul></li> <li>New command-line flags <code>--no-header</code> and <code>--no-summary</code></li> <li>A warning is now shown when an unknown key is read from a config INI file. <ul> <li>The <code>--strict-config</code> flag has been added to treat these warnings as errors.</li> </ul></li> <li>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.</li> </ul></li> <li>Improvements <ul> <li>You can now pass output to things like less and head that close the pipe passed to them. <ul> <li>thank you!!!</li> </ul></li> <li>Improved precision of test durations measurement. <ul> <li>use <code>--durations=10 -vv</code> to capture and show durations</li> </ul></li> <li>Rich comparison for dataclasses and attrs-classes is now recursive.</li> <li>pytest <code>--version</code> now displays just the pytest version, <ul> <li>while <code>pytest --version --version</code> displays more verbose information including plugins. </li> </ul></li> <li><code>--junitxml</code> now includes the exception cause in the message XML attribute for failures during setup and teardown.</li> </ul></li> <li>Improved Documentation <ul> <li>Add a note about <code>--strict</code> and <code>--strict-markers</code> and the preference for the latter one.</li> <li>Explain indirect parametrization and markers for fixtures.</li> </ul></li> <li>Bug Fixes</li> <li>Deprecations</li> <li>Trivial/Internal Changes</li> <li>Breaking Changes you might need to care about before upgrading <ul> <li>PytestDeprecationWarning are now errors by default. <ul> <li>Check the <a href="https://ift.tt/2xmALPt" rel="nofollow">deprecations and removals</a> page if you are curious.</li> </ul></li> <li><code>-k</code> and <code>-m</code> internals were rewritten to stop using eval(), this results in a few <em>slight</em> changes but overall makes them much more consistent</li> <li><code>testdir.run().parseoutcomes()</code> now always returns the parsed nouns in plural form. <ul> <li>I&#39;d say that&#39;s an improvement</li> </ul></li> </ul></li> </ul><p>Special Guest: Anthony Sottile.</p><p>Sponsored By:</p><ul><li><a href="https://ift.tt/3eBYfEe" rel="nofollow">Datadog</a>: <a href="https://ift.tt/3eBYfEe" rel="nofollow">Modern monitoring & security. See inside any stack, any app, at any scale, anywhere. Visit testandcode.com/datadog to get started.</a></li></ul><p><a href="https://ift.tt/2tzXV5e" rel="payment">Support Test & Code : Python Testing for Software Engineering</a></p><p>Links:</p><ul><li><a href="https://ift.tt/3iiIaVt" title="pytest Changelog / Release Notes" rel="nofollow">pytest Changelog / Release Notes</a></li><li><a href="https://ift.tt/2xmALPt" title="Deprecations and Removals — pytest documentation" rel="nofollow">Deprecations and Removals — pytest documentation</a></li></ul>

from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...