Commit 310ca53
ci: expand test optimization dogfooding (#17567)
## Description
Removes all remaining `--no-ddtrace` flags from riotfile.py, expanding dogfooding of the new Test Optimization plugin (`ddtrace/testing`) to more test suites.
Most of these `--no-ddtrace` flags were originally added when the old `_plugin_v2.py`-backed plugin was in use for outer sessions. Now that the new plugin (`ddtrace/testing`) is the default and is used for outer sessions, they are no longer needed.
**Inner sessions** (spawned by tests such as pytest-bdd, pytest-benchmark, pytest-flaky, and selenium) are not affected:
- `inline_run`-based inner sessions (pytest-bdd, pytest-benchmark, pytest-flaky) use `PytestTestCaseBase.inline_run()`, which suspends/resumes the outer CIVisibility instance and explicitly controls the `--ddtrace` flag per inner session.
- Subprocess-based inner sessions (selenium) are isolated processes and unaffected by the outer session's plugin state.
For now, all inner sessions use the new plugin (since `DD_PYTEST_USE_NEW_PLUGIN=false` in `_ci_override_env` has no effect on already-imported modules in in-process sessions). This is intentional — the new plugin is the focus of current efforts.
---
Also addresses comment by codex:
> In the GitLab riot workflow (.gitlab/tests.yml, line 43), every suite is invoked with --ddtrace, so removing --no-ddtrace here enables CI Visibility in the outer pytest process for this suite. That breaks assumptions in tests/integration/test_integration_civisibility.py (for example, test_civisibility_intake_with_missing_apikey expects CIVisibility to start disabled and asserts _instance is None after enable()), because a pre-existing singleton makes CIVisibility.enable() return early and bypasses the test’s patched initialization path.
By removing those env vars in conftest.py with a fixture, and also pause/resume any CIVisibility instance (not needed for ddtrace/testing plugin really, but it is needed if we switched to v2).
## Testing
Covered by the dogfooded test suites themselves running under the new plugin.
## Risks
Low. The new plugin is already the default. Removing `--no-ddtrace` only affects the outer pytest session instrumentation; inner sessions already control their own plugin activation.
## Additional Notes
Suites like `pytest_bdd` and `pytest_benchmark` have separate bdd/benchmark implementations in both plugins. Future work could add explicit coverage for the new plugin's code paths for those integrations.
Co-authored-by: federico.mon <federico.mon@datadoghq.com>1 parent 222a314 commit 310ca53
2 files changed
Lines changed: 37 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
| 500 | + | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| |||
2068 | 2068 | | |
2069 | 2069 | | |
2070 | 2070 | | |
2071 | | - | |
| 2071 | + | |
2072 | 2072 | | |
2073 | 2073 | | |
2074 | 2074 | | |
| |||
2084 | 2084 | | |
2085 | 2085 | | |
2086 | 2086 | | |
2087 | | - | |
| 2087 | + | |
2088 | 2088 | | |
2089 | 2089 | | |
2090 | 2090 | | |
| |||
2105 | 2105 | | |
2106 | 2106 | | |
2107 | 2107 | | |
2108 | | - | |
| 2108 | + | |
2109 | 2109 | | |
2110 | 2110 | | |
2111 | 2111 | | |
| |||
2140 | 2140 | | |
2141 | 2141 | | |
2142 | 2142 | | |
2143 | | - | |
| 2143 | + | |
2144 | 2144 | | |
2145 | 2145 | | |
2146 | 2146 | | |
| |||
2161 | 2161 | | |
2162 | 2162 | | |
2163 | 2163 | | |
2164 | | - | |
| 2164 | + | |
2165 | 2165 | | |
2166 | 2166 | | |
2167 | 2167 | | |
| |||
3358 | 3358 | | |
3359 | 3359 | | |
3360 | 3360 | | |
3361 | | - | |
| 3361 | + | |
3362 | 3362 | | |
3363 | 3363 | | |
3364 | 3364 | | |
| |||
3874 | 3874 | | |
3875 | 3875 | | |
3876 | 3876 | | |
3877 | | - | |
| 3877 | + | |
3878 | 3878 | | |
3879 | 3879 | | |
3880 | 3880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
21 | 46 | | |
22 | 47 | | |
23 | 48 | | |
| |||
77 | 102 | | |
78 | 103 | | |
79 | 104 | | |
80 | | - | |
81 | | - | |
| 105 | + | |
82 | 106 | | |
83 | 107 | | |
84 | 108 | | |
| |||
0 commit comments