Commit Graph

10018 Commits

Author SHA1 Message Date
Daniel Hahler 2e7d6a6202 Fix test_assertrewrite in verbose mode
Fixes https://github.com/pytest-dev/pytest/issues/4879.
2019-03-22 13:00:35 +01:00
Daniel Hahler ea7357bc58 ci: PYTEST_ADDOPTS=-vv in general
This is useful when viewing logs, especially with hanging tests.

Uses non-verbose mode with a single job for full coverage.
2019-03-22 07:56:15 +01:00
Bruno Oliveira b3319a6074
Merge pull request #4944 from henrykironde/k-EXPRESSION
Add example for k flag
2019-03-21 19:33:53 -03:00
Bruno Oliveira c9628c52d6
Merge pull request #4971 from bskinn/patch-1
Fix pytestmark syntax in reference.rst
2019-03-21 18:59:25 -03:00
Brian Skinn dcbdcc729b
Fix pytestmark syntax in reference.rst
pytest 4.3.1 throws an error if `pytestmark` is set to a tuple of marks; it appears to insist on a list.



With `pytestmark = [pytest.mark.api, pytest.mark.good]`:

```
============================== test session starts ==============================
platform win32 -- Python 3.6.3, pytest-4.3.1, py-1.8.0, pluggy-0.9.0
rootdir: C:\Temp\git\sphobjinv, inifile: tox.ini
plugins: timeout-1.3.3
collected 48 items / 41 deselected / 7 selected

tests\test_api_good.py .......                                             [100%]

==================== 7 passed, 41 deselected in 0.15 seconds ====================
```


With `pytestmark = (pytest.mark.api, pytest.mark.good)`:
```
==================================== ERRORS =====================================
____________________ ERROR collecting tests/test_api_good.py ____________________
env\lib\site-packages\_pytest\runner.py:226: in from_call
    result = func()
env\lib\site-packages\_pytest\runner.py:289: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
env\lib\site-packages\_pytest\python.py:435: in collect
    self._inject_setup_module_fixture()
env\lib\site-packages\_pytest\python.py:447: in _inject_setup_module_fixture
    setup_module = _get_non_fixture_func(self.obj, "setUpModule")
env\lib\site-packages\_pytest\python.py:255: in obj
    self.own_markers.extend(get_unpacked_marks(self.obj))
env\lib\site-packages\_pytest\mark\structures.py:244: in get_unpacked_marks
    return normalize_mark_list(mark_list)
env\lib\site-packages\_pytest\mark\structures.py:259: in normalize_mark_list
    raise TypeError("got {!r} instead of Mark".format(mark))
E   TypeError: got (MarkDecorator(mark=Mark(name='api', args=(), kwargs={})), MarkDecorator(mark=Mark(name='good', args=(), kwargs={}))) instead of Mark
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
==================== 19 deselected, 1 error in 0.27 seconds =====================
```
2019-03-21 15:14:28 -04:00
Daniel Hahler 15d608867d
Merge pull request #4966 from blueyed/fix-preparse
config: fix consider_preparse with missing argument to -p
2019-03-21 19:12:57 +01:00
Daniel Hahler ea2c6b8a88 config: fix consider_preparse with missing argument to -p
This is only required after/with 415899d4 - otherwise argparse ensures
there is an argument already.
2019-03-21 17:05:22 +01:00
Daniel Hahler 0e6cf0ff28
Merge pull request #4967 from blueyed/p-no-default
Fix some issues related to "-p no:X" with default_plugins
2019-03-21 17:02:34 +01:00
Daniel Hahler 553951c443 Fix some issues related to "-p no:X" with default_plugins 2019-03-21 17:01:50 +01:00
Bruno Oliveira 15ef168821
Merge pull request #4962 from blueyed/test_report_collect_after_half_a_second
tests: add test_report_collect_after_half_a_second
2019-03-20 19:35:08 -03:00
Daniel Hahler cc6e5ec345 tests: add test_report_collect_after_half_a_second
This is meant for stable coverage with "collecting X item(s)".
2019-03-20 22:13:11 +01:00
Daniel Hahler 77643122a8
Merge pull request #4963 from blueyed/twisted
ci: rename "trial" tox factor to "twisted"
2019-03-20 21:58:48 +01:00
Daniel Hahler 832cef953b
Merge pull request #4964 from blueyed/mkdir
Revisit mkdir/_ensure_supporting_files in cacheprovider
2019-03-20 21:58:24 +01:00
Daniel Hahler bcdbb6b677 Revisit mkdir/_ensure_supporting_files in cacheprovider
- cacheprovider: move call to _ensure_supporting_files

  This makes it less likely to have a race here (which is not critical),
  but happened previously probably with xdist, causing flaky coverage with
  `if not readme_path.is_file():` etc checks in
  `_ensure_supporting_files`, which has been removed in the `features`
  branch already.
2019-03-20 19:00:11 +01:00
Daniel Hahler 543779fc43 tox: generic twisted factor 2019-03-20 18:41:48 +01:00
Daniel Hahler 2ade3d5c89 ci: rename "trial" tox factor to "twisted"
Ref: https://github.com/pytest-dev/pytest/pull/4848#issuecomment-467909204
2019-03-20 18:38:50 +01:00
Daniel Hahler 7939e5327c
Merge pull request #4957 from blueyed/config-handle-pno-with-default-plugins
config: handle `-p no:plugin` with default plugins
2019-03-20 03:32:03 +01:00
Daniel Hahler f7171034f9 terminal: remove unnecessary check in _get_progress_information_message
All calls to _get_progress_information_message are only done for
`_show_progress_info`, which is `False` with `capture=no`.
2019-03-20 03:04:41 +01:00
Daniel Hahler c7c120fba6 terminal: handle "capture" option not being available
This is the case with `-p no:capture` now.
2019-03-20 03:01:26 +01:00
Daniel Hahler 415899d428 config: handle `-p no:plugin` with default plugins
`-p no:capture` should not load its fixtures in the first place.
2019-03-20 02:47:13 +01:00
Daniel Hahler 8dda5613ef
Merge pull request #4956 from blueyed/home2
pytester: set HOME only with inline_run/popen
2019-03-20 02:29:29 +01:00
Daniel Hahler 714f2113bb
Merge pull request #4929 from blueyed/fix-_factorytraceback-offset
Fix line offsets with `ScopeMismatch` errors
2019-03-20 01:30:58 +01:00
Daniel Hahler a50b92ea67 pytester: set HOME only with inline_run/popen
Ref: https://github.com/pytest-dev/pytest/issues/4955
2019-03-20 01:15:51 +01:00
Daniel Hahler da81c1e49a
Merge pull request #4950 from blueyed/capture
Revisit capturing module: repr, doc fixes, minor
2019-03-20 01:12:22 +01:00
Bruno Oliveira 23ab43233e
Merge pull request #4920 from nicoddemus/subtests-pytest-1367
Internal refactorings required for *external* pytest-subtests plugin
2019-03-19 18:57:11 -03:00
Bruno Oliveira 1a119a22d1 Internal refactorings in order to support the new pytest-subtests plugin
Related to #1367
2019-03-19 18:20:41 -03:00
Daniel Hahler 77c5191ad7
Merge pull request #4953 from blueyed/merge-master-into-features
Merge master into features
2019-03-19 04:13:31 +01:00
Daniel Hahler 7395501d1d Easier read with _colorama_workaround/_readline_workaround 2019-03-19 01:17:21 +01:00
Daniel Hahler 920bffbfbb Revisit _pytest.capture: repr, doc fixes, minor 2019-03-19 01:17:21 +01:00
Daniel Hahler 751c061d9a Merge master into features 2019-03-19 01:07:10 +01:00
Daniel Hahler a624b84097
Merge pull request #4941 from blueyed/testdir-home
pytester: testdir: set $HOME to tmpdir
2019-03-18 23:02:15 +01:00
Daniel Hahler c75dd10671 pytester: testdir: set $HOME to tmpdir
This avoids loading user configuration, which might interfere with test
results, e.g. a `~/.pdbrc.py` with pdb++.

Also sets USERPROFILE, which will be required with Python 3.8 [1].

1: https://bugs.python.org/issue36264
2019-03-18 20:55:39 +01:00
Bruno Oliveira b696666f5a
Merge pull request #4945 from blueyed/FDCapture-repr-None-targetfd_save
capture: fix FDCapture.__repr__ without targetfd_save
2019-03-18 13:09:30 -03:00
Bruno Oliveira f4f6cb7532
Merge pull request #4946 from blueyed/fix-bench
Fix bench/bench.py without args
2019-03-18 13:04:12 -03:00
henrykironde 1e3d5a0412 Add example for k flag
Includes an example of multiple expressions
2019-03-17 22:33:16 -04:00
Daniel Hahler 98981276a0 capture: fix FDCapture.__repr__ without targetfd_save 2019-03-18 02:33:03 +01:00
Daniel Hahler 8c96b65082 Fix bench/bench.py without args
Fixes:

>   File "…/Vcs/pytest/src/_pytest/config/__init__.py", line 60, in main
>     config = _prepareconfig(args, plugins)
>   File "…/Vcs/pytest/src/_pytest/config/__init__.py", line 179, in _prepareconfig
>     raise TypeError(msg.format(args, type(args)))
> TypeError: `args` parameter expected to be a list or tuple of strings, got: 'empty.py' (type: <class 'str'>)
2019-03-18 02:28:41 +01:00
Bruno Oliveira c926999cfb
Merge pull request #4939 from smheidrich/mark_xfail_language
Minor grammar fixes in pytest.mark.xfail docs
2019-03-17 11:33:20 -03:00
smheidrich 519157cfcf Minor grammar fixes in pytest.mark.xfail docs 2019-03-17 10:14:40 +01:00
Bruno Oliveira 5d14362a75
Merge pull request #4936 from blueyed/use-blocked-plugin
Handle `-p plug` after `-p no:plug`
2019-03-16 12:21:33 -03:00
Daniel Hahler 15fe8c6e90 Handle `-p plug` after `-p no:plug`.
This can be used to override a blocked plugin (e.g. in "addopts") from the
command line etc.
2019-03-16 15:58:00 +01:00
Daniel Hahler c1e01c2992
Merge pull request #4931 from blueyed/linematcher-list
pytester: LineMatcher: assert lines
2019-03-15 23:43:23 +01:00
Daniel Hahler 5e27ea5528 pytester: LineMatcher: assert Sequence when matching in order
This can be helpful when passing a set accidentally.
2019-03-15 23:07:08 +01:00
Bruno Oliveira 33d4c96aa2
Merge pull request #4830 from nicoddemus/warn-on-coroutine
Emit a warning when a coroutine test function is encountered
2019-03-15 09:51:34 -03:00
Bruno Oliveira b3eb5d1eb7
Merge pull request #4932 from hroncok/sphinx2
Pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0
2019-03-15 08:18:41 -03:00
Miro Hrončok 2af0a023c9 Pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0
Fixes https://github.com/pytest-dev/pytest/issues/4912
2019-03-15 10:56:13 +01:00
Anthony Sottile 5f52d5ee17
Merge pull request #4927 from tkf/skip-doctest
Make pytest.skip work in doctest
2019-03-15 00:14:09 -07:00
Daniel Hahler 95701566f3
Update src/_pytest/outcomes.py
Co-Authored-By: tkf <takafumi.a@gmail.com>
2019-03-15 12:21:48 +09:00
Daniel Hahler 57be1d60dd
Apply suggestions from code review
Co-Authored-By: tkf <takafumi.a@gmail.com>
2019-03-15 11:29:16 +09:00
Takafumi Arakaki 62f96eea6b Include documentation 2019-03-15 11:14:50 +09:00