Ronny Pfannschmidt
a9e43152bc
alter the PyObjMixin to carry over typing information from Node
...
as PyObjMixin is always supposed to be mixed in the mro
before nodes.Node the behavior doesn't change,
but all the typing information carry over to help mypy.
extracted from #8037
2021-01-17 14:36:28 +01:00
Ran Benita
c9e9a599fe
Merge pull request #8241 from bluetech/skip-improvements
...
Minor code improvements in nose, unittest, skipping
2021-01-15 15:35:57 +02:00
Ran Benita
25e657bfc1
Deprecate raising unittest.SkipTest to skip tests during collection
...
It is not very clear why this code exists -- we are not running any
unittest or nose code during collection, and really these frameworks
don't have the concept of collection at all, and just raising these
exceptions at e.g. the module level would cause an error. So unless I'm
missing something, I don't think anyone is using this.
Deprecate it so we can eventually clear up this code and keep unittest
more tightly restricted to its plugin.
2021-01-15 00:05:33 +02:00
Ran Benita
7f989203ed
Improve way in which skip location is fixed up when skipped by mark
...
When `pytest.skip()` is called inside a test function, the skip location
should be reported as the line that made the call, however when
`pytest.skip()` is called by the `pytest.mark.skip` and similar
mechanisms, the location should be reported at the item's location,
because the exact location is some irrelevant internal code.
Currently the item-location case is implemented by the caller setting a
boolean key on the item's store and the `skipping` plugin checking it
and fixing up the location if needed. This is really roundabout IMO and
breaks encapsulation.
Instead, allow the caller to specify directly on the skip exception
whether to use the item's location or not. For now, this is entirely
private.
2021-01-14 18:07:25 +02:00
Ran Benita
3dde519f53
nose: type annotate with some resulting refactoring
2021-01-14 17:42:38 +02:00
Ran Benita
096bae6c68
unittest: add clarifying comment on unittest.SkipTest -> pytest.skip code
...
I was tempted to remove it, until I figured out why it was there.
2021-01-14 17:06:14 +02:00
Ran Benita
addbd3161e
nose,fixtures: use the public item API for adding finalizers
2021-01-14 16:53:07 +02:00
Anton
42d5545f42
unittest: cleanup unexpected success handling ( #8231 )
...
* unittest: cleanup unexpected success handling
* update comment
2021-01-13 17:02:26 -08:00
Bruno Oliveira
7a5a6cb51c
Merge pull request #8235 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.5
...
build(deps): bump django from 3.1.4 to 3.1.5 in /testing/plugins_integration
2021-01-11 08:24:47 -03:00
Bruno Oliveira
203a9b3ab2
Merge pull request #8234 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.5.1
...
build(deps): bump pytest-mock from 3.4.0 to 3.5.1 in /testing/plugins_integration
2021-01-11 08:24:33 -03:00
dependabot[bot]
cfa0c3b0d9
build(deps): bump django in /testing/plugins_integration
...
Bumps [django](https://github.com/django/django ) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/django/django/releases )
- [Commits](https://github.com/django/django/compare/3.1.4...3.1.5 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-01-11 03:16:03 +00:00
dependabot[bot]
af78efc7fa
build(deps): bump pytest-mock in /testing/plugins_integration
...
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock ) from 3.4.0 to 3.5.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases )
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.4.0...v3.5.1 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-01-11 03:15:59 +00:00
Ran Benita
f6529fd3a1
Merge pull request #8232 from imrehg/doc
...
Add missing import into example script in documentation
2021-01-08 14:08:47 +02:00
Gergely Imreh
80c33c8178
Add missing import into example script in documentation
2021-01-08 11:43:51 +00:00
Bruno Oliveira
31ae4e1764
Merge pull request #8225 from The-Compiler/training-update
...
doc: Add note about training early bird discount
2021-01-05 16:31:04 -03:00
Florian Bruhin
65b8391ead
doc: Add note about training early bird discount
2021-01-05 19:39:50 +01:00
Bruno Oliveira
329fff69a3
Merge pull request #8220 from xuhdev/module-doc
...
DOC: Mark pytest module
2021-01-05 13:25:02 -03:00
Ran Benita
5336ba28cc
Merge pull request #8218 from bluetech/reports2
...
Misc small code improvements
2021-01-04 22:47:32 +02:00
bengartner
8e00df4c4b
Add dot prefix if file makefile extension is invalid for pathlib ( #8222 )
2021-01-04 15:58:11 +02:00
Ran Benita
8d16bec329
Merge pull request #8216 from xuhdev/testdir-pytester
...
DOC: Update multiple references to testdir to pytester
2021-01-02 11:58:59 +02:00
Hong Xu
14b5f5e528
DOC: Mark pytest module
...
Pytest document currently does not index the top-level package name
`pytest`, which causes some trouble when building documentation that
cross-refers to the pytest package via ``:mod:`pytest` ``.
2021-01-02 00:34:52 -08:00
Ran Benita
2ff88098a7
python: inline a simple method
...
I don't think it adds much value!
2021-01-01 23:23:08 +02:00
Ran Benita
8ee6d0a866
Always use getfixturemarker() to access _pytestfixturefunction
...
Keep knowledge of how the marker is stored encapsulated in one place.
2021-01-01 23:22:10 +02:00
Ran Benita
ade253c790
fixtures: type annotate FixtureRequest.keywords
2021-01-01 23:18:17 +02:00
Ran Benita
6c575ad8c8
fixtures: simplify FixtureRequest._get_fixturestack()
2021-01-01 23:15:57 +02:00
Hong Xu
b02f1c8ae7
DOC: Update multiple references to testdir to pytester
...
In https://docs.pytest.org/en/stable/reference.html#testdir , it is
suggested:
> New code should avoid using testdir in favor of pytester.
Multiple spots in the documents still use testdir and they can be quite
confusing (especially the plugin writing guide).
2021-01-01 12:21:39 -08:00
Ran Benita
bbd22e1769
Merge pull request #8214 from sousajf1/sousajo_patch_8204_1
...
pytest-dev#8204 migrate tests on testing/code/test_source to tmp_path
2021-01-01 20:44:40 +02:00
sousajo
ac428f67eb
pytest-dev#8204 migrate tests on testing/code/test_source to tmp_path
2021-01-01 16:55:03 +00:00
sousajf1
20c59e3aa4
pytest-dev#8204 migrate some tests to tmp_path fixture ( #8209 )
...
migrating some tests from tmpdir to tmp_path fixture
2021-01-01 17:25:11 +02:00
Ran Benita
73c4105230
reports: improve a type annotation
2021-01-01 15:22:05 +02:00
Ran Benita
7d306e9e86
reports: BaseReport.{passed,failed,skipped} more friendly to mypy
...
Not smart enough to understand the previous code.
2021-01-01 15:22:05 +02:00
mefmund
5f11a35b99
Add missing fixture ( #8207 )
...
Co-authored-by: Florian Bruhin <me@the-compiler.org>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-12-31 15:25:44 -03:00
Anton
48c9a96a03
Fix failing staticmethod tests if they are inherited ( #8205 )
...
* Fix failing staticmethod tests if they are inherited
* add comments, set default=None
2020-12-30 19:00:37 -08:00
Ran Benita
7585221d55
Merge pull request #8195 from christophebedard/add-missing-space-version-option-help-message
...
Add missing space in '--version' help message
2020-12-30 11:57:02 +02:00
pre-commit-ci[bot]
ee03e31831
[pre-commit.ci] pre-commit autoupdate ( #8201 )
...
* [pre-commit.ci] pre-commit autoupdate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* manual fixes after configuration update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Anthony Sottile <asottile@umich.edu>
2020-12-30 11:56:09 +02:00
Ran Benita
7751904875
Merge pull request #8194 from bluetech/typing-public-3
...
Export pytest.Metafunc and pytest.Callinfo, hide NodeKeywords
2020-12-29 18:22:02 +02:00
Ran Benita
e772f02d15
Merge pull request #8188 from antonblr/subprocess-coverage
...
coverage: Include code that runs in subprocesses
2020-12-28 19:05:33 +02:00
Christophe Bedard
bf9b59b3c8
Add missing space in '--version' help message
2020-12-28 10:50:06 -05:00
antonblr
8550c29180
coverage: Include code that runs in subprocesses
2020-12-26 16:59:07 -08:00
Ran Benita
96ea867fec
runner: export pytest.CallInfo for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
This also documents `from_call` as public, because at least
pytest-forked uses it, so we must treat it as public already anyway.
2020-12-26 21:38:37 +02:00
Ran Benita
bd76042344
python: export pytest.Metafunc for typing purposes
...
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-26 21:05:02 +02:00
Ran Benita
6d3a66d947
nodes: avoid needing to expose NodeKeywords for typing
...
It adds no value over exporting just the ABC so do that to reduce the
API surface.
2020-12-26 19:54:07 +02:00
Ran Benita
d8d2df7e6f
Merge pull request #8174 from bluetech/py-to-pathlib-5
...
More py.path -> pathlib conversions
2020-12-26 15:01:07 +02:00
Bruno Oliveira
da01ee0a4b
Merge pull request #8185 from bluetech/revert-docs-pygments-workaround
...
Revert "doc: temporary workaround for pytest-pygments lexing error"
2020-12-22 20:36:29 -03:00
Bruno Oliveira
af5da977e3
Merge pull request #8187 from pytest-dev/asottile-patch-1
...
Add badge for pre-commit.ci
2020-12-22 20:08:01 -03:00
Anthony Sottile
35d6a7e78e
Add badge for pre-commit.ci
...
See #8186
2020-12-22 14:57:04 -08:00
Ran Benita
5e323becb7
Revert "doc: temporary workaround for pytest-pygments lexing error"
...
Support was added in pytest-pygments 2.2.0.
This reverts commit 0feeddf8ed
.
2020-12-22 21:15:27 +02:00
Ran Benita
ca4effc822
Convert most of the collection code from py.path to pathlib
2020-12-22 21:09:36 +02:00
Ran Benita
4faed28261
testing: convert some tmpdir to tmp_path
...
The tmpdir fixture (and its factory variant) is soft-deprecated in favor
of the tmp_path fixture.
2020-12-22 21:08:25 +02:00
Ran Benita
a218413008
pathlib: missing type annotation for fnmatch_ex
2020-12-22 21:08:25 +02:00