Skip to content

2.0.0

Latest

Choose a tag to compare

@chrisguidry chrisguidry released this 20 Nov 14:43
89ddb10

This release changes the names and the parents of the spans that the plugin creates, so saved queries and dashboards built on 1.x traces need a look. The README's The spans of a test run section describes the new layout.

Breaking changes

  • Fixtures that tests share are outside the tests. The setup and teardown spans of class, module, package, and session fixtures are now children of the test run. A test's span starts after pytest has set those fixtures up and ends before pytest tears them down, so the first and the last test of a module no longer include their time. With --trace-per-test, each of those setups and teardowns is a trace of its own.
  • Parametrized tests share a span name. The name is the node ID without the ID of the parameters, like tests/test_api.py::test_login. The whole node ID is still in pytest.nodeid, and code.function is now the name of the function without the parameters.
  • Parametrized fixtures share a span name. server[x] setup is now server setup, with the parameter in pytest.param.server.
  • The arguments of @pytest.mark.parametrize no longer get fixture spans. Their values are attributes of the test's spans.
  • Minimum versions. pytest 8.0.0 and version 1.28.0 of the OpenTelemetry API and SDK.

New

  • Each parameter of a parametrized test is a pytest.param.<name> attribute on the test's spans.
  • A fixture's setup and teardown spans are current while the fixture runs, so the spans that your fixture creates are their children.
  • A fixture whose setup raises records the exception on its own setup span, and a teardown that raises is recorded on the test's ::teardown span.
  • A parametrized fixture that pytest tears down for its next parameter gets a teardown span, and so do the fixtures that pytest tears down after pytest.exit() or Ctrl-C.

Fixed

  • A parameter whose repr() raises no longer stops the whole run.

What's Changed

  • Pin GitHub Actions to commit SHAs by @chrisguidry in #67
  • Record a parametrized test's parameters as span attributes by @chrisguidry-simmer[bot] in #68
  • Take shared fixtures and parameter IDs out of test spans by @chrisguidry in #69

New Contributors

  • @chrisguidry-simmer[bot] made their first contribution in #68

Full Changelog: 1.2.1...2.0.0