You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if this plugin could re-export annotated version of the builtin pytest fixtures. Only problem is that they are currently not publicly exported...
The text was updated successfully, but these errors were encountered:
There is another problem that not all of them have unique types, or even pytest specific types.
e.g. capsys, capsysbinary, capfd and capfdbinary all share the CaptureFixture[...] type. So for these we would have to come up with a new unique name for an Annotated type to resolve it.
Also for things like tempdir that are typed as a pathlib.Path, I'd be hesitant to make a global resolution of that fixture based on the type alone.
If someone is in need of it right now, it can be done quite easily like so:
from typing import Annotated
from _pytest.capture import capsysbinary
from pytest import CaptureFixture
from pytest_annotated import Fixture
CapSysBinary = Annotated[CaptureFixture[bytes], Fixture(capsysbinary)]
def test_capsysbin(c: CapSysBinary):
print("hello")
captured = c.readouterr()
assert captured.out == b"hello\n"
We could maybe add a bunch of these scoped to pytest_annotated (e.g. from pytest_annotated import CapSysBinary or from pytest_annotated import TempDir). If all the types can be mapped easily to a name that makes sense (without a lot of bikeshedding) I'd be happy to add it. I can't commit to doing it myself at this time though (I just don't have the time), happy to receive PRs though!
It would be great if this plugin could re-export annotated version of the builtin pytest fixtures. Only problem is that they are currently not publicly exported...
The text was updated successfully, but these errors were encountered: