Commit 1cde9ae
fix: compute consistent nodeids for paths outside rootpath
Fix conftest fixture scoping when testpaths points outside rootdir (#14004).
Previously, conftests outside rootpath got nodeid '' (empty string),
making their fixtures global and leaking to sibling directories.
Changes:
- Remove initial_paths from compute_nodeid_prefix_for_path since nodeids
relate to collection tree structure, not command-line paths
- Use compute_nodeid_prefix_for_path in pytest_plugin_registered for
consistent conftest baseid computation
- Paths outside rootpath now consistently use bestrelpath from invocation_dir
This ensures conftest fixtures are properly scoped regardless of whether
tests are inside or outside rootpath.
Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Anthropic Claude Opus 4 <claude@anthropic.com>1 parent a74d72f commit 1cde9ae
3 files changed
+17
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1629 | 1629 | | |
1630 | 1630 | | |
1631 | 1631 | | |
1632 | | - | |
1633 | | - | |
1634 | | - | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
1640 | 1639 | | |
1641 | 1640 | | |
1642 | 1641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | | - | |
626 | 625 | | |
627 | 626 | | |
628 | 627 | | |
629 | 628 | | |
630 | 629 | | |
631 | 630 | | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
636 | 634 | | |
637 | 635 | | |
638 | 636 | | |
639 | 637 | | |
640 | | - | |
641 | 638 | | |
642 | 639 | | |
643 | 640 | | |
| |||
653 | 650 | | |
654 | 651 | | |
655 | 652 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
| 653 | + | |
662 | 654 | | |
663 | 655 | | |
664 | 656 | | |
665 | 657 | | |
666 | 658 | | |
667 | 659 | | |
668 | | - | |
| 660 | + | |
669 | 661 | | |
670 | 662 | | |
671 | 663 | | |
| |||
677 | 669 | | |
678 | 670 | | |
679 | 671 | | |
680 | | - | |
| 672 | + | |
681 | 673 | | |
682 | 674 | | |
683 | 675 | | |
| |||
725 | 717 | | |
726 | 718 | | |
727 | 719 | | |
728 | | - | |
729 | 720 | | |
730 | 721 | | |
731 | 722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
194 | | - | |
| 192 | + | |
| 193 | + | |
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
| |||
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
206 | | - | |
207 | 205 | | |
208 | 206 | | |
209 | 207 | | |
210 | | - | |
| 208 | + | |
| 209 | + | |
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
| |||
223 | 222 | | |
224 | 223 | | |
225 | 224 | | |
226 | | - | |
227 | 225 | | |
228 | 226 | | |
229 | 227 | | |
| |||
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
244 | | - | |
245 | | - | |
246 | 242 | | |
247 | 243 | | |
248 | 244 | | |
| |||
259 | 255 | | |
260 | 256 | | |
261 | 257 | | |
262 | | - | |
263 | | - | |
264 | 258 | | |
265 | 259 | | |
266 | 260 | | |
| |||
275 | 269 | | |
276 | 270 | | |
277 | 271 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | 272 | | |
298 | 273 | | |
299 | 274 | | |
0 commit comments