Ran Benita
978b315861
Simplify some exception handling code
...
Mostly avoid unnecessary usage of sys.exc_info(). Since Python3,
exception objects themselves have all that's needed. They are also
easier to type.
2020-03-07 13:18:54 +02:00
Kyle Altendorf
dce2621710
Add pytest-twisted to list of async def handling plugins
...
https://github.com/pytest-dev/pytest-twisted/tree/v1.12#ensuredeferred
[pytest-twisted](https://github.com/pytest-dev/pytest-twisted ) supports `async def` test functions and fixtures as well as `async def`/`yield` fixtures.
2020-03-04 17:42:08 -05:00
Daniel Hahler
f10ab021e2
Move _collectfile to FSCollector ( #6830 )
...
Previously this was implemented both on `Session` and `Package`, where
the extra code in `Package._collectfile` was not covered/used.
Ref: https://github.com/pytest-dev/pytest/pull/6830#issuecomment-592663236
2020-02-29 11:40:11 +01:00
Ran Benita
7b8968ff80
Merge pull request #6735 from bluetech/metafunc-annotate
...
Type annotate Metafunc
2020-02-15 23:32:14 +02:00
Ran Benita
5945c3fe88
Type annotate Metafunc
2020-02-15 17:13:18 +02:00
Ran Benita
a7a1686433
Add Item.runtest stub implementation
...
Every Item must implement this method (called on all items collected in
a session). Add a stub for typing and clarity.
2020-02-15 16:58:55 +02:00
Ran Benita
8a4d5227e2
Remove unused CallSpec2 fields _globalid, _globalparam
2020-02-13 12:31:48 +02: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
Daniel Hahler
30cb598e9c
Typing around/from types in docs ( #6699 )
2020-02-09 11:42:07 +01:00
Vladyslav Rachek
9e262038c8
[parametrize] enforce explicit argnames declaration ( #6330 )
...
Every argname used in `parametrize` either must
be declared explicitly in the python test function, or via
`indirect` list
Fix #5712
2020-02-06 20:20:25 -03:00
Daniel Hahler
5a4c1b628b
Use inspect.getdoc to massage fixture docstrings ( #6668 )
...
Ref: https://github.com/pytest-dev/pytest/pull/2575
2020-02-04 03:07:53 +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
Daniel Hahler
8ec4d03c91
Inline FunctionMixin with Function ( #6664 )
...
`Generator` was removed in 7eb28f9eb
, and this pleases mypy to correctly
complain that `FunctionMixin` has no `config` (within
`_prunetraceback`).
* typing: _prunetraceback
* minor: imports, typing
2020-02-03 10:25:32 +01:00
Daniel Hahler
a9c5d31806
PyCollector._genfunctions: use already created fixtureinfo ( #6636 )
...
`Function` creates a `_fixtureinfo` already:
https://github.com/pytest-dev/pytest/blob/fed535694/src/_pytest/python.py#L1392-L1395
2020-02-01 06:27:41 +01:00
Ran Benita
a435faad5c
Merge branch 'master' into master-to-features
2020-01-31 11:27:06 +02:00
Daniel Hahler
442dccef65
python: factor out async_warn
2020-01-30 22:55:23 +01:00
Bruno Oliveira
64ab68ff0a
Fix 6341 disallow session config in fromparent ( #6387 )
...
Fix 6341 disallow session config in fromparent
2020-01-29 19:21:02 -03:00
Anthony Sottile
abd5fc80e8
Fix node ids which contain a parametrized empty-string variable
2020-01-28 13:27:54 -08:00
Ran Benita
ae5d16be10
typing: FSHookProxy/gethookproxy
...
Taken out of https://github.com/pytest-dev/pytest/pull/6556 .
2020-01-27 20:57:44 +01:00
Daniel Hahler
e2934c3f8c
Move common code between Session and Package to FSCollector
2020-01-25 19:04:01 +01:00
Daniel Hahler
6b7e1a246c
Sync `{Session,Package}.gethookproxy`
...
Only copy'n'paste error from c416b1d935
.
2020-01-25 19:04:01 +01:00
Daniel Hahler
817c094ce6
Clean up Package.__init__
...
Makes `parent` a required arg, which would have failed before via
`parent.session` anyway.
Keeps calling/passing unused args for B/C.
2020-01-25 19:04:01 +01:00
Daniel Hahler
9b8039cf09
Sync `{Session,Package}._recurse`
2020-01-25 16:44:20 +01:00
Daniel Hahler
09bdbffbde
Merge master into features
...
Conflicts:
src/_pytest/_code/code.py
src/_pytest/main.py
2020-01-24 23:44:50 +01:00
Ran Benita
0b6258ab5b
PyCollector.collect: use explicit cast to `str`
...
Ref: https://github.com/pytest-dev/pytest/pull/6521#pullrequestreview-347234792
2020-01-23 12:54:52 +01:00
Daniel Hahler
9c7b3c57d7
typing: PyobjMixin.reportinfo, getfslineno
2020-01-23 10:45:31 +01:00
Ronny Pfannschmidt
8ba0b7bc2a
fix #6341 - disallow session/config in Node.from_parent
2020-01-15 13:00:46 +01:00
Daniel Hahler
1356d20e90
Merge master into features
2020-01-10 05:20:41 +01:00
Seth Junot
d4879c7afb
Optimized renaming of test parameter ids
...
While using pytest-repeat, I noticed the previous implementation is slow
for a large number of duplicate test ids. To optimize, this commit
reduces the amount of data copied and avoids using `in` with List
(unhashable type, and therefore is very slow for many elements).
2019-12-16 18:53:48 -03:00
Daniel Hahler
d7d5cf4136
Merge pull request #6215 from blueyed/cleanup-exc
...
_idval: remove trailing newline from exception
2019-11-24 20:29:46 +01:00
Ronny Pfannschmidt
c99c7d0f95
deprecate direct node construction and introduce Node.from_parent
2019-11-23 21:54:11 +01: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
Bruno Oliveira
5b3867fd65
Release 5.3.0 ( #6233 )
...
Release 5.3.0
2019-11-19 18:49:14 -03:00
Daniel Hahler
1d368e0ed4
Merge pull request #6231 from blueyed/param-spell
...
Improve check for misspelling of parametrize
2019-11-19 17:57:28 +01:00
Bruno Oliveira
21622d0df4
Merge remote-tracking branch 'upstream/master' into release-5.3.0
2019-11-19 12:42:11 -03: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
Daniel Hahler
4804d4bc98
python: remove unused pytest_make_parametrize_id hookimpl
...
Added in 79927428d
initially, but never used.
2019-11-19 02:27:53 +01:00
Daniel Hahler
2ad2fbc9a2
Metafunc: remove hack for DefinitionMock
...
Done initially in 99015bfc8
.
2019-11-18 18:19:34 +01:00
Daniel Hahler
64d8910516
Metafunc: remove unused _ids ( #6220 )
2019-11-18 18:00:29 +01:00
Daniel Hahler
91dec8e2bf
Factor out _validate_parametrize_spelling
...
This makes it easier to read `pytest_generate_tests`.
2019-11-18 16:36:12 +01:00
Daniel Hahler
f3a10245d0
Metafunc: remove unused _ids
...
Forgotten in 40b85d7ee
.
2019-11-18 16:21:13 +01:00
Daniel Hahler
426a4cdca9
_idval: remove trailing newline from exception
2019-11-18 01:10:00 +01:00
Anthony Sottile
a2d48332fc
Merge pull request #6201 from asottile/mm
...
Merge master into features
2019-11-17 11:30:51 -08:00
Ran Benita
e3ac44df36
Inline the FuncargnamesCompatAttr compat helper
...
It doesn't help much IMO, just adds indirection and makes it harder to
type.
2019-11-16 17:22:09 +02:00
林玮
329f56ecec
Fix incorrect result of getmodpath method.
2019-11-16 15:28:04 +08:00
Anthony Sottile
cc78444c30
Merge remote-tracking branch 'origin/master' into mm
2019-11-15 15:26:57 -08:00
Anthony Sottile
176c7771fb
Revert "fix bug with nonskipped first test in package ( #5831 )"
...
This reverts commit 85288b5321
, reversing
changes made to 5f9db8a017
.
2019-11-15 08:29:52 -08:00
Bruno Oliveira
6f2c0fd2e8
Show a better message when 'request' is used in parametrize
...
Fix #6183
2019-11-13 19:57:10 -03:00
Gregory Lee
c22ce1a12c
parametrize: allow __name__ id for modules or other objects as well
2019-11-08 01:39:29 -05:00
Bruno Oliveira
85288b5321
fix bug with nonskipped first test in package ( #5831 )
...
fix bug with nonskipped first test in package
2019-11-06 16:06:46 -03:00