Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Add type stub for pytest
Browse files Browse the repository at this point in the history
The only part of the API we reference directly from the code in `tests/`
is the bare minimum `pytest.raises`, so that's all I've implemented here.

Apparently pytest are working on providing type stubs, but it's not
at a usable state yet: pytest-dev/pytest#3342
  • Loading branch information
kierdavis committed Mar 30, 2019
1 parent 8f315ba commit 7d807d6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions stubs/pytest.pyi
@@ -0,0 +1,15 @@
"""
Type stubs for pytest.
Note that stubs are only written for the parts that we use.
"""

from typing import ContextManager, Type


# This function actually has more arguments than are specified here, and the
# context manager actually yields a _pytest._code.ExceptionInfo instead of None.
# We don't use either of these features, so I don't think its worth including
# them in our type stub. We can always change it later.
def raises(exc_type: Type[Exception]) -> ContextManager[None]:
...

0 comments on commit 7d807d6

Please sign in to comment.