Commit Graph

12616 Commits

Author SHA1 Message Date
Gleb Nikonorov
49ec2aed0f change stacklevel in warnings from 2 to 3 2020-06-28 10:48:33 -04:00
Gleb Nikonorov
c39655725a change if else structure of _warn_bout_missing_assertion 2020-06-27 19:49:19 -04:00
Gleb Nikonorov
72a39117a8 Merge remote-tracking branch 'origin' into issue_7295 2020-06-27 19:43:03 -04:00
Ran Benita
7450b6dd95 Merge pull request #7418 from bluetech/typing-3
More typing work
2020-06-27 10:54:29 +03:00
Anthony Sottile
61014c5f94 Merge pull request #6934 from gdhameeja/Fix-6906
Fix-6906: Added code-highlight option to disable highlighting optionally
2020-06-26 13:41:40 -07:00
gdhameeja
03230b4002 Fix-6906: Added code-highlight option to disable highlighting optionally
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-26 13:24:56 -07:00
Bruno Oliveira
d9546ff18f Merge pull request #7421 from The-Compiler/webinar
Add webinar to open trainings
2020-06-26 12:30:14 -03:00
Florian Bruhin
103bfd20d4 Add webinar 2020-06-26 17:08:14 +02:00
Ran Benita
1ae4182e18 testing: fix flaky tests on pypy3 due to resource warnings in stderr (#7405) 2020-06-26 09:50:19 -03:00
Bruno Oliveira
e377c88495 Merge pull request #7419 from The-Compiler/workshoptage 2020-06-25 14:52:01 -03:00
Florian Bruhin
ba50ef33d3 Add open training at Workshoptage 2020 2020-06-25 17:32:34 +02:00
Ran Benita
f382a6bb20 hookspec: remove unused hookspec pytest_doctest_prepare_content()
It's been unused for 10 years at lest from bb50ec89a9.
2020-06-25 17:44:56 +03:00
Ran Benita
256a5d8b14 hookspec: improve typing of some remaining hooks 2020-06-25 17:33:21 +03:00
Ran Benita
97a11726e2 freeze_support: type annotate 2020-06-25 15:28:34 +03:00
Ran Benita
8f8f472379 python_api: type annotate some parts of pytest.approx() 2020-06-25 15:15:24 +03:00
Ran Benita
142d8963e6 recwarn: type annotate pytest.deprecated_call
Also improve its documentation.
2020-06-25 14:40:26 +03:00
Ran Benita
653c83e127 recwarn: type annotate recwarn fixture 2020-06-25 14:30:42 +03:00
Ran Benita
4d813fdf5e recwarn: improve return type annotation of non-contextmanager pytest.warns
It returns the return value of the function.
2020-06-25 14:30:42 +03:00
Ran Benita
f00bec2a12 Replace yield_fixture -> fixture in internal code
`yield_fixture` is a deprecated alias to `fixture`.
2020-06-25 14:05:46 +03:00
Ran Benita
d69e9e60d6 Merge pull request #7411 from bluetech/contributing-changelog
CONTRIBUTING: sync changelog types
2020-06-24 16:33:41 +03:00
Ran Benita
474973afa4 CONTRIBUTING: sync changelog types
The got out of date with the actual ones we use.
2020-06-24 16:11:27 +03:00
Ronny Pfannschmidt
37929030c9 Merge pull request #7406 from ffe4/patch-1
Fix typo in examples/markers.rst
2020-06-24 08:02:21 +02:00
Gleb Nikonorov
0dd77b3e39 Merge remote-tracking branch 'origin/master' into issue_7295 2020-06-23 23:21:36 -04:00
Daniel
6cbbd2d90b Fix typo in examples/markers.rst 2020-06-23 22:38:11 +02:00
David Diaz Barquero
617bf8be5b Add details to error message for junit (#7390)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-06-23 13:03:46 -03:00
Ran Benita
3624acb665 Merge pull request #7401 from bluetech/typing-config
config: improve typing
2020-06-23 18:58:21 +03:00
Ran Benita
c6f4c2e5c6 Merge pull request #7402 from bluetech/fix-nodes-keywords-typo
nodes: fix string possibly stored in Node.keywords instead of MarkDecorator
2020-06-23 18:57:25 +03:00
Ran Benita
8994e1e3a1 config: make _get_plugin_specs_as_list a little clearer and more general 2020-06-23 11:47:52 +03:00
Ran Benita
04a6d37823 nodes: fix string possibly stored in Node.keywords instead of MarkDecorator
This mistake was introduced in 7259c453d6.
2020-06-22 16:51:11 +03:00
Ran Benita
4655b79985 config: improve typing 2020-06-22 16:39:14 +03:00
Ran Benita
83891d9022 Merge pull request #7387 from cool-RR/2020-06-11-raise-from
Fix exception causes all over the codebase
2020-06-21 22:42:18 +03:00
Ran Benita
99d34ba029 Merge pull request #7388 from bluetech/mark-evaluate
skipping: refactor mark evaluation
2020-06-21 21:47:56 +03:00
Ran Benita
27492cf7a0 Merge pull request #7379 from bluetech/typing-builtin-marks
Type annotate pytest.mark.{skip,skipif,xfail,parametrize,usefixtures,filterwarnings}
2020-06-21 20:44:27 +03:00
Ran Benita
b3fb5a2d47 Type annotate pytest.mark.* builtin marks 2020-06-21 20:18:52 +03:00
Ran Benita
7d8d1b4440 skipping: better links in --markers output
Suggested by Bruno.
2020-06-21 20:15:10 +03:00
Ran Benita
c9737ae914 skipping: simplify xfail handling during call phase
There is no need to do the XPASS check here, pytest_runtest_makereport
already handled that (the current handling there is dead code).

All the hook needs to do is refresh the xfail evaluation if needed, and
check the NOTRUN condition again.
2020-06-21 19:54:29 +03:00
Gleb Nikonorov
33de350619 parametrize test_warn_missing for a cleaner test 2020-06-21 10:26:36 -04:00
Gleb Nikonorov
fe68c58698 add test_warn_missing case for --assert=plain 2020-06-20 13:06:41 -04:00
Gleb Nikonorov
a9d50aeab6 remove extra whitespace 2020-06-20 12:18:55 -04:00
Gleb Nikonorov
ac89d6532a replace stderr warnings with the warnings module 2020-06-20 12:15:58 -04:00
Ran Benita
3e6fe92b7e skipping: refactor skipif/xfail mark evaluation
Previously, skipif/xfail marks were evaluated using a `MarkEvaluator`
class. I found this class very difficult to understand.

Instead of `MarkEvaluator`, rewrite using straight functions which are
hopefully easier to follow.

I tried to keep the semantics exactly as before, except improving a few
error messages.
2020-06-20 16:15:28 +03:00
Ram Rachum
dd446bee5e Fix exception causes all over the codebase 2020-06-19 22:02:24 +03:00
Ran Benita
6072c9950d skipping: move MarkEvaluator from _pytest.mark.evaluate to _pytest.skipping
This type was actually in `_pytest.skipping` previously, but was moved to
`_pytest.mark.evaluate` in cf40c0743c.

I think the previous location was more appropriate, because the
`MarkEvaluator` is not a generic mark facility, it is explicitly and
exclusively used by the `skipif` and `xfail` marks to evaluate their
particular set of arguments. So it is better to put it in the plugin
code.

Putting `skipping` related functionality into the core `_pytest.mark`
module also causes some import cycles which we can avoid.
2020-06-19 13:33:54 +03:00
Ran Benita
a1f841d5d2 skipping: use pytest_runtest_call instead of pytest_pyfunc_call
`@pytest.mark.xfail` is meant to work with arbitrary items, and there is
a test `test_mark_xfail_item` which verifies this.

However, the code for some reason uses `pytest_pyfunc_call` for the
call phase check, which only works for Function items. The test
mentioned above only passed "accidentally" because the
`pytest_runtest_makereport` hook also runs a `evalxfail.istrue()` which
triggers and evaluation, but conceptually it shouldn't do that.

Change to `pytest_runtest_call` to make the xfail checking properly
generic.
2020-06-19 13:33:53 +03:00
Gleb Nikonorov
4cc4ebf3c9 Don't treat ini keys defined in conftest.py as invalid (#7384) 2020-06-18 12:58:41 -03:00
Bruno Oliveira
88a187aae8 Merge pull request #7382 from gnikonorov/fix_issue_4049_changelog_title
fix changelog file name for issue 4049 fix
2020-06-16 22:10:40 -03:00
Gleb Nikonorov
ab19148c2a fix changelog file name for issue 4049 fix 2020-06-16 20:59:58 -04:00
Andrew
a67c553beb Disable caching when evaluating expressions in marks (#7373) 2020-06-16 12:39:36 +03:00
Ran Benita
b6fd89ef31 Merge pull request #7370 from bluetech/typing3
Some type annotations, doc improvements
2020-06-16 11:23:57 +03:00
Bruno Oliveira
db00612b84 Merge pull request #7364 from nicoddemus/parseoutcomes-plural-6505
assertoutcomes() only accepts plural forms
2020-06-15 20:27:40 -03:00