Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci_visibility): add support for pytest_bdd to v2 plugin #11753

Conversation

romainkomorndatadog
Copy link
Contributor

@romainkomorndatadog romainkomorndatadog commented Dec 17, 2024

This adds support for the pytest-bdd plugin to the new version of the pytest plugin, bypassing the ddtrace.pytest_bdd plugin and instantiating a "subplugin" on demand when pytest-bdd is detected and ddtrace is enabled.

To support the way the legacy pytest-bdd plugin worked, new functionality is added:

  • InternalTestSession.get_tracer() to have access to the tracer used by Test Visibility
  • InternalTest.overwrite_attributes() to allow overwriting attributes that have already been set (or in the case of the suite name, that are automatically set based on test hierarchy)

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@romainkomorndatadog romainkomorndatadog added the changelog/no-changelog A changelog entry is not required for this PR. label Dec 17, 2024
@romainkomorndatadog romainkomorndatadog self-assigned this Dec 17, 2024
@romainkomorndatadog romainkomorndatadog requested review from a team as code owners December 17, 2024 10:54
Copy link
Contributor

CODEOWNERS have been resolved as:

ddtrace/contrib/pytest/_pytest_bdd_subplugin.py                         @DataDog/ci-app-libraries
ddtrace/contrib/pytest/_plugin_v2.py                                    @DataDog/ci-app-libraries
ddtrace/contrib/pytest_bdd/plugin.py                                    @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/api/_test.py                             @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/recorder.py                              @DataDog/ci-app-libraries
ddtrace/internal/test_visibility/api.py                                 @DataDog/ci-app-libraries
riotfile.py                                                             @DataDog/apm-python
tests/contrib/pytest_bdd/test_pytest_bdd.py                             @DataDog/ci-app-libraries

@pr-commenter
Copy link

pr-commenter bot commented Dec 17, 2024

Benchmarks

Benchmark execution time: 2024-12-17 11:40:50

Comparing candidate commit d9d9464 in PR branch romain.komorn/SDTEST-1208/support_pytest_bdd_in_v2_plugin with baseline commit 1e3bcc7 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 394 metrics, 2 unstable metrics.

@romainkomorndatadog romainkomorndatadog merged commit 05302eb into main Dec 17, 2024
648 of 649 checks passed
@romainkomorndatadog romainkomorndatadog deleted the romain.komorn/SDTEST-1208/support_pytest_bdd_in_v2_plugin branch December 17, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants