summaryrefslogtreecommitdiff
path: root/src/pytest
AgeCommit message (Collapse)Author
2020-12-26runner: export pytest.CallInfo for typing purposesRan Benita
The type cannot be constructed directly, but is exported for use in type annotations, since it is reachable through existing public API. This also documents `from_call` as public, because at least pytest-forked uses it, so we must treat it as public already anyway.
2020-12-26python: export pytest.Metafunc for typing purposesRan Benita
The type cannot be constructed directly, but is exported for use in type annotations, since it is reachable through existing public API.
2020-12-20mark: export pytest.MarkGenerator for typing purposesRan Benita
The type cannot be constructed directly, but is exported for use in type annotations, since it is reachable through existing public API.
2020-12-20mark: export pytest.MarkDecorator for typing purposesRan Benita
The type cannot be constructed directly, but is exported for use in type annotations, since it is reachable through existing public API.
2020-12-20mark: export pytest.Mark for typing purposesRan Benita
The type cannot be constructed directly, but is exported for use in type annotations, since it is reachable through existing public API.
2020-12-05Merge pull request #8055 from bluetech/unraisableRan Benita
Add unraisableexception and threadexception plugins
2020-11-21Add unraisableexception and threadexception pluginsRan Benita
2020-11-13Export types of builtin fixture for type annotationsRan Benita
In order to allow users to type annotate fixtures they request, the types need to be imported from the `pytest` namespace. They are/were always available to import from the `_pytest` namespace, but that is not guaranteed to be stable. These types are only exported for the purpose of typing. Specifically, the following are *not* public: - Construction (`__init__`) - Subclassing - staticmethods and classmethods We try to combat them being used anyway by: - Marking the classes as `@final` when possible (already done). - Not documenting private stuff in the API Reference. - Using `_`-prefixed names or marking as `:meta private:` for private stuff. - Adding a keyword-only `_ispytest=False` to private constructors, warning if False, and changing pytest itself to pass True. In the future it will (hopefully) become a hard error. Hopefully that will be enough.
2020-11-09Export MonkeyPatch as pytest.MonkeyPatchRan Benita
We want to export `pytest.MonkeyPatch` for the purpose of type-annotating the `monkeypatch` fixture. For other fixtures we export in this way, we also make direct construction of them (e.g. `MonkeyPatch()`) private. But unlike the others, `MonkeyPatch` is also widely used directly already, mostly because the `monkeypatch` fixture only works in `function` scope (issue #363), but also in other cases. So making it private will be annoying and we don't offer a decent replacement yet. So, let's just make direct construction public & documented.
2020-10-06Add alias clarification to deprecation warning (#7829)Manuel MariƱez
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-08-22Reintroduce warnings postponed in 6.0 (#7637)Maximilian Cosmo Sitter
2020-08-01Format docstrings in a consistent styleRan Benita
2020-07-22Change pytest deprecation warnings into errors for 6.0 release (#7362)Bruno Oliveira
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-07-04Publish our typesRan Benita
2020-06-13pytest.collect: type annotate (backward compat module)Ran Benita
This is just to satisfy typing coverage.
2020-05-08Handle EPIPE/BrokenPipeError in pytest's CLIRan Benita
Running `pytest | head -1` and similar causes an annoying error to be printed to stderr: Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe (or possibly even a propagating exception in older/other Python versions). The standard UNIX behavior is to handle the EPIPE silently. To recommended method to do this in Python is described here: https://docs.python.org/3/library/signal.html#note-on-sigpipe It is not appropriate to apply this recommendation to `pytest.main()`, which is used programmatically for in-process runs. Hence, change pytest's entrypoint to a new `pytest.console_main()` function, to be used exclusively by pytest's CLI, and add the SIGPIPE code there. Fixes #4375.
2020-04-10Merge pull request #6285 from earonesty/patch-1Ronny Pfannschmidt
Add _pytest.fixtures.FixtureLookupError to top level import
2020-03-30deprecate the pytest.collect moduleRonny Pfannschmidt
changelog minimal unittest for collect module deprecations \!fixup - changelog typo
2020-03-03Fix tox alpha orderearonesty
2020-03-03Update pytest.pyearonesty
2020-03-03Export FixtureLookupError to top levelearonesty
2020-02-10Move ExitCode's definition from _pytest.main to _pytest.configRan Benita
ExitCode is used in several internal modules and hooks and so with type annotations added, needs to be imported a lot. _pytest.main, being the entry point, generally sits at the top of the import tree. So, it's not great to have ExitCode defined in _pytest.main, because it will cause a lot of import cycles once type annotations are added (in fact there is already one, which this change removes). Move it to _pytest.config instead. _pytest.main still imports ExitCode, so importing from there still works, although external users should really be importing from `pytest`.
2019-12-02Convert pytest.py into a packageBruno Oliveira
As discussed in https://github.com/pytest-dev/pytest/issues/3342, this is the first step to make pytest support static typing fully