nickjmiller/pytest-fixtures

Doesn't work with pytest-describe

Closed this issue · 2 comments

Thank you for making this!

Describe the bug
The extension is working great on regular tests, but does not seem to support pytest-describe, which allows you to group tests together in "describe" blocks.

To Reproduce
Install pytest-describe, copy in their example test, and try adding some fixtures. Fixture autocomplete does not show up and you can't jump to fixture definitions

This line is the problem - https://github.com/nickjmiller/pytest-fixtures/blob/main/src/suggestionProvider.ts#L119. Tests inside of pytest-describe blocks do not need to start with test_

Hi Ari, thanks for reporting this.

I am hesitant to work on support for a pytest plugin, this extension is held together with fragile string pattern matching and I think it'd be difficult to enable pytest-describe pattern matching without introducing regressions. For example, removing the test_ check on that line would cause every function in every python test file to get fixture suggestions, which is not right.

I also don't think the extension as written would work well with that syntax. A limitation currently is every function gets suggestions for every fixture available in that file, not that nested block. So I think those block-scoped fixtures would not be scoped correctly without a large refactor of how this extension works (this is an issue with vanilla pytest as well, but since that is not an enforced pattern, it hasn't caused as many issues).

In other words, I don't think this extension can support that plugin. There are too many limitations with the current implementation.