Commit Graph

13006 Commits

Author SHA1 Message Date
Ran Benita b250c9d615
Merge pull request #7813 from bluetech/findpaths-confusion
findpaths: fix regression causing incorrect rootdir to be determined
2020-09-30 13:21:18 +03:00
Ran Benita 3ecdad67b7 terminal: improve condition on whether to display testpaths in header
Make it match better the condition on whether testpaths is used (found
in config/__init__.py).
2020-09-29 15:23:47 +03:00
Ran Benita 61f80a783a terminal: fix crash in header reporting when absolute testpaths is used
Regressed in 6.1.0 in 62e249a1f9.
The `x` is an `str` but is expected to be a `pathlib.Path`. Not caught
by mypy because `config.getini()` returns `Any`.

Fix by just removing the `bestrelpath` call:

- testpaths are always relative to the rootdir, it thus would be very
  unusual to specify an absolute path there.

- The code was wrong even before the regression: `py.path.local`'s
  `bestrelpath` function expects a `py.path.local`, not an `str`. But it
  had some weird `try ... except AttributeError` fallback which just
  returns the argument, i.e. it was a no-op. So there is no behavior
  change.

- It seems reasonable to me to just print the full path if that's what
  the ini specifies.
2020-09-29 15:23:47 +03:00
Ran Benita db08c7fbb0 pathlib: improve comments on commonpath and bestrelpath 2020-09-29 13:11:47 +03:00
Hugo van Kemenade 875f226d3b Smoke test pytest-rerunfailures 2020-09-29 12:47:46 +03:00
Ran Benita cd67c2a8cf
Merge pull request #7802 from bluetech/bump-attrs
Bump attrs requirement from >=17.4.0 to >=19.2.0
2020-09-28 19:30:58 +03:00
Ran Benita 4a9192f727 findpaths: fix regression causing incorrect rootdir to be determined
When switching from py.path.local to pathlib (70f3ad1c1f),
`local.parts(reverse=True)` was translated incorrectly, leading to the
wrong rootdir being determined in some non-trivial cases where parent
directories have config files as well.
2020-09-28 19:13:01 +03:00
Jakob van Santen 91fa11bed0
python_api: let approx() take nonnumeric values (#7710)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-28 12:17:23 -03:00
Ran Benita f324b27d02
Merge pull request #7748 from nicoddemus/fix-plugin-order-docs
Improve docs about plugin discovery/loading at startup
2020-09-27 13:19:58 +03:00
Ran Benita 32bb8f3a63 Bump attrs requirement from >=17.4.0 to >=19.2.0
This allows us to remove the `ATTRS_EQ_FIELD` thing which is causing
some annoyance.
2020-09-27 13:17:59 +03:00
Anthony Sottile 28ba9ab737
Merge pull request #7801 from pytest-dev/fix-bot-typo
Fix typos in pytestbot
2020-09-26 15:53:14 -07:00
Hugo van Kemenade 14de6781d8
Fix typos in pytestbot 2020-09-26 23:46:58 +03:00
Ran Benita e0ea00a70d
Merge pull request #7798 from bluetech/cherry-pick-release
Cherry-pick 6.1.0 release notes
2020-09-26 21:24:11 +03:00
Ran Benita 19c78ab574 Merge pull request #7797 from pytest-dev/release-6.1.0
Prepare release 6.1.0

(cherry picked from commit 08a1ab3a8acdfdeffd8f07058b44743df1d90150)
2020-09-26 21:11:48 +03:00
Ran Benita 0b327cc75b
Merge pull request #7796 from bluetech/changelog-cleanups
changelog: some consistency cleanups
2020-09-26 20:13:45 +03:00
Ran Benita d3c746eb8e changelog: some consistency cleanups 2020-09-26 20:04:17 +03:00
Kamran Ahmad d3f47bf346
Improved 'Declaring new hooks' section in docs. (#7782)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-23 11:15:55 -03:00
Bruno Oliveira 3db24893b4
Merge pull request #7784 from nicoddemus/use-new-pip-solver-7783
Use new pip resolver in plugins tox env
2020-09-23 09:32:02 -03:00
Bruno Oliveira 8215625135 Use new pip resolver in plugins tox env
Fix #7783
2020-09-23 09:16:48 -03:00
Ran Benita 5cfd7c0ddd
Merge pull request #7780 from bluetech/final
Mark some public and to-be-public classes as `@final`
2020-09-23 13:42:11 +03:00
Ran Benita a99ca879e7 Mark some public and to-be-public classes as `@final`
This indicates at least for people using type checkers that these
classes are not designed for inheritance and we make no stability
guarantees regarding inheritance of them.

Currently this doesn't show up in the docs. Sphinx does actually support
`@final`, however it only works when imported directly from `typing`,
while we import from `_pytest.compat`.

In the future there might also be a `@sealed` decorator which would
cover some more cases.
2020-09-22 12:40:40 +03:00
Bruno Oliveira 050c2df737
Use multiple issue template types and mention Discussions (#7739) 2020-09-21 20:22:25 +02:00
Bruno Oliveira 7324e90199
Update doc/en/writing_plugins.rst
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-09-19 16:14:28 -03:00
Bruno Oliveira cdfdb3a25d
Add docs about reusing fixtures from other projects (#7772)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-09-19 16:10:22 -03:00
Ran Benita 8eefe4eaf5
Merge pull request #7741 from bluetech/releasing-order
RELEASING: ~~first merge PR, then tag~~ clarify where to push the tag
2020-09-19 22:01:00 +03:00
Sorin Sbarnea b031a7cecf
Smoke tests for assorted plugins (#7721)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2020-09-19 15:56:52 -03:00
Ran Benita 027415502a RELEASING: clarify where to push the tag 2020-09-19 21:35:17 +03:00
Ran Benita 9f164b7227
Merge pull request #7766 from nicoddemus/backporting-docs
Add guidelines section about backporting
2020-09-19 21:18:41 +03:00
Ran Benita 4e460cdd9e
Merge pull request #7773 from nicoddemus/xml-properties-xdist-docs
Warning about record_testsuite_property not working with xdist
2020-09-19 21:06:40 +03:00
Florian Bruhin 89305e7b09
Improve output for missing config keys (#7572)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-19 12:57:29 -03:00
Bruno Oliveira c4ce5f2c98 Warning about record_testsuite_property not working with xdist
Related to #7767
2020-09-19 12:36:08 -03:00
Bruno Oliveira 9bfd14a443
Merge pull request #7749 from bluetech/fix-get_source-crash 2020-09-19 10:38:32 -03:00
Bruno Oliveira 895a8cf296 Add guidelines section about backporting
From https://github.com/pytest-dev/pytest/pull/7723#issuecomment-693310439
2020-09-17 10:06:04 -03:00
Bruno Oliveira 98608c439f
Merge pull request #7760 from finn0/docs/punctuation-mark
[Docs] remove semi-colon punctuation mark
2020-09-16 12:42:20 -03:00
Faris A Chugthai 9ceb4e6efc
Mistyped was mistyped (#7762) 2020-09-16 12:18:03 +02:00
Sorin Sbarnea da21fc5883
Improve output for missing required plugins/unknown config keys (#7723)
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2020-09-16 12:13:17 +02:00
Vipul Kumar 7470270f20
[Docs] remove semi-colon punctuation mark
Usually, we use semi-colon punctuation mark to connect closely related
ideas. Sentences which are after semicolon, begins with small letter,
and last sentence always ends with a period mark, see "Garner's Modern
American Usage" book for more information about usage of punctuation
mark. So removing punctuation mark altogether is a good idea, as
@gnikonorov suggested [1].

[1]: https://github.com/pytest-dev/pytest/pull/7760#pullrequestreview-489232607
2020-09-16 06:17:17 +00:00
Faris A Chugthai cdf2024070
Update writing_plugins.rst (#7757)
Capitalize the first word in a sentence and add a period at the end.
2020-09-15 16:41:27 +02:00
Bruno Oliveira f42c0cd1ec
Merge pull request #7747 from nicoddemus/cmdline-flags-docs
Add full command-line flags to the reference docs
2020-09-14 13:47:43 -03:00
Bruno Oliveira 4b46db8ae5 Add full command-line flags to the reference docs
Fix #7728
2020-09-14 13:42:06 -03:00
Anthony Sottile 7f7e383daf
Merge pull request #7753 from pytest-dev/asottile-patch-1
Update to deadsnakes/action@v2.0.0
2020-09-14 08:55:25 -07:00
Anthony Sottile a5fd2895b6
Update to deadsnakes/action@v2.0.0
should be a noop (despite the major version bump) -- I rewrote the action to be more stable and need fewer security updates
2020-09-13 12:55:56 -07:00
Anthony Sottile bc0020ad96
Merge pull request #7750 from pytest-dev/graingert-patch-1
permit tox config in non-tox.ini files for pytest-dev member projects
2020-09-13 09:37:35 -07:00
Anthony Sottile e04bc05e7e
Merge pull request #7751 from pytest-dev/graingert-patch-2
remove unused bitbucket link
2020-09-12 20:16:38 -07:00
Thomas Grainger 51752108b8
remove unused bitbucket link 2020-09-13 03:02:10 +01:00
Thomas Grainger 24c26a046e
permit tox config in non-tox.ini files for pytest-dev member projects 2020-09-13 00:41:00 +01:00
Ran Benita d18cb961cf assertion/rewrite: fix internal error on collection error due to decorated function
For decorated functions, the lineno of the FunctionDef AST node points
to the `def` line, not to the first decorator line. On the other hand,
in code objects, the `co_firstlineno` points to the first decorator
line.

Assertion rewriting inserts some imports to code it rewrites. The
imports are inserted at the lineno of the first statement in the AST. In
turn, the code object compiled from the rewritten AST uses the lineno of
the first statement (which is the first inserted import).

This means that given a module like this,

```py
@foo
@bar
def baz(): pass
```

the lineno of the code object without assertion rewriting
(`--assertion=plain`) is 1, but with assertion rewriting it is 3.

And *this* causes some issues for the exception repr when e.g. the
decorator line is invalid and raises during collection. The code becomes
confused and crashes with

INTERNALERROR>   File "_pytest/_code/code.py", line 638, in get_source
INTERNALERROR>     lines.append(space_prefix + source.lines[line_index].strip())
INTERNALERROR> IndexError: list index out of range

Fix it by special casing decorators. Maybe there are other cases like
this but off hand I can't think of another Python construct where the
lineno of the item would be after its first line, and this is the only
such issue we have had reported.
2020-09-12 23:05:08 +03:00
Ran Benita 35350e11cd assertion/rewrite: rewrite condition to be easier to follow 2020-09-12 22:57:50 +03:00
Bruno Oliveira 541b30a044 Improve docs about plugin discovery/loading at startup
Fix #7691
2020-09-12 14:11:43 -03:00
Bruno Oliveira 634cde9506
Merge pull request #7745 from asottile/exec_globals_type_problem
Fix INTERNALERROR when accessing locals / globals with faulty `exec`
2020-09-12 08:09:48 -03:00