Skip to content

Commit 7eaa489

Browse files
stroxlermeta-codesync[bot]
authored andcommitted
Clarify fixture navigation and avoid a test handle clone
Summary: Document why module fixtures are checked before the lazy conftest walk. Borrow the existing conftest handle when constructing its indexing request, removing the clone-to-slice lint. ___ landed-with-radar-review Differential Revision: D129106475 fbshipit-source-id: 7fd53304179a4e70dd89fe8465210e559fdfd5d0
1 parent a0bfd68 commit 7eaa489

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎pyrefly/lib/state/lsp/pytest.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ impl<'a> Transaction<'a> {
122122
})
123123
.collect();
124124
if definitions.is_empty() && preference.follow_pytest_conftest {
125+
// Module fixtures take precedence; discover conftests only after a local miss.
125126
let candidates = once(handle.clone())
126127
.chain(once_with(|| pytest_conftest_handles(self, handle, preference)).flatten());
127128
'fixtures: for fixture_handle in candidates {

‎pyrefly/lib/test/lsp/definition.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def test_thing(answer):
482482
let mut transaction = state.new_committable_transaction(Require::Indexing, None);
483483
transaction
484484
.as_mut()
485-
.run(&[conftest_handle.clone()], Require::Indexing, None);
485+
.run(slice::from_ref(&conftest_handle), Require::Indexing, None);
486486
state.commit_transaction(transaction, None);
487487
let transaction = state.transaction();
488488
assert!(transaction.get_ast(&conftest_handle).is_none());

0 commit comments

Comments
 (0)