Commit Graph

11928 Commits

Author SHA1 Message Date
Ran Benita 7b8968ff80
Merge pull request #6735 from bluetech/metafunc-annotate
Type annotate Metafunc
2020-02-15 23:32:14 +02:00
Ran Benita 0c68e7a2c9
Merge pull request #6744 from bluetech/item-runtest-stub
Add Item.runtest stub implementation
2020-02-15 23:27:57 +02:00
Daniel Hahler 369284752e
terminal: refactor, no yellow ("boring") for non-last item (#6409) 2020-02-15 19:00:24 +01:00
Daniel Hahler e872532d0c Merge branch 'master' into term-color
Conflicts:
	src/_pytest/terminal.py
	testing/test_debugging.py
	testing/test_terminal.py
2020-02-15 18:46:29 +01:00
kpinc 9785ee438d
doc: expand first sentence on fixtures into a paragraph (#6742) 2020-02-15 18:35:36 +01:00
Ran Benita 959e6b4f44
Merge pull request #6743 from bluetech/runtest-getattr
Avoid getattr when dispatching pytest_runtest_* hooks
2020-02-15 17:22:00 +02:00
Ran Benita 5945c3fe88 Type annotate Metafunc 2020-02-15 17:13:18 +02:00
Ran Benita 7155b2277c Ignore "assert False" statements in coverage 2020-02-15 17:08:01 +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 371939fb86 Avoid getattr when dispatching pytest_runtest_* hooks
Using getattr doesn't work with typing, and also breaks grep. It took me
a while to find where these hooks are called.
2020-02-15 15:34:21 +02:00
Daniel Hahler 7fc9d4c976
Use warnings module directly with cacheprovider (#6740) 2020-02-15 05:31:18 +01:00
Daniel Hahler 2b5adc88a7 Move test_issue4445_cacheprovider_set into test_cache_failure_warns
Would need to be adjusted anyway non-trivially, and we can just harden
`test_cache_failure_warns` instead.
2020-02-15 02:01:22 +01:00
Daniel Hahler 02aa8adae1 cacheprovider: use warnings directly
Allows for filtering of PytestCacheWarning.

Using `_issue_warning_captured` is not necessary here, and was probably
only used because the cacheprovider misses warnings during
`pytest_sessionfinish`, which is also fixed here.

I think the usage of `_issue_warning_captured` can be removed/reduced
further, but also that this is good enough for now.

Ref: https://github.com/pytest-dev/pytest/issues/6681.
2020-02-15 01:36:57 +01:00
Daniel Hahler 67e69a7e49
tests: harden test_xdist_verbose (#6700) 2020-02-15 01:22:01 +01:00
Daniel Hahler b09762df27
doc: link to `python_files` from "Assertion Rewriting" (#6705)
Ref: https://github.com/pytest-dev/pytest/issues/6377
Ref: https://github.com/blueyed/pytest/pull/145
2020-02-15 00:32:16 +01:00
Daniel Hahler 9631b3c166
reports: use attr.asdict with serialize_repr_{crash,traceback} (#6732)
* Turn ReprTraceback into attrs class

* Use attr.asdict with serialize_repr_{crash,traceback}

* Turn ReprFileLocation into attrs class, convert py.path.local
2020-02-14 19:39:34 +01:00
Daniel Hahler 4b70ba2c21
tests: harden test_better_reporting_on_conftest_load_failure (#6713) 2020-02-14 17:00:01 +01:00
Daniel Hahler de3353aac1
test_load_initial_conftest_last_ordering: handle testing package (#6706) 2020-02-14 16:58:17 +01:00
Bruno Oliveira ef73a56032
Merge pull request #6737 from bluetech/fixture-cached-result
Don't delete FixtureDef.cached_result, set it to None instead
2020-02-14 12:33:03 -03:00
Ran Benita d839686c7b Don't delete FixtureDef.cached_result, set it to None instead
Previously `cached_result` was either set or deleted. Type annotations
cannot handle this, so use `None` for the non-set state instead.
2020-02-14 14:18:58 +02:00
Daniel Hahler d89b5057ca
assertrepr_compare: provide more info (location) with exceptions (#6728) 2020-02-14 02:17:05 +01:00
Daniel Hahler 83137c89e9
tests: test_unicode_plus_minus: use unicode sign directly (#6727)
Was globbed for Python 2 before (57c448991).
2020-02-14 02:16:25 +01:00
Daniel Hahler dbae5a7ff8
Recognize `-V` as a short option for `--version` (#6721) 2020-02-13 12:30:22 +01:00
Daniel Hahler 07b7b6fa7d
doc: add docstring for CaptureManager._capturing_for_request (#6698)
Based on the removed doc for `_install_capture_fixture_on_item`.

Follow-up to https://github.com/pytest-dev/pytest/pull/6663.

Co-authored-by: Ran Benita <ran234@gmail.com>
2020-02-13 12:09:32 +01:00
Ran Benita 56a5dbe252
Merge pull request #6722 from bluetech/rm-callspec2-global
Remove unused CallSpec2 fields _globalid, _globalparam
2020-02-13 12:49:41 +02:00
Ran Benita 8a4d5227e2 Remove unused CallSpec2 fields _globalid, _globalparam 2020-02-13 12:31:48 +02:00
Bruno Oliveira e6ea9edffe
Merge pull request #6673 from sscherfke/features
Reverse / fix meaning of "+/-" in error diffs
2020-02-12 15:05:38 -03:00
Daniel Hahler b7ad4c2bed
_pformat_dispatch: pass through args (#6715) 2020-02-12 16:07:57 +01:00
Bruno Oliveira d79179a239
Merge pull request #6716 from bluetech/features-to-master-for-real
Merge the features branch into master, before stopping to use it
2020-02-12 11:52:32 -03:00
Ran Benita c9f9664336 Merge branch 'features' into master
The features branch is no more. Development of features is now also done
on master.

See https://github.com/pytest-dev/pytest/pull/6571.
2020-02-12 13:50:02 +02:00
Bruno Oliveira aa4d80cad9
RFC: Streamlining pytest's git workflow (#6571)
RFC: Streamlining pytest's git workflow
2020-02-12 08:37:14 -03:00
Bruno Oliveira 4209ad6fca
Use code highlighting if pygments is installed (#6658)
* Use code highlighting if pygments is installed

* Use colorama constants instead of bare ascii codes

Could not find the exact equivalent of 'hl-reset' code using colorama
constants though.

* Refactor ASCII color handling into a fixture

* Revert back to using explicit color codes

* In Python 3.5 skip rest of tests that require ordered markup in colored output
2020-02-12 08:32:37 -03:00
Bruno Oliveira 3ea74310d7
Fix crash when faulthandler starts initialized (#6598)
Use suggestion in review and use a subplugin so hooks will only be active
if we enable faulthandler ourselves.

Fix #6575

Co-authored-by: Daniel Hahler <git@thequod.de>
2020-02-12 11:06:20 +01:00
Ran Benita c3e53a072d Switch to new git workflow
Co-Authored-By: Daniel Hahler <git@thequod.de>
2020-02-12 09:49:21 +02:00
Daniel Hahler fa877665ad _set_main_color: does not need to return 2020-02-12 03:11:54 +01:00
Bruno Oliveira 3b582858f3
Merge pull request #6712 from nicoddemus/mm
Merge master into features
2020-02-11 20:22:20 -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 7484e346f9
Merge pull request #6711 from bluetech/mv-exitcode
Move ExitCode's definition from _pytest.main to _pytest.config
2020-02-11 09:49:38 +02:00
Ran Benita d25123eb01
Merge pull request #6710 from bluetech/rm-nodemarkers
Remove unused NodeMarkers
2020-02-10 23:57:40 +02:00
Ran Benita d33da078a8 Move ExitCode's definition from _pytest.main to _pytest.config
ExitCode is used in several internal modules and hooks and so with type
annotations added, needs to be imported a lot.

_pytest.main, being the entry point, generally sits at the top of the
import tree.

So, it's not great to have ExitCode defined in _pytest.main, because it
will cause a lot of import cycles once type annotations are added (in
fact there is already one, which this change removes).

Move it to _pytest.config instead.

_pytest.main still imports ExitCode, so importing from there still
works, although external users should really be importing from `pytest`.
2020-02-10 23:55:06 +02:00
Stefan Scherfke d59adc61f9 Reverse / fix meaning of "+/-" in error diffs
The convention is "assert result is expected".  Pytest's error diffs now
reflect this. "-" means that sth. expected is missing in the result and
"+" means that there are unexpected extras in the result.

Fixes: #3333
2020-02-10 21:12:37 +01: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 0ee007ca33
Fix CI (Travis) (#6704) 2020-02-10 20:52:21 +01:00
Ran Benita 1ebca37689
Merge pull request #6708 from bluetech/redundant-commas-2
Remove some redundant commas
2020-02-10 21:26:55 +02:00
Ran Benita b59d32a5c7
Merge pull request #6709 from bluetech/rm-arg2finish
Remove unused field FixtureManager._arg2finish
2020-02-10 21:26:30 +02:00
Ran Benita 3e4e6297ce Remove unused field FixtureManager._arg2finish
Not used since 4f0879ff9b.
2020-02-10 17:30:20 +02:00
Ran Benita 0b2b40e35d Remove some redundant commas
Fix mypy errors:

src/_pytest/runner.py:36: error: "addoption" of "OptionGroup" does not return a value  [func-returns-value]
src/_pytest/helpconfig.py:64: error: "addoption" of "OptionGroup" does not return a value  [func-returns-value]
src/_pytest/terminal.py:67: error: "_addoption" of "OptionGroup" does not return a value  [func-returns-value]
src/_pytest/terminal.py:75: error: "_addoption" of "OptionGroup" does not return a value  [func-returns-value]
2020-02-10 17:28:05 +02:00
Daniel Hahler f9dd58000a
Fix CaptureManager.__repr__ (#6697) 2020-02-10 13:03:05 +01:00
Daniel Hahler 449290406c test_argcomplete: remove usage of `distutils.spawn` (#6703)
Fixes collection error with Python 3.5.3 (Travis):

    testing/test_parseopt.py:2: in <module>
        import distutils.spawn
    .tox/py35-coverage/lib/python3.5/distutils/__init__.py:4: in <module>
        import imp
    .tox/py35-coverage/lib/python3.5/imp.py:33: in <module>
        PendingDeprecationWarning, stacklevel=2)
    E   PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

Build log: https://travis-ci.org/blueyed/pytest/builds/648305304
2020-02-10 11:52:19 +01:00
Daniel Hahler 12824e6279 ci: Travis: remove non-py35 jobs 2020-02-10 10:59:28 +01:00