Ran Benita
23c9856857
Remove no longer needed noqa's
2020-05-12 09:29:47 +03:00
Bruno Oliveira
6c2d358918
Merge pull request #7135 from pytest-dev/terminalwriter
2020-05-06 18:26:44 -03:00
Ran Benita
d16ae0bbdc
Merge pull request #7171 from bluetech/code-import-cycles
...
code: fix import cycles between code.py and source.py
2020-05-06 18:15:32 +03:00
Ran Benita
89eee90b5f
python: optimize PythonCollector.collect
2020-05-06 12:05:04 +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
Bruno Oliveira
fd2f172258
Let unittest frameworks deal with async functions
...
Instead of trying to handle unittest-async functions in pytest_pyfunc_call,
let the unittest framework handle them instead.
This lets us remove the hack in pytest_pyfunc_call, with the upside that
we should support any unittest-async based framework.
Also included 'asynctest' as test dependency for py37-twisted, and renamed
'twisted' to 'unittestextras' to better reflect that we install 'twisted' and
'asynctest' now.
This also fixes the problem of cleanUp functions not being properly called
for async functions.
Fix #7110
Fix #6924
2020-05-01 15:10:28 -03:00
Ran Benita
1bc4170e63
terminalwriter: don't flush implicitly; add explicit flushes
...
Flushing on every write is somewhat expensive.
Rely on line buffering instead (if line buffering for stdout is
disabled, there must be some reason...), and add explicit flushes when
not outputting lines.
This is how regular `print()` e.g. work so should be familiar.
2020-04-30 16:44:03 +03:00
Ran Benita
907e29a47b
fixtures: deprecate pytest._fillfuncargs function
...
This function is exposed and kept alive for the oejskit plugin which is
abandoned and no longer works with recent plugins, so let's prepare to
completely remove it.
2020-04-24 18:54:46 +03:00
Ronny Pfannschmidt
451aef65ac
prepare tests and disable warnings for asyncio unittest cases
...
shoehorn unittest async results into python test result interpretation
changelog
2020-03-30 21:55:12 +02:00
Ran Benita
4f8fff9cab
Merge pull request #6868 from bluetech/simplify-exc
...
Simplify some exception handling code
2020-03-10 20:32:08 +02:00
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
Ran Benita
b7f2e3d4f5
Inline PyobjContext
...
When it was introduced in 8adac2878f
it
seems to have had some use, but now it doesn't.
2020-03-06 14:55:20 +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