Commit Graph

12809 Commits

Author SHA1 Message Date
Ran Benita acc9310c17 capture: add type annotations to CaptureFixture
It now has a str/bytes type parameter.
2020-08-10 18:14:47 +03:00
Ran Benita 8a66f0a96d capture: overcome a mypy limitation by making CaptureResult a regular class
See the code comment for the rationale.
2020-08-10 18:14:47 +03:00
Bruno Oliveira bee72e1925
Merge pull request #7629 from samestep/patch-1
Fix typos in Ali Afshar's name
2020-08-07 20:02:26 -03:00
Sam Estep a27c539a85
Fix typos in Ali Afshar's name
The correct name is visible in the Bitbucket link.
2020-08-07 15:22:10 -07:00
Ran Benita 384b6f6866
Merge pull request #7619 from bluetech/py-to-pathlib
Some py.path -> pathlib conversions
2020-08-07 11:33:21 +03:00
Ran Benita f8c4e038fd Replace some usages of py.path.local 2020-08-06 18:46:17 +03:00
Ran Benita 70f3ad1c1f config/findpaths: convert from py.path.local to pathlib 2020-08-06 18:46:17 +03:00
Ran Benita 9e55288ba4 pathlib: add absolutepath() as alternative to Path.resolve()
Didn't call it absolute or absolute_path to avoid conflicts with
possible variable names.

Didn't call it abspath to avoid confusion with os.path.abspath.
2020-08-06 18:16:04 +03:00
Ran Benita e0d0951945 pathlib: add analogues to py.path.local's bestrelpath and common
An equivalent for these py.path.local functions is needed for some
upcoming py.path -> pathlib conversions.
2020-08-06 18:16:04 +03:00
Ran Benita aa9905d72e
Merge pull request #7625 from nicoddemus/pypy3-async-unittest-7624
Fix test_plain_unittest_does_not_support_async on pypy3
2020-08-06 08:31:46 +03:00
Bruno Oliveira 67cb7ef673 Fix test_plain_unittest_does_not_support_async on pypy3
Fix #7624
2020-08-05 15:24:08 -03:00
Rüdiger Busche a64298ff5e
Document registering markers in pyproject.toml (#7622)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-08-05 12:03:27 -03:00
Bruno Oliveira 44cd8a3a86
Demonstrate that plain unittest does not support async tests (#7607)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-08-04 19:37:41 -03:00
Ran Benita 2bd0d97fcc
Merge pull request #7601 from bluetech/typing-longrepr
typing: resultlog, pytester, longrepr
2020-08-04 23:23:56 +03:00
Ran Benita fbf251f11d Improve typing of reports' longrepr field 2020-08-04 22:52:24 +03:00
Ran Benita f0eb82f7d4 pytester: improve type annotations 2020-08-04 22:46:30 +03:00
Ran Benita 62ddf7a0e5 resultlog: add missing type annotations 2020-08-04 22:45:46 +03:00
Ran Benita 303030c141
Merge pull request #7613 from bluetech/typing-warn-unreachable
typing: set warn_unreachable
2020-08-04 22:44:21 +03:00
Bruno Oliveira 0d65e4b454
Merge pull request #7606 from nicoddemus/pre-release-docs
Add docs for releasing major/release candidates
2020-08-04 15:37:19 -03:00
Yutaro Ikeda 84c4b64354
Better document -k partial matching (#7610) 2020-08-04 15:30:08 -03:00
Bruno Oliveira d688fefecb
Merge pull request #7614 from The-Compiler/log-print
Properly remove log_print
2020-08-04 13:39:21 -03:00
Ran Benita 9ab14c6d9c typing: set warn_unreachable
This makes mypy raise an error whenever it detects code which is
statically unreachable, e.g.

    x: int
    if isinstance(x, str):
        ... # Statement is unreachable  [unreachable]

This is really neat and finds quite a few logic and typing bugs.

Sometimes the code is intentionally unreachable in terms of types, e.g.
raising TypeError when a function is given an argument with a wrong
type. In these cases a `type: ignore[unreachable]` is needed, but I
think it's a nice code hint.
2020-08-04 09:59:46 +03:00
Florian Bruhin 1c9b84756f Properly remove log_print
This is a follow up to 3f8200676f which didn't
make it clear that log_print is also removed in the changelog and didn't remove
it from the reference docs.
2020-08-04 08:53:09 +02:00
Ran Benita 0dd5e169d0
Merge pull request #7603 from bluetech/flake8-docstrings
Enforce some pydocstyle lints with flake8-docstrings & docstring fixes in testing/
2020-08-04 08:15:55 +03:00
Ran Benita 9a18b57c7c Enforce some pydocstyle lints with flake8-docstrings
There are some ones we *would* like to enforce, like
    D401 First line should be in imperative mood
but have too many false positives, so I left them out.
2020-08-03 10:21:59 +03:00
Ran Benita b8471aa527 testing: fix some docstring issues
In preparation for enforcing some docstring lints.
2020-08-03 10:10:43 +03:00
Anthony Sottile 701998bf2c
Merge pull request #7598 from nicoddemus/setuptools-scm-pyproject
Configure setuptools_scm using pyproject.toml
2020-08-01 19:17:33 -07:00
Ran Benita be354b36f3
Merge pull request #7604 from bluetech/typing-disallow-any-generics
typing: set disallow_any_generics
2020-08-01 20:55:45 +03:00
Ran Benita be656dd4e4 typing: set disallow_any_generics
This prevents referring to a generic type without filling in its generic
type parameters.

The FixtureDef typing might need some more refining in the future.
2020-08-01 20:39:15 +03:00
Bruno Oliveira d1fa749b83 Add readthedocs config file to use pip for installation 2020-08-01 14:21:36 -03:00
Bruno Oliveira d7ad55bb2a Add docs for releasing major/release candidates
Fix #7447
2020-08-01 13:51:12 -03:00
Ran Benita 1e9c638468
Merge pull request #7602 from ctb/patch-1
Minor formatting fix in xunit_setup.rst
2020-08-01 18:08:03 +03:00
C. Titus Brown a2d562d369
Minor formatting fix in xunit_setup.rst
Fixed location of double-backquote for verbatim text.
2020-08-01 07:33:03 -07:00
Ran Benita 49827adcb9
Merge pull request #7510 from bluetech/docstrings
Format docstrings in a consistent style
2020-08-01 17:32:01 +03:00
Ran Benita cbec0f8c6a CONTRIBUTING: document the docstring style we use 2020-08-01 17:14:38 +03:00
Ran Benita 0242de4f56 Format docstrings in a consistent style 2020-08-01 17:14:37 +03:00
Bruno Oliveira 6882c0368b
Merge pull request #7593 from bluetech/typing-no-implicit-reexport
typing: set no_implicit_reexport
2020-08-01 11:03:47 -03:00
Bruno Oliveira 07f7372aff
Merge pull request #7586 from nicoddemus/cp-release
Merge pull request #7584 from pytest-dev/release-6.0.1
2020-08-01 11:00:38 -03:00
Anthony Sottile d5a49100cf
Try this maybe? 2020-07-31 21:44:44 -07:00
Bruno Oliveira 4f0793a462
Require setuptools >=42 2020-07-31 18:17:12 -03:00
Bruno Oliveira 09265eb7c7 Configure setuptools_scm using pyproject.toml 2020-07-31 15:46:02 -03:00
Ran Benita a1ba8dfe2a
Merge pull request #7587 from bluetech/rm-more-itertools
Stop using more-itertools
2020-07-31 13:08:34 +03:00
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