Commit Graph

13017 Commits

Author SHA1 Message Date
Ran Benita 8d98de8f8a typing: set no_implicit_reexport
In Python, if module A defines a name `name`, and module B does `import
name from A`, then another module C can `import name from B`.

Sometimes it is intentional -- module B is meant to "reexport" `name`.
But sometimes it is just confusion/inconsistency on where `name` should
be imported from.

mypy has a flag `--no-implicit-reexport` which puts some order into
this. A name can only be imported from a module if

1. The module defines the name
2. The module's `__all__` includes the name
3. The module imports the name as `from ... import .. as name`.

This flag is included in mypy's `--strict` flag.

I like this flag, but I realize it is a bit controversial, and in
particular item 3 above is a bit unfriendly to contributors who don't
know about it. So I didn't intend to add it to pytest.

But while investigating issue 7589 I came upon mypy issue 8754 which
causes `--no-implicit-reexport` to leak into installed libraries and
causes some unexpected typing differences *in pytest* if the user uses
this flag.

Since the diff mostly makes sense, let's just conform to it.
2020-07-31 10:09:11 +03:00
Ran Benita 96a48f0c66 Stop using more-itertools
We barely use it; the couple places that do are not really worth the
extra dependency, I think the code is clearer without it.

Also simplifies one (regular) itertools usage.

Also improves a check and an error message in `pytest.raises`.
2020-07-30 20:19:24 +03:00
Bruno Oliveira e49f1d6f60 Merge pull request #7584 from pytest-dev/release-6.0.1
Prepare release 6.0.1

(cherry picked from commit 022bff27a71406bd5dc4794d34f1fbbf56a45250)
2020-07-30 09:46:53 -03:00
Ran Benita 645cbc91fc
Merge pull request #7581 from bluetech/logging-setlevel-handler-restore
Add missing changelog for issue 7569
2020-07-30 13:41:02 +03:00
Ran Benita 924e466c98 Add missing changelog for issue 7569 2020-07-30 12:38:40 +03:00
Hugo van Kemenade d756b4a543
Fix typo: remove stray indefinite article from release notes (#7552)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-29 12:19:33 -03:00
Mattreex 1e66ed0b1c
Warn about --basetemp removing the entire directory (#7555)
Co-authored-by: mattreex <mattreex.9@gail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-29 11:58:18 -03:00
Bruno Oliveira 49628786f0
Merge pull request #7575 from nicoddemus/fix-changelog-entries-release-process 2020-07-29 11:56:11 -03:00
Bruno Oliveira 22acbaf393 Minor changes to the release process
As discussed in https://github.com/pytest-dev/pytest/pull/7556
2020-07-29 11:35:27 -03:00
Bruno Oliveira e691d3ee52 Merge remote-tracking branch 'upstream/6.0.x' into fix-changelog-entries-release-process 2020-07-29 11:27:08 -03:00
Bruno Oliveira e8761576cd
Merge pull request #7574 from nicoddemus/backport-7561
[6.0.x] Merge pull request #7561 from nicoddemus/longreprtext-7559
2020-07-29 10:30:21 -03:00
Bruno Oliveira 3d2c114883
Merge pull request #7573 from nicoddemus/backport-7571
[6.0.x] logging: fix capture handler level not reset on teardown after caplog.set_level()
2020-07-29 10:30:00 -03:00
Bruno Oliveira fe252848c5 Merge pull request #7561 from nicoddemus/longreprtext-7559 2020-07-29 09:47:31 -03:00
Bruno Oliveira 095bf191e2
Merge pull request #7561 from nicoddemus/longreprtext-7559 2020-07-29 09:47:04 -03:00
Bruno Oliveira f9d5f6e60a Merge pull request #7571 from bluetech/logging-setlevel-handler-restore
logging: fix capture handler level not reset on teardown after caplog.set_level()
2020-07-29 09:38:33 -03:00
Bruno Oliveira cefe064bb0
Merge pull request #7571 from bluetech/logging-setlevel-handler-restore
logging: fix capture handler level not reset on teardown after caplog.set_level()
2020-07-29 09:37:57 -03:00
Bruno Oliveira d3267bc49d Fix TestReport.longreprtext when TestReport.longrepr is not a string
Fix #7559
2020-07-29 09:31:15 -03:00
Ran Benita 0e0275d8d9 logging: fix capture handler level not reset on teardown after caplog.set_level()
This probably regressed in fcbaab8.
2020-07-29 14:59:29 +03:00
Ran Benita d46fe88ec3
Merge pull request #7566 from bluetech/pylint-callable-2-6.0.x
[6.0.x] mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
2020-07-29 13:04:23 +03:00
Ran Benita bec1bdaa2c mark: fix extraneous spaces in dummy type-checking marks
(cherry picked from commit 54e08b7230)
2020-07-29 12:41:02 +03:00
Ran Benita 422685d0bd
Merge pull request #7567 from bluetech/pylint-callable-2-space
mark: fix extraneous spaces in dummy type-checking marks
2020-07-29 12:40:21 +03:00
Ran Benita b473e515bc
Merge pull request #7541 from bluetech/py-visit
pathlib: stop using py.path.local.visit(), use os.scandir
2020-07-29 12:04:06 +03:00
Ran Benita 20a3a28815
Merge pull request #7536 from bluetech/junitxml-etree
junitxml: convert from py.xml to xml.etree.ElementTree
2020-07-29 12:01:33 +03:00
Ran Benita 54e08b7230 mark: fix extraneous spaces in dummy type-checking marks 2020-07-29 11:58:54 +03:00
Ran Benita edb6211e36 Merge pull request #7565 from bluetech/pylint-callable-2
mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
(cherry picked from commit f9837f953c)
2020-07-29 11:51:08 +03:00
Ran Benita f9837f953c
Merge pull request #7565 from bluetech/pylint-callable-2
mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
2020-07-29 11:49:41 +03:00
Ran Benita c755840793 pre-commit: extend list of rejected py modules
We now only use `py.path.local`.
2020-07-29 10:52:21 +03:00
Ran Benita f86e4516eb junitxml: convert from py.xml to xml.etree.ElementTree
Part of the effort to reduce dependency on the py library.

Besides that, py.xml implements its own XML serialization which is
pretty scary.

I tried to keep the code with minimal changes (though it could use some
cleanups). The differences in behavior I have noticed are:

- Attributes in the output are not sorted.

- Some unneeded escaping is no longer performed, for example escaping
  `"` to `&quot;` in a text node.
2020-07-29 10:52:21 +03:00
Ran Benita 1653c49b1b junitxml: simplify bin_xml_escape
1. Remove sys.maxunicode check & comment. Nowadays it is always a
   constant 0x10ffff.
2. Pre-generate the pattern. Possible due to 1.
3. Compile the regex lazily. No reason to pay startup cost for it.
4. Add docstring in particular to explain a subtle point.
2020-07-29 10:52:21 +03:00
Ran Benita 6ea6f0dac8 junitxml: compile a regex lazily
Instead of slowing down startup, and making the code harder to follow,
compile it lazily (it is still cached internally).
2020-07-29 10:52:21 +03:00
hp310780 27a4c6cd6d
Fix --help crash on add_ini(.., help='') and improve message on help=None (#7427) 2020-07-29 10:48:38 +03:00
Ran Benita b36bcd13e9 mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
Apparently the previous fix c1ca42b5c2 didn't work.
Hopefully this time I'm testing this correctly.
2020-07-29 10:39:13 +03:00
Drew Devereux 88cc636c18
Update markers.rst (#7563)
Extra colon to make code block render correctly
2020-07-29 09:10:13 +02:00
Bruno Oliveira c7216ae0f6
Merge pull request #7557 from nicoddemus/announce-templates 2020-07-28 21:20:26 -03:00
Bruno Oliveira df09a31646
Merge pull request #7556 from nicoddemus/cherry-pick-release
Merge pull request #7550 from pytest-dev/release-6.0.0
2020-07-28 21:04:26 -03:00
Bruno Oliveira 109b6cb32c Update text and links in announce templates
The links were still pointing to the latest version (instead of stable)
and also took the opportunity to update the text a bit.
2020-07-28 17:29:09 -03:00
Bruno Oliveira 70764bef4f Merge pull request #7550 from pytest-dev/release-6.0.0 2020-07-28 17:01:27 -03:00
Bruno Oliveira 5d606e9c40
Merge pull request #7550 from pytest-dev/release-6.0.0 2020-07-28 16:59:46 -03:00
Bruno Oliveira 41a4539594
Add link to 6.0.0rc1 changelog 2020-07-28 14:15:45 -03:00
Bruno Oliveira 45ced1dc05
Update doc/en/announce/release-6.0.0.rst
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-07-28 10:46:03 -03:00
pytest bot 1e4b8d447c Prepare release version 6.0.0 2020-07-28 11:44:27 +00:00
Bruno Oliveira 38029828d1
Support generating major releases using issue comments (#7548) 2020-07-28 13:40:14 +02:00
Anthony Sottile c2c0b7a542
Merge pull request #7545 from asottile/pylib_in_docs
remove usage of pylib in docs
2020-07-27 09:36:58 -07:00
Anthony Sottile 9818899df4 remove usage of pylib in docs 2020-07-26 17:57:25 -07:00
Ran Benita 3633b691d8 pathlib: make visit() independent of py.path.local, use os.scandir
`os.scandir()`, introduced in Python 3.5, is much faster than
`os.listdir()`. See https://www.python.org/dev/peps/pep-0471/.

It also has a `DirEntry` which can be used to further reduce syscalls in
some cases.
2020-07-25 00:47:29 +03:00
Ran Benita c15bb5d3de pathlib: replace py.path.local.visit() with our own function
Part of reducing dependency on `py`. Also enables upcoming improvements.

In cases where there are simpler alternatives (in tests), I used those.

What's left are a couple of uses in `_pytest.main` and `_pytest.python`
and they only have modest requirements, so all of the featureful code
from py is not needed.
2020-07-25 00:26:49 +03:00
Zac Hatfield-Dodds 3a060b77e8
Revert change to traceback repr (#7535)
* Revert change to traceback repr

* Add test and changelog entry

* Restore *exact* prev output

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-24 13:30:38 +02:00
Bruno Oliveira 7ec6401ffa
Change pytest deprecation warnings into errors for 6.0 release (#7362)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-07-22 21:36:51 -03:00
Bruno Oliveira a9799f0b35
Merge pull request #7531 from bluetech/changelog-mypy-version
doc: mention mypy<0.750 doesn't work in typing changelog
2020-07-22 16:21:11 -03:00
Ran Benita 102360b490
Merge pull request #7519 from hroncok/pytest_warning_captured_deprecated
List pytest_warning_captured in deprecated things for 6.0.0rc1
2020-07-22 20:50:52 +03:00