-
Notifications
You must be signed in to change notification settings - Fork 418
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): revert sub-plugin strategy and move v2 functions to try-except blocks #10196
chore(ci_visibility): revert sub-plugin strategy and move v2 functions to try-except blocks #10196
Conversation
…e_pytest_plugin_v2
…lugin_v2_itr_support
…of github.com:DataDog/dd-trace-py into romain.komorn/SDTEST-225/pytest_plugin_v2_itr_support
…s_for_pytest_plugin_v2
|
Datadog ReportBranch report: ❌ 2 Failed (0 Known Flaky), 176674 Passed, 1642 Skipped, 9h 54m 47.49s Total duration (29m 0.17s time saved) ❌ Failed Tests (2)
⌛ Performance Regressions vs Default Branch (2) |
BenchmarksBenchmark execution time: 2024-08-16 08:12:17 Comparing candidate commit 32c568f in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 353 metrics, 47 unstable metrics. |
There are two changes in this commit:
1- remove "sub plugin" strategy introduced in #8999
The sub-plugin strategy was originally implemented to delay the import of
ddtrace
, however that import is (in the current scenario) inevitable because thepyproject.toml
entry-points that tellpytest
where to find plugins already importddtrace
, and the original motivation of the change in (#8281 and #4845) was instead addressed by #9141 .The motivation to revert this change is that some hooks (eg:
pytest_load_inital_conftests
) added by the class-based plugins do not execute when the plugin is loaded in thepytest_configure()
hook in theplugin.py
file itself. All the methods in the plugin classes use the@staticmethod
decorator and do not benefit from being in a class.This change allows the versioned plugin files to implement hooks by virtue of being imported into the original plugin module.
2- move v2 functions to try-except blocks
Since CI Visibility should never affect
pytest
's execution (or, at the very least, should never prevent it from running to completion), the hooks themselves should never raise exceptions. With this change, some functions simply wrap the entire body in a try/except block, while some others define a separate function that is then called in a try/except block.A decorator was not used for this purpose because some hooks yield, while others don't, and logging relevant errors is also a little simpler.
Checklist
Reviewer Checklist