Commit Graph

9982 Commits

Author SHA1 Message Date
Daniel Hahler 76c70cbf4c Fix off-by-one error with lineno in mark collection error 2019-03-27 17:44:52 +01:00
Bruno Oliveira 3d9e68ecfd Update doc/en/parametrize.rst 2019-03-28 00:07:28 +09:00
Jeong YunWon 8b0b7156d9 Fix glitches of original patch of disable-test-id-escaping 2019-03-28 00:07:28 +09:00
ApaDoctor cf6e2ceafd add ini option to disable string escape for parametrization 2019-03-28 00:07:28 +09:00
Bruno Oliveira 69a55d334a
Merge pull request #5004 from blueyed/doc-pdb
doc: fix note about output capturing with pdb
2019-03-26 20:20:05 -03:00
Bruno Oliveira 241b7433cd
Merge pull request #4978 from blueyed/exit-from-from_assertrepr_compare
Do not swallow outcomes.Exit in assertrepr_compare
2019-03-26 18:39:13 -03:00
Bruno Oliveira 057c97812b
Merge pull request #4975 from blueyed/verbose-fixes
Fix usages of "verbose" option
2019-03-26 18:38:39 -03:00
Bruno Oliveira 02188e399d
Merge pull request #4987 from blueyed/collect-tbstyle-repr_failure
CollectError.repr_failure: honor explicit tbstyle option
2019-03-26 18:37:49 -03:00
Bruno Oliveira aae02863db
Merge pull request #4999 from nicoddemus/cmdline_parse-early
Docs: modules implementing pytest_cmdline_parse can be early-loaded
2019-03-26 18:14:31 -03:00
Daniel Hahler 49f36bb028
Merge pull request #4988 from blueyed/logging-close
logging: close log_file_handler
2019-03-26 19:57:57 +01:00
Daniel Hahler 52730f6330 doc: fix note about output capturing with pdb
[skip travis]
2019-03-26 18:33:00 +01:00
Daniel Hahler 538efef1ba logging: close log_file_handler
While it should be closed in logging's shutdown [1], the following would
still issue a ResourceWarning:

```
import logging

log_file_handler = logging.FileHandler("temp.log", mode="w", encoding="UTF-8")

root_logger = logging.getLogger()
root_logger.addHandler(log_file_handler)
root_logger.removeHandler(log_file_handler)
root_logger.error("error")

del log_file_handler
```

It looks like the weakref might get lost for some reason.

See https://github.com/pytest-dev/pytest/pull/4981/commits/92ffe42b45 / #4981
for more information.

1: c1419578a1/Lib/logging/__init__.py (L2107-L2139)
2019-03-26 18:24:19 +01:00
Bruno Oliveira 9311d822c7 Fix assertion in pytest_report_unserialize 2019-03-26 12:47:31 -03:00
Daniel Hahler 351529cb50 skipping: factor out _get_pos, pass only config to _get_report_str 2019-03-26 16:29:16 +01:00
Daniel Hahler 94a2e3dddc stepwise: report status via pytest_report_collectionfinish 2019-03-26 13:20:33 +01:00
Bruno Oliveira ee96214a8d
Merge pull request #5000 from blueyed/merge-master-into-features
Merge master into features
2019-03-26 09:01:46 -03:00
Daniel Hahler e1ae469504 Merge master into features 2019-03-26 10:23:21 +01:00
Daniel Hahler 0d00be4f4f Do not swallow outcomes.Exit in assertrepr_compare 2019-03-26 10:20:00 +01:00
Daniel Hahler 23146e7527 Fix usages of "verbose" option
With `-qq` `bool(config.getoption("verbose"))` is True; it needs to be
checked for `> 0`.
2019-03-26 10:11:25 +01:00
Daniel Hahler b18df936ea changelog 2019-03-26 10:06:53 +01:00
Daniel Hahler 4148663706
Merge pull request #4979 from blueyed/minor
Minor: whitespace, typo, docs
2019-03-26 10:01:13 +01:00
Bruno Oliveira 3e1971eb16
Merge pull request #4994 from blueyed/test_as_errors-subprocess
test_as_errors: use subprocess with `-W`
2019-03-25 20:50:15 -03:00
Bruno Oliveira bcdb86ee7e
Merge pull request #4991 from blueyed/fix-tests
Fix pytest's own tests with `-W error::ResourceWarning`
2019-03-25 20:47:51 -03:00
Bruno Oliveira 2d77018d1b Improve coverage for _report_unserialization_failure 2019-03-25 20:16:59 -03:00
Bruno Oliveira ceef0af1ae Improve coverage for to_json() with paths in reports 2019-03-25 20:16:59 -03:00
Bruno Oliveira e4eec3416a Note that tests from xdist reference the correct xdist issues 2019-03-25 20:16:59 -03:00
Bruno Oliveira 645774295f Add CHANGELOG 2019-03-25 20:16:59 -03:00
Bruno Oliveira f2e0c740d3 Code review suggestions 2019-03-25 20:16:59 -03:00
Bruno Oliveira d856f4e51f Make sure TestReports are not collected as test classes 2019-03-25 20:16:59 -03:00
Bruno Oliveira 7b9a414524 Add pytest_report_serialize and pytest_report_unserialize hooks
These hooks will be used by pytest-xdist and pytest-subtests to
serialize and customize reports.
2019-03-25 20:16:59 -03:00
Bruno Oliveira 0c63f99016 Add experimental _to_json and _from_json to TestReport and CollectReport
This methods were moved from xdist (ca03269).

Our intention is to keep this code closer to the core, given that it
might break easily due to refactorings.

Having it in the core might also allow to improve the code by moving
some responsibility to the "code" objects (ReprEntry, etc) which
are often found in the reports.

Finally pytest-xdist and pytest-subtests can use those functions
instead of coding it themselves.
2019-03-25 20:16:59 -03:00
Daniel Hahler 3bc9cbea63
Merge pull request #4989 from blueyed/test_collect_capturing
test_collect_capturing: cover captured stderr
2019-03-25 23:41:53 +01:00
Daniel Hahler 6eff3069da
Merge pull request #4851 from blueyed/addopts-vv
ci: PYTEST_ADDOPTS=-vv
2019-03-25 23:41:33 +01:00
Daniel Hahler 58a14b6b99
Merge pull request #4986 from blueyed/fnmatch_lines-list
tests: fnmatch_lines: use list
2019-03-25 23:31:04 +01:00
Daniel Hahler b53bf44139
Merge pull request #4985 from blueyed/assert-from_current
ExceptionInfo.from_current: assert current exception
2019-03-25 23:28:58 +01:00
Daniel Hahler d8758443bd
Merge pull request #4983 from blueyed/coveragerc
.coveragerc: use "src" only from current dir
2019-03-25 23:28:23 +01:00
Daniel Hahler 51f64c2920
Merge pull request #4980 from blueyed/fixup_namespace_packages
monkeypatch.syspath_prepend: call fixup_namespace_packages
2019-03-25 23:10:00 +01:00
Bruno Oliveira cea42ff9e4 Docs: modules implementing pytest_cmdline_parse can be early-loaded
Related to #4974
2019-03-25 18:43:06 -03:00
Daniel Hahler 2df9d05981
Merge pull request #4982 from blueyed/cover
Revisit coverage in some tests
2019-03-25 10:28:55 +01:00
Daniel Hahler 4142c41ffc
Merge pull request #4990 from blueyed/session-repr
Session repr
2019-03-24 19:54:18 +01:00
Daniel Hahler de44293d59 CollectError.repr_failure: honor explicit tbstyle option 2019-03-24 11:24:19 +01:00
Daniel Hahler 5efe6ab93c test_log_cli_auto_enable: get stdout once 2019-03-24 11:22:07 +01:00
Daniel Hahler ce59f42ce1 revisit test_root_logger_affected 2019-03-24 11:21:13 +01:00
Daniel Hahler 7da7b9610c minor: whitespace 2019-03-24 11:20:24 +01:00
Daniel Hahler d44e42ec15 doc: improve warning_record_to_str 2019-03-24 11:20:01 +01:00
Daniel Hahler 0ea1889265 test_as_errors: use subprocess with `-W`
Ref: https://github.com/pytest-dev/pytest/pull/4981
2019-03-24 11:17:55 +01:00
Daniel Hahler 6352cf2374 test_implicit_bad_repr1: harden/cleanup 2019-03-24 11:15:40 +01:00
Daniel Hahler 3127ec737b Fix pytest's own tests with `-W error::ResourceWarning` 2019-03-24 11:05:00 +01:00
Daniel Hahler aa0b657e58 Add Session.__repr__ 2019-03-24 11:02:58 +01:00
Daniel Hahler d0f3f26fff test_collect_capturing: cover captured stderr 2019-03-23 23:17:07 +01:00