Commit Graph

12004 Commits

Author SHA1 Message Date
Daniel Hahler 9b32794391 intersphinx_mapping: add pluggy 2020-03-05 05:53:42 +01:00
Daniel Hahler c39a85e5f4 doc: revisit UnformattedWarning 2020-03-05 03:15:14 +01:00
Daniel Hahler b90f57d25c Remove wrong/outdated doc with UnformattedWarning
It was introduced in da6830f19 (added to `_pytest.deprecated`, but then
moved to `_pytest.warning_types`).
2020-03-05 03:13:28 +01:00
Daniel Hahler 77adb33ec6 doc: use show-inheritance with warnings, revisit docstrings
Revisits the docstring for `PytestExperimentalApiWarning` and
`PytestUnhandledCoroutineWarning`.
2020-03-05 02:56:18 +01:00
Daniel Hahler 1a8d427e98 doc: src/_pytest/deprecated.py: links 2020-03-05 02:47:21 +01:00
Daniel Hahler dc5219a9c0 Fix documentation for Config/InvocationParams 2020-03-03 21:15:06 +01:00
Daniel Hahler a42e85ed54 Fix documentation for _pytest.pytester.RunResult
When using `(i)var` in the class docstring it would link `duration` to
`_pytest.runner.TestReport.duration`.

This moves the docstrings to the attributes properly.
2020-03-03 18:12:12 +01:00
Daniel Hahler 620d457756 doc: add __tracebackhide__ label 2020-03-02 17:08:37 +01:00
Bruno Oliveira 333bb0883a
Merge pull request #6860 from pytest-dev/pytest_twisted_in_async_warning
Add pytest-twisted to list of async def handling plugins
2020-03-04 21:48:20 -03:00
Kyle Altendorf dce2621710
Add pytest-twisted to list of async def handling plugins
https://github.com/pytest-dev/pytest-twisted/tree/v1.12#ensuredeferred

[pytest-twisted](https://github.com/pytest-dev/pytest-twisted) supports `async def` test functions and fixtures as well as `async def`/`yield` fixtures.
2020-03-04 17:42:08 -05:00
Daniel Hahler acec0b688f
Fix usage of pytester with doctests (#6802)
Use `request.node.name` instead of `request.function.__name__`:
`request.function` is `None` with `DoctestItem`s.
2020-03-04 05:33:50 +01:00
Daniel Hahler 197b7c3bce
Add .gitblameignore (#6848) 2020-03-04 05:32:30 +01:00
Daniel Hahler 37d074efc8
Fix (internal) documentation for pytester's LineComp (#6850) 2020-03-04 05:25:32 +01:00
Ronny Pfannschmidt a5a8d53dfe
remove myself from the list of coc handlers (#6857) 2020-03-03 19:08:59 -03:00
Ronny Pfannschmidt 9fd71d6fe0
fix #571: deprecate pytest_collect_directory as ... (#6847)
Deprecate pytest_collect_directory

Fix #571

Co-authored-by: Daniel Hahler <github@thequod.de>
2020-03-03 18:58:14 -03:00
Daniel Hahler b11bfa106c
Use attrs with all Repr classes (#6739)
Co-authored-by: Ran Benita <ran234@gmail.com>
2020-03-03 21:53:28 +01:00
Daniel Hahler bd7e33277b
docs: remove tracking through Google Analytics (#6843)
This might not even be monitored by anyone, but if it is useful in
general should probably get replaced with a less controversial provider.
2020-03-03 01:35:14 +01:00
Ronny Pfannschmidt 194b52145b
Merge pull request #6834 from RonnyPfannschmidt/fix-6833-summarize-warning-item-locations
summarize warning summaries if the number of locations is high
2020-03-01 20:21:36 +01:00
Bruno Oliveira 15e1dd0f87
Automate release by comment notifications (#6823)
* Automate release by comment notifications

* Only run if @pytestbot is mentioned
2020-03-01 14:46:35 -03:00
Ronny Pfannschmidt 23c43a37e0 summarize warning summaries if the number of locations is high 2020-03-01 14:08:15 +01:00
Bruno Oliveira 92767fec51
Merge pull request #6836 from bluetech/store
Add a typing-compatible mechanism for ad-hoc attributes on various objects
2020-03-01 09:30:10 -03:00
Ran Benita 5fc80d8bc3
Merge pull request #6844 from bluetech/asserthook-abc-loader
Mark AssertionRewritingHook as implementing importlib.abc.Loader
2020-02-29 23:21:11 +02:00
Ran Benita 2f60548e08 Mark AssertionRewritingHook as implementing importlib.abc.Loader
It implements the required methods. This is useful for typing but also a
nice indicator.
2020-02-29 16:55:56 +02:00
Daniel Hahler f10ab021e2
Move _collectfile to FSCollector (#6830)
Previously this was implemented both on `Session` and `Package`, where
the extra code in `Package._collectfile` was not covered/used.

Ref: https://github.com/pytest-dev/pytest/pull/6830#issuecomment-592663236
2020-02-29 11:40:11 +01:00
Bruno Oliveira ff7b5dbbde
Merge pull request #6784 from nicoddemus/deprecate-terminal-writer
Deprecate TerminalReporter.writer
2020-02-28 21:07:02 -03:00
Daniel Hahler 4b53bbc0a9
docs: use doc/en/_build/html for html output (#6842)
This will use the same directory as `make -C doc/en` then, and reflects
the default location that Sphinx uses.
2020-02-29 00:47:30 +01:00
Daniel Hahler 769ffc32bf
Add Read The Docs badge to README (#6841) 2020-02-29 00:29:56 +01:00
Daniel Hahler 5819536f00
Improve UsageError with invalid `-o` style (#6795)
This started from fixing the test, where `"xdist_strict True"` was used
as a single argument, although you typically would see `["xdist_strict",
"True"]`.

Improves the error message to mention the option that caused the error.
2020-02-28 19:41:56 +01:00
Daniel Hahler 952cab2d85
Simplify test_rootdir_wrong_option_arg (#6812) 2020-02-28 18:38:07 +01:00
Ran Benita d636fcd557 Add a typing-compatible mechanism for ad-hoc attributes on various objects
pytest has several instances where plugins set their own attributes on
objects they receive in hooks, like nodes and config. Since plugins are
detached from these object's definition by design, this causes a problem
for type checking because these attributes are not defined and mypy
complains.

Fix this by giving these objects a "store" which can be used by plugins
in a type-safe manner.

Currently this mechanism is private. We can consider exposing it at a
later point.
2020-02-28 14:34:44 +02:00
Daniel Hahler f77d606d4e
docs: generate index and add it to globaltoc sidebar (#6808) 2020-02-27 00:34:18 +01:00
Daniel Hahler 16c683dff9
Remove unused `setns` (#6804)
Last usage of it was removed in ba17363d7.
2020-02-26 15:35:14 +01:00
Daniel Hahler 2e48c32dea
docs: fix reference to config.cache fixture (#6807) 2020-02-26 01:24:18 +01:00
Stefano Mazzucco 2451716746
Remove reference to old konira plugin from docs (#6819)
The pytest-konira plugin has not seen an update since 2011, moreover
the "project description" on PyPI points to a dubious website that
does not actually correspond to the project and instead redirects to
advertising content.
2020-02-26 01:19:40 +01:00
Daniel Hahler 6a7df7f031
test_assertion: harden/improve test_{text_diff,unicode} (#6806) 2020-02-24 15:19:08 +01:00
Daniel Hahler ac3a42bafd
doctest: strip newlines with unexpected exceptions (#6801) 2020-02-24 15:18:08 +01:00
Daniel Hahler be23aeb989
Remove unused `pytester.getdecoded` (#6805)
Last usage was removed in 22dc47d9f.
2020-02-24 14:33:26 +01:00
Daniel Hahler bfd0d18371
tests: test_config: move tests (#6796)
Originally added in a2891420d (with `TestRootdir`), but then
accidentally moved to `TestOverrideIniArgs` in 802755cee.
2020-02-23 17:12:55 +01:00
Daniel Hahler 9928c7794b
minor: fix trace msg: s/loaded/loading (#6798) 2020-02-23 17:12:30 +01:00
Daniel Hahler 706ea86bba
capture: factor out _get_multicapture (#6788)
Ref: https://github.com/pytest-dev/pytest/pull/6671#issuecomment-588408992
2020-02-22 23:39:20 +01:00
Daniel Hahler 1d5a0ef284
Fix pytest_ignore_collect hooks: do not return False (#6778)
It should only return `True` when something is to be ignored, not
`False` otherwise typically.

This caused e.g. bad interaction with the cacheprovider (before
https://github.com/pytest-dev/pytest/pull/6448).
2020-02-22 23:35:47 +01:00
Daniel Hahler c8b4a1a471
Handle `match` with `pytest.raises()` (#6753)
Fixes https://github.com/pytest-dev/pytest/issues/6752.
2020-02-22 23:32:55 +01:00
Daniel Hahler 68fe0eb8f3
Minor cosmetic fixes (#6792) 2020-02-22 19:24:41 +01:00
Daniel Hahler de854c6ee1
doc: `pytest.raises`: remove mention of removed `message` (#6793)
Follow-up to 13f7f27fd.
2020-02-22 19:24:00 +01:00
Daniel Hahler 04126feea7
doc: `pytest.raises`: link to `python:try` (#6794) 2020-02-22 19:23:35 +01:00
kpinc eeebcd77dd
doc: add list of fixtures to start of fixture chapter (#6696)
- Add list of fixtures to start of fixture chapter
- Add "fixture" cross ref type
2020-02-22 14:56:19 +01:00
Daniel Hahler 478a244f5e
main: `args` must be a list, not tuple (#6791)
Passing in a tuple crashes in `_prepareconfig`:

        def test_invoke_with_tuple(self):
    >       pytest.main(("-h",))

    src/_pytest/config/__init__.py:82: in main
        config = _prepareconfig(args, plugins)
    src/_pytest/config/__init__.py:229: in _prepareconfig
        return pluginmanager.hook.pytest_cmdline_parse(
    …
    src/_pytest/helpconfig.py:98: in pytest_cmdline_parse
        config = outcome.get_result()  # type: Config
    src/_pytest/config/__init__.py:808: in pytest_cmdline_parse
        self.parse(args)
    src/_pytest/config/__init__.py:1017: in parse
        self._preparse(args, addopts=addopts)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

        def _preparse(self, args: List[str], addopts: bool = True) -> None:
            …
            if addopts:
                ini_addopts = self.getini("addopts")
                if ini_addopts:
    >               args[:] = self._validate_args(ini_addopts, "via addopts config") + args
    E               TypeError: can only concatenate list (not "tuple") to list

    addopts    = True
    args       = ('-h',)
    env_addopts = ''
    ini_addopts = ['-rfEX', …]

    src/_pytest/config/__init__.py:956: TypeError: can only concatenate list (not "tuple") to list

Might be worth handling (converting it to a list for example), but it
was documented to be a list to begin with when removing support for
strings (a7e401656).
2020-02-22 13:16:46 +01:00
Daniel Hahler 47ccd58fb4 Fix typo in doc with syspath_prepend 2020-02-22 13:15:17 +01:00
Daniel Hahler 2277817176 Fix grammar in changelog/6737.breaking.rst 2020-02-22 13:15:17 +01:00
Daniel Hahler 1baeefc2fd test_reprcompare_whitespaces: use callequal 2020-02-22 13:15:17 +01:00