Commit Graph

30 Commits

Author SHA1 Message Date
Eddie a76df875c7
Remove space inside of dotted attribute 2021-11-10 12:54:21 -08:00
Simon K eb6c4493b2
Deprecation of `msg=` for both `pytest.skip()` and `pytest.fail()`. (#8950)
* porting pytest.skip() to use reason=, adding tests

* avoid adding **kwargs, it breaks other functionality, use optional msg= instead

* deprecation of `pytest.fail(msg=...)`

* fix bug with not capturing the returned reason value

* pass reason= in acceptance async tests instead of msg=

* finalising deprecations of `msg` in `pytest.skip()` and `pytest.fail()`

* Update doc/en/deprecations.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

* Update doc/en/deprecations.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

* fix failing test after upstream merge

* adding deprecation to `pytest.exit(msg=...)`

* add docs for pytest.exit deprecations

* finalising deprecation of msg for pytest.skip, pytest.exit and pytest.fail

* hold a reference to the Scope instance to please mypy

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-11-08 15:31:14 +01:00
Oleg Höfling 49f934618c
Replace hardcoded links to Github issues with extlinks (#9234) 2021-11-06 11:16:11 +02:00
Ran Benita b0aa870b11 Export CollectReport and TestReport
Refs #7469.
2021-11-02 20:58:51 +02:00
Ran Benita e6eac28f0e legacypath: only add `testdir` and `tmpdir` fixtures if corresponding plugins are registered
This preserves the existing behavior and gives a proper error message
in case e.g. `testdir` is requested without the `pytester` plugin being
loaded.
2021-10-29 13:11:12 +03:00
Ran Benita 5e883f5195 Move tmpdir to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita 11e36c8493 Make transitive Pytester types public
Export `HookRecorder`, `RecordedHookCall` (originally `ParsedCall`),
`RunResult`, `LineMatcher`.

These types are reachable through `Pytester` and so should be public
themselves for typing and other purposes.

The name `ParsedCall` I think is too generic under the `pytest`
namespace, so rename it to `RecordedHookCall`.

The `HookRecorder`'s constructor is made private -- it should only be
constructed by `Pytester`.

`LineMatcher` and `RunResult` are exported as is - no private and no
rename, since they're being used.

All of the classes are made final as they are not designed for
subclassing.
2021-10-23 10:59:18 +03:00
Bruno Oliveira c000955dde Remove incorrect docs about confcutdir being a config option
Fix #9210
2021-10-18 19:20:27 -03:00
Brian Okken c82bda259c
Add a `pythonpath` setting to allow paths to be added to `sys.path`. (#9134) 2021-10-05 09:36:38 +03:00
Ronny Pfannschmidt c21ef7ba22 fix #8818 - run regendoc without tox cachedir
#4270 introduced per tox env pytest cachedirs and
never protected regendoc against it
2021-10-04 08:56:26 +02:00
oleg.hoefling d1aea7d7a8
use intersphinx crossrefs to stdlib docs where possible instead of hardcoded URLs
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-08-26 16:05:03 +02:00
Bruno Oliveira 109bc2649d Adapt docs references to use pluggy 1.0
Also use the intersphinx reference instead of the class directly.
2021-08-26 09:52:05 -03:00
Éloi Rivard 7770dacb8d pygments themes are customizable 2021-08-13 19:15:01 +02:00
Ran Benita c6bdeb8491 stash: make Stash and StashKey public
It's had enough time to bake - let's allow external plugins to use it.
2021-07-24 17:40:08 +03:00
Thomas Grainger 388691a205
rename tmpdir.rst to tmp_path.rst (#8905) 2021-07-14 12:53:27 -03:00
Florian Bruhin 953fdabaf0 Adjust doc links for new scheme
Closes #8831
2021-07-06 09:11:35 +02:00
Bruno Oliveira 7eb0792cba Add pytest.version_tuple
This adds `pytest.version_tuple`, which makes it simpler for users to do something depending on the pytest version, such as declaring hooks which are introduced in later versions.

This feature was added originally in https://github.com/pypa/setuptools_scm/pull/475.

Followup to https://github.com/pytest-dev/pytest/pull/7605.
2021-06-14 09:04:14 -03:00
Denis Laxalde cf7425d22b Fix a typo in documentation about tmpdir_factory
The section refers to tmpdir_factory, but the sentence mentionned
tmp_path_factory.
2021-05-31 09:36:18 +02:00
Ran Benita 1ba5b48565
Merge pull request #8697 from bluetech/expose-config
config: expose Config and PytestPluginManager for typing purposes
2021-05-26 11:20:42 +03:00
Ran Benita c0d525e44c config: expose PytestPluginManager for typing purposes
This type is used in hooks and transitively through `Config`.
2021-05-24 12:27:07 +03:00
Ran Benita 88d84a5791 config: expose Config for typing purposes
This type is used in hooks and fixtures.

The constructor is publicly documented so is not marked private.
2021-05-24 12:26:22 +03:00
Ran Benita 538b5c2499 argparsing: export Parser and OptionGroup for typing purposes
`Parser` is used by many plugins and custom hooks. `OptionGroup` is
exposed by the `parser.addgroup` API.

The constructors of both are marked private, they are not meant to be
constructed directly.
2021-05-24 00:52:03 +03:00
Albert Villanova del Moral 4b214a6049
Add tmp_path_factory methods to the docs (#8550)
* Add tmp_path_factory methods to the docs

Add the methods of tmp_path_factory to the docs.

Currently, only the class description appears in the docs.

* Add tmpdir_factory methods to the docs
2021-04-14 12:06:35 +03:00
Ran Benita fe215bda6b
Merge pull request #8446 from bluetech/unnecessary-py-path-2
More py.path removal work
2021-03-18 10:20:59 +02:00
Daniele Procida 6ab461f460 Explicitly listed the four documentation sections on index.rst 2021-03-16 20:26:05 +00:00
Ran Benita a03ee02817 config: make `collect_ignore` accept any PathLike
The main reason is to remove a reference to `py.path`.
2021-03-15 10:39:32 +02:00
Ran Benita 59251e8a2a Remove/replace some unneeded usages of py.path 2021-03-14 14:12:28 +02:00
Ran Benita ba7bd3d77c doc/tmpdir: significantly reduce space dedicated to tmpdir/tmpdir_factory
Emphasize tmp_path/tmp_path_factory and just note the legacy ones.
2021-03-13 20:44:23 +02:00
Ran Benita f2d65c85f4 code: export ExceptionInfo for typing purposes
This type is most prominent in `pytest.raises` and we should allow to
refer to it by a public name.

The type is not in a perfectly "exposable" state. In particular:

- The `traceback` property with type `Traceback` which is derived from
  the `py.code` API and exposes a bunch more types transitively. This
  stuff is *not* exported and probably won't be.

- The `getrepr` method which probably should be private.

But they're already used in the wild so no point in just hiding them
now.

The __init__ API is hidden -- the public API for this are the `from_*`
classmethods.
2021-03-13 15:59:44 +02:00
Daniele Procida d8695410a4 Added how-to and reference directories.
Moved various documents into subdirectories, how-to and
reference.

Updated multiple links to use `:ref:` instead of `:doc:`,
meaning that files can henceforth be moved around without
breaking references.
2021-03-11 22:13:01 +00:00