Ran Benita
637e8efdd4
mark/structures: slightly optimize some functions
...
`normalize_mark_list` shows up in pandas collection profiles. It's
simple enough to improve.
2021-10-02 14:06:52 +03:00
Bruno Oliveira
a83b359cf0
Refactor internal scope handling by introducing Scope enum
...
PR #8913
2021-08-01 06:11:56 -03:00
Simon K
1d848314d0
some small quality of life changes ( #8454 )
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-07-26 07:48:15 -03:00
Florian Bruhin
953fdabaf0
Adjust doc links for new scheme
...
Closes #8831
2021-07-06 09:11:35 +02:00
pre-commit-ci[bot]
d200598de9
[pre-commit.ci] pre-commit autoupdate ( #8547 )
...
* [pre-commit.ci] pre-commit autoupdate
* [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: Ran Benita <ran@unusedvar.com>
2021-04-14 12:49:09 +03: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
6aa4d1c7ab
mark: export pytest.MarkGenerator 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-20 15:59:20 +02:00
Ran Benita
69c302479e
mark: export pytest.MarkDecorator 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-20 15:59:06 +02:00
Ran Benita
2ec372df8b
mark: export pytest.Mark 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-20 15:58:49 +02:00
Bruno Oliveira
30287b49cd
Deprecate --strict ( #7985 )
...
Fix #7530
2020-11-06 09:48:20 +01:00
Anthony Sottile
33d119f71a
py36+: com2ann
2020-10-05 18:33:17 -07:00
Anthony Sottile
66bd44c13a
py36+: pyupgrade: py36+
2020-10-03 12:46:54 -07:00
Anthony Sottile
022ac9b9e8
Merge pull request #7846 from asottile/py36_black
...
py36+: update the target version of black to py36
2020-10-03 11:45:45 -07:00
Anthony Sottile
f295b0267d
py36+: update the target version of black to py36
2020-10-03 08:17:22 -07:00
Anthony Sottile
7f0d2beb50
py36+: remove _pytest.compat.overload
2020-10-03 08:01:22 -07:00
Anthony Sottile
6ed07a1c25
Merge pull request #7840 from asottile/py36_typing_Type
...
py36+: from typing import Type: no longer need guard
2020-10-03 07:44:06 -07:00
Anthony Sottile
53b5f64b4b
py36+: resolve py36 TODOs
2020-10-02 19:57:55 -07:00
Anthony Sottile
bfadd4060e
py36+: from typing import Type: no longer need guard
2020-10-02 19:50:10 -07:00
Anthony Sottile
2c7b7d8f66
Merge pull request #7836 from asottile/py36_typing_X
...
py36+: replace typing.X with X
2020-10-02 19:47:42 -07:00
Anthony Sottile
cf220b92a2
py36+: replace typing.X with X
2020-10-02 15:05:13 -07:00
Anthony Sottile
a238d1f37d
py36+: remove TYPE_CHECKING from _pytest.compat
...
automated with:
```bash
git grep -l 'from .* import TYPE_CHECKING' |
xargs reorder-python-imports \
--application-directories .:src \
--remove-import 'from _pytest.compat import TYPE_CHECKING' \
--add-import 'from typing import TYPE_CHECKING'
```
2020-10-02 15:03:24 -07: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
Ran Benita
f28af14457
Don't use NotImplementedError in `@overload`s
...
We used it as a shortcut for avoiding coverage, but pylint has a special
interpretation of it as an abstract method which we don't want.
2020-08-14 13:54:46 +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
Ran Benita
0242de4f56
Format docstrings in a consistent style
2020-08-01 17:14:37 +03:00
Ran Benita
54e08b7230
mark: fix extraneous spaces in dummy type-checking marks
2020-07-29 11:58:54 +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
Ran Benita
bc17034a67
Fix typing of params ids callable form
...
The previous typing had an object passed to the user, which they can't
do anything with without asserting, which is inconvenient. Change it to
Any instead.
Note that what comes *back* to pytest (the return value) should be an
`object`, because we want to handle arbitrary objects without assuming
anything about them.
2020-07-14 14:53:42 +03:00
Ran Benita
1a73e78698
mark: fix typing for `@pytest.mark.xfail(raises=...)`
2020-07-14 01:39:04 +03:00
Ran Benita
7b65b2337b
Merge pull request #7472 from bluetech/cleanups-4
...
Some minor fixes & type annotations
2020-07-11 19:05:07 +03:00
Ran Benita
c1ca42b5c2
mark/structure: fix pylint complaining that builtin marks are not callable
2020-07-10 23:10:17 +03:00
Ran Benita
a2f021b6f3
Remove no longer needed `noqa: F821` uses
...
Not needed since pyflakes 2.2.0.
2020-07-10 13:08:56 +03:00
Bruno Oliveira
93d2ccbfb7
Point to stable docs instead of latest
...
Now that our master might contain new features, it is best to point
users to the stable docs rather than the latest
2020-07-07 07:45:27 -03:00
Ran Benita
e492b1d567
python: don't pass entire Item for generating ID
...
Just the nodeid is enough for the error messages.
This removes an import cycle.
2020-06-30 13:13:45 +03:00
Ran Benita
b3fb5a2d47
Type annotate pytest.mark.* builtin marks
2020-06-21 20:18:52 +03:00
Ran Benita
f84ffd9747
Remove unused type: ignores
...
Not needed since update from mypy 0.770 -> 0.780.
2020-06-12 17:34:31 +03:00
Ran Benita
848ab00663
Type annotate `@pytest.mark.foo`
2020-06-05 11:34:20 +03:00
Ran Benita
0fb081aec6
Type annotate some hookspecs & impls
...
Annotate some "easy" arguments of hooks that repeat in a lot of internal
plugins.
Not all of the arguments are annotated fully for now.
2020-06-05 11:34:19 +03:00
Ran Benita
ff8b7884e8
Type annotate ParameterSet
2020-06-05 11:34:19 +03:00
Ran Benita
43fa1ee8f9
Type annotate some misc places with no particular connection
2020-06-05 11:34:19 +03:00
Ran Benita
69143fe5b0
code: fix import cycles between code.py and source.py
...
These two files were really intertwined. Make it so code.py depends on
source.py without a reverse dependency.
No functional changes.
2020-05-06 11:01:32 +03:00
Ran Benita
4344c61731
Slightly improve Mark and MarkDecorator documentation
...
Mostly I wanted to get rid of mentions of "MarkItem" which is something
that no longer exists, but I improved a little beyond that and annotated
some simple types.
2020-04-07 22:14:47 +03:00
Bruno Oliveira
78baa7b575
Merge remote-tracking branch 'upstream/master' into mm
...
Conflicts:
src/_pytest/main.py
src/_pytest/mark/structures.py
src/_pytest/python.py
testing/test_main.py
testing/test_parseopt.py
2020-02-11 19:22:28 -03:00
Ran Benita
7cc513b2af
Remove unused NodeMarkers
...
This class was both added and became unused during the development of a
PR:
https://github.com/pytest-dev/pytest/pull/3317
2020-02-10 22:05:25 +02:00
Daniel Hahler
30cb598e9c
Typing around/from types in docs ( #6699 )
2020-02-09 11:42:07 +01:00
Daniel Hahler
b0d45267c5
internal: clean up getfslineno
...
Everything was using `_pytest.compat.getfslineno` basically, which
wrapped `_pytest._code.source.getfslineno`.
This moves the extra code from there into it directly, and uses the
latter everywhere.
This helps to eventually remove the one in compat eventually, and also
causes less cyclic imports.
2020-02-03 19:09:08 +01:00
Philipp Loose
a02310a140
Add stacklevel tests for warnings, 'location' to pytest_warning_captured
...
Resolves #4445 and #5928 (thanks to allanlewis)
Add CHANGELOG for location parameter
2019-11-22 17:50:00 -03:00
Daniel Hahler
2c941b5d13
parametrized: ids: support generator/iterator
...
Fixes https://github.com/pytest-dev/pytest/issues/759
- Adjust test_parametrized_ids_invalid_type, create list to convert tuples
Ref: https://github.com/pytest-dev/pytest/issues/1857#issuecomment-552922498
- Changelog for int to str conversion
Ref: https://github.com/pytest-dev/pytest/issues/1857#issuecomment-552932952
2019-11-20 19:02:17 +01:00
Daniel Hahler
4ad61cbcf6
Improve check for misspelling of parametrize
...
- there is no need to do this with `--strict-markers`
- it can be done when looking up marks, instead of for every generated
test
2019-11-19 16:05:52 +01:00
Ran Benita
84b2c81db4
Drop the "alias" helper used in MarkDecorator
...
It is a little too obscure IMO, but the reason I want to drop it is that
type checking has no hope of understanding such dynamic constructs.
The warning argument wasn't used.
2019-11-08 11:22:46 +02:00