Commit Graph

1977 Commits

Author SHA1 Message Date
Bruno Oliveira c00fe960ba Allow ovewriting a parametrized fixture while reusing the parent fixture's value
Fix #1953
2020-09-11 16:53:34 -03:00
Sorin Sbarnea 1df2471f17
Make min duration configurable for slowest tests (#7667)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-05 09:18:29 -03:00
Ran Benita 885d969484
Merge pull request #7685 from bluetech/py-to-pathlib-2
config: start migrating Config.{rootdir,inifile} from py.path.local to pathlib
2020-09-04 18:42:52 +03:00
Bruno Oliveira 0d0b798663
Merge pull request #7708 from nicoddemus/repr-line-7707
Fix handle of exceptions in ReprEntry with tb=line
2020-09-04 12:06:11 -03:00
Ran Benita a346028006 config: add Config.{rootpath,inipath}, turn Config.{rootdir,inifile} to properties 2020-09-04 18:04:25 +03:00
Bruno Oliveira 19e99ab413
Integrate warnings filtering directly into Config (#7700)
Warnings are a central part of Python, so much that Python itself has
command-line and environtment variables to handle warnings.

By moving the concept of warning handling into Config, it becomes natural to
filter warnings issued as early as possible, even before the "_pytest.warnings"
plugin is given a chance to spring into action. This also avoids the weird
coupling between config and the warnings plugin that was required before.

Fix #6681
Fix #2891
Fix #7620
Fix #7626
Close #7649

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-09-04 11:57:15 -03:00
Bruno Oliveira 9f672c85c5 Fix handle of exceptions in ReprEntry with tb=line
Fix #7707
2020-09-03 07:44:45 -03:00
Ran Benita 98891a5947 python: skip pytest_pycollect_makeitem work on certain names
When a Python object (module/class/instance) is collected, for each name
in `obj.__dict__` (and up its MRO) the pytest_pycollect_makeitem hook is
called for potentially creating a node for it.

These Python objects have a bunch of builtin attributes that are
extremely unlikely to be collected. But due to their pervasiveness,
dispatching the hook for them ends up being mildly expensive and also
pollutes PYTEST_DEBUG=1 output and such.

Let's just ignore these attributes.

On the pandas test suite commit 04e9e0afd476b1b8bed930e47bf60e,
collect only, irrelevant lines snipped, about 5% improvement:

Before:

```
         51195095 function calls (48844352 primitive calls) in 39.089 seconds

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
226602/54    0.145    0.000   38.940    0.721 manager.py:90(_hookexec)
    72227    0.285    0.000   20.146    0.000 python.py:424(_makeitem)
    72227    0.171    0.000   16.678    0.000 python.py:218(pytest_pycollect_makeitem)
```

After:

```
          48410921 function calls (46240870 primitive calls) in 36.950 seconds

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
 181429/54    0.113    0.000   36.777    0.681 manager.py:90(_hookexec)
     27054    0.130    0.000   17.755    0.001 python.py:465(_makeitem)
     27054    0.121    0.000   16.219    0.001 python.py:218(pytest_pycollect_makeitem)
```
2020-08-26 17:43:57 +03:00
Ran Benita a267a622eb python: fix empty parametrize() leading to "NotSetType.token" id
In ff8b7884e8 NOTSET was changed to a
singleton enum, which ended up unexpectedly triggering a code path in ID
generation which checks for `isinstance(Enum)`.

Add an explicit case for it, which is not too bad anyway.
2020-08-25 22:01:43 +03:00
Ran Benita bb38ae9c52
Merge pull request #7651 from bluetech/capture-safe-disable
capture: fix disabled()/global_and_fixture_disabled() enabling capturing when it was disabled
2020-08-24 12:11:09 +03:00
Ran Benita 143e3ab846
Merge pull request #7673 from bluetech/logging-fix-handler-restore
logging: fix handler level restored incorrectly if caplog.set_level is called more than once
2020-08-23 12:06:09 +03:00
Ran Benita b1354608cc logging: fix handler level restored incorrectly if caplog.set_level is called more than once 2020-08-22 17:46:23 +03:00
Maximilian Cosmo Sitter 75af2bfa06
Reintroduce warnings postponed in 6.0 (#7637) 2020-08-22 11:17:50 -03:00
Bruno Oliveira ef946d557c Remove resultlog plugin 2020-08-19 08:14:28 -03:00
Bruno Oliveira b32c48ee05 Add bottom changelog deprecation notice 2020-08-19 08:14:28 -03:00
Bruno Oliveira 457d351941 Remove deprecated TerminalReporter.writer property 2020-08-19 08:13:34 -03:00
Bruno Oliveira 6ecbd008c4 Change junit_family default to xunit2 2020-08-19 08:13:06 -03:00
Bruno Oliveira 73e06373dc Hard failure when constructing Node subclasses 2020-08-19 08:13:03 -03:00
Bruno Oliveira c747dc5248 Drop support for positional arguments in @pytest.fixture 2020-08-19 08:11:42 -03:00
Bruno Oliveira 98530184a5 Remove funcargnames compatibility property 2020-08-19 08:11:39 -03:00
Ran Benita c98525bd21
Merge pull request #7648 from bluetech/pylint-abc2
Only define gethookproxy, isinitpath on Session
2020-08-18 15:45:11 +03:00
Bruno Oliveira afa4760cb8
Merge pull request #7643 from nicoddemus/issue-7628 2020-08-17 16:58:56 -03:00
Ran Benita 0d5a65091d capture: fix disabled()/global_and_fixture_disabled() enabling capturing when it was disabled
The `CaptureManager.global_and_fixture_disabled()` context manager (and
`CaptureFixture.disabled()` which calls it) did `suspend(); ...;
resume()` but if the capturing was already suspended, the `resume()`
would resume it when it shouldn't.

This caused caused some messages to be swallowed when `--log-cli` is
used because it uses `global_and_fixture_disabled` when capturing is not
necessarily resumed.
2020-08-16 23:21:45 +03:00
Bruno Oliveira 2213016e40 Fix Module.name from full path without drive letter
Fix #7628
2020-08-15 09:39:14 -03:00
Bruno Oliveira 3f0abcc6a5
Merge pull request #7639 from nicoddemus/issue-7638 2020-08-15 09:17:37 -03:00
Ran Benita eddd993cf4 Only define gethookproxy, isinitpath on Session
This fixes an issue where pylint complains about missing implementations
of abstract methods in subclasses of `File` which only override
`collect()` (as they should).

It is also cleaner and makes sense, these methods really don't need to
be overridden.

The previous methods defined directly on `FSCollector` and `Package` are
deprecated, to be removed in pytest 7.

See commits e2934c3f8c and
f10ab021e2 for reference.
2020-08-15 13:40:16 +03:00
Ran Benita 8056a677b4 Add changelog for PR #7631 2020-08-14 11:02:44 +03:00
Bruno Oliveira 36c8bb492e get_dirs_from_args handles paths with invalid syntax
Fix #7638
2020-08-12 17:20:09 -03:00
Maximilian Cosmo Sitter 15d8293241
Remove faq.rst from docs (#7635) 2020-08-12 14:47:34 -03:00
Bruno Oliveira 07f7372aff
Merge pull request #7586 from nicoddemus/cp-release
Merge pull request #7584 from pytest-dev/release-6.0.1
2020-08-01 11:00:38 -03:00
Ran Benita 96a48f0c66 Stop using more-itertools
We barely use it; the couple places that do are not really worth the
extra dependency, I think the code is clearer without it.

Also simplifies one (regular) itertools usage.

Also improves a check and an error message in `pytest.raises`.
2020-07-30 20:19:24 +03:00
Bruno Oliveira e49f1d6f60 Merge pull request #7584 from pytest-dev/release-6.0.1
Prepare release 6.0.1

(cherry picked from commit 022bff27a71406bd5dc4794d34f1fbbf56a45250)
2020-07-30 09:46:53 -03:00
Ran Benita 924e466c98 Add missing changelog for issue 7569 2020-07-30 12:38:40 +03:00
Bruno Oliveira e691d3ee52 Merge remote-tracking branch 'upstream/6.0.x' into fix-changelog-entries-release-process 2020-07-29 11:27:08 -03:00
Bruno Oliveira fe252848c5 Merge pull request #7561 from nicoddemus/longreprtext-7559 2020-07-29 09:47:31 -03:00
Bruno Oliveira 095bf191e2
Merge pull request #7561 from nicoddemus/longreprtext-7559 2020-07-29 09:47:04 -03:00
Bruno Oliveira d3267bc49d Fix TestReport.longreprtext when TestReport.longrepr is not a string
Fix #7559
2020-07-29 09:31:15 -03:00
Ran Benita 20a3a28815
Merge pull request #7536 from bluetech/junitxml-etree
junitxml: convert from py.xml to xml.etree.ElementTree
2020-07-29 12:01:33 +03:00
Ran Benita edb6211e36 Merge pull request #7565 from bluetech/pylint-callable-2
mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
(cherry picked from commit f9837f953c)
2020-07-29 11:51:08 +03:00
Ran Benita f9837f953c
Merge pull request #7565 from bluetech/pylint-callable-2
mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
2020-07-29 11:49:41 +03:00
Ran Benita f86e4516eb junitxml: convert from py.xml to xml.etree.ElementTree
Part of the effort to reduce dependency on the py library.

Besides that, py.xml implements its own XML serialization which is
pretty scary.

I tried to keep the code with minimal changes (though it could use some
cleanups). The differences in behavior I have noticed are:

- Attributes in the output are not sorted.

- Some unneeded escaping is no longer performed, for example escaping
  `"` to `&quot;` in a text node.
2020-07-29 10:52:21 +03:00
hp310780 27a4c6cd6d
Fix --help crash on add_ini(.., help='') and improve message on help=None (#7427) 2020-07-29 10:48:38 +03:00
Ran Benita b36bcd13e9 mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
Apparently the previous fix c1ca42b5c2 didn't work.
Hopefully this time I'm testing this correctly.
2020-07-29 10:39:13 +03:00
pytest bot 1e4b8d447c Prepare release version 6.0.0 2020-07-28 11:44:27 +00:00
Zac Hatfield-Dodds 3a060b77e8
Revert change to traceback repr (#7535)
* Revert change to traceback repr

* Add test and changelog entry

* Restore *exact* prev output

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-24 13:30:38 +02:00
Bruno Oliveira 7ec6401ffa
Change pytest deprecation warnings into errors for 6.0 release (#7362)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-07-22 21:36:51 -03:00
Kelton Bassingthwaite dbc50a7061
Clarify usage of usefixtures mark in hooks
Fix #7512

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-21 23:00:47 -03:00
Anthony Sottile 8616a5f1d9 Preserve newlines when captured with capfd 2020-07-20 10:31:20 -07:00
Debi Mishra 25b56e9c69 docs: Add a note about -q option used in getting started guide 2020-07-20 01:28:11 +05:30
Lewis Cowles 71ab6236a1
Clearer guidance on pytest.raise(match=...) failure (#7499) 2020-07-15 22:26:47 +03:00
Bruno Oliveira e7c42ae62b
Inaccessible lock files now imply temporary directories can't be removed
Fix #7500

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-07-15 09:25:17 -03:00
Simon K 7f467ebc9a
Create subdirectories if they do not exist when specified for log file (#7468)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-11 13:40:28 -03:00
Ran Benita 7b65b2337b
Merge pull request #7472 from bluetech/cleanups-4
Some minor fixes & type annotations
2020-07-11 19:05:07 +03:00
Bruno Oliveira d466cc25a7
Merge pull request #7424 from nicoddemus/package-scope-experimental-7389
Remove package scope experimental status
2020-07-11 08:44:34 -03:00
Bruno Oliveira 1667d138aa Use sphinx references for NO_COLOR and FORCE_COLOR in changelog 2020-07-10 09:30:04 -03:00
Hugo van Kemenade c1c5a2b34a
Add support for NO_COLOR and FORCE_COLOR (#7466)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-10 08:49:10 -03:00
Ran Benita 7934ac280f Add changelog entry for Frame removals 2020-07-10 13:08:56 +03:00
Bruno Oliveira 0a0c14dfac
Merge pull request #7459 from nicoddemus/release-6.0.0rc1 2020-07-09 21:25:58 -03:00
Arvin Firouzi c3e2b11a62
Fix reported location of skip when --runxfail is used (#7432)
Co-authored-by: Arvin Firouzi <427014@student.fontys.nl>
2020-07-09 23:10:32 +03:00
Bruno Oliveira 7d033a8950 Prepare release version 6.0.0rc1 2020-07-08 17:51:01 -04:00
Vlad-Radz 678c1a0745
assertion: improve diff output of recursive dataclass/attrs
Co-authored-by: Vlad <uladzislau.radziuk@nordcloud.com>
2020-07-08 19:04:56 +03:00
Ran Benita ef62b865f0
Merge pull request #7448 from bluetech/typing-publish
Publish our types
2020-07-05 16:51:26 +03:00
Ran Benita 2bcad38fbd Publish our types 2020-07-04 13:18:15 +03:00
Ran Benita 36b958c99e
Merge pull request #7438 from bluetech/source-cleanups
code/source: some cleanups
2020-07-04 12:57:32 +03:00
Ran Benita 40301effb8 Add changelog entry for code/source changes 2020-07-04 11:45:28 +03:00
Ruaridh Williamson 304f2916fc logging: use unique handlers for caplog and reports
Setting log_level via the CLI or .ini will control the log level of the
report that is dumped upon failure of a test.

If caplog modified the log level during the execution of that test, it
should not impact the level that is displayed upon failure in the
"captured log report" section.

[
ran:
- rebased
- reused handler
- changed store keys also to "caplog_handler_*"
- added changelog
all bugs are mine :)
]
2020-07-01 19:30:03 +03:00
Gleb Nikonorov 72a39117a8 Merge remote-tracking branch 'origin' into issue_7295 2020-06-27 19:43:03 -04:00
Bruno Oliveira 289197ff22 Remove package scope experimental status
Close #7389
2020-06-27 11:16:50 -03:00
Ran Benita 7450b6dd95
Merge pull request #7418 from bluetech/typing-3
More typing work
2020-06-27 10:54:29 +03: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
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
Gleb Nikonorov 0dd77b3e39 Merge remote-tracking branch 'origin/master' into issue_7295 2020-06-23 23:21:36 -04: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
Gleb Nikonorov ac89d6532a replace stderr warnings with the warnings module 2020-06-20 12:15:58 -04:00
Ram Rachum dd446bee5e Fix exception causes all over the codebase 2020-06-19 22:02:24 +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
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
Ronny Pfannschmidt 4e5a7b7d2f
Merge pull request #7366 from gnikonorov/issue_7346
Allow users to provide version information to the required_plugins INI key
2020-06-15 20:19:05 +02:00
Ran Benita c27550731d Require py>=1.8.2 so we can rely on correct hash() of py.path.local on Windows
See https://github.com/pytest-dev/py/blob/1.8.2/CHANGELOG#L4.
Fixes #7357.
2020-06-15 19:36:38 +03:00
Gleb Nikonorov 320625527a Add more tests and docs 2020-06-13 11:22:18 -04:00
Bruno Oliveira ab6dacf1d1
Introduce --import-mode=importlib (#7246)
Fix #5821

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-13 11:29:01 -03:00
Bruno Oliveira 2c37585f58
Merge pull request #7258 from piotrhm/issue_6471 2020-06-13 11:14:18 -03:00
Bruno Oliveira 3151219785 assertoutcomes() only accepts plural forms
Fix #6505
2020-06-13 10:29:22 -03:00
Bruno Oliveira aaa6f1c3fa
Merge pull request #7330 from gnikonorov/issue_7305 2020-06-12 19:35:38 -03:00
Zac Hatfield-Dodds 0f30103d9c
Merge pull request #7356 from Zac-HD/emancipate
Finish deprecation of "slave"
2020-06-12 23:13:11 +10:00
Zac-HD 564b2f707d Finish deprecation of "slave" 2020-06-12 22:49:33 +10:00
Bruno Oliveira ab331c906e Suppress errors while removing tmpdir's lock files
Fix #5456
2020-06-11 18:59:51 -03:00
Gleb Nikonorov 57415e68ee
Update changelog/7305.feature.rst
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-11 16:55:25 -04:00
Florian Bruhin e36d5c05c6 doc: Explain indirect parametrization and markers for fixtures 2020-06-10 14:27:45 +02:00
Gleb Nikonorov 95cb7fb676 review feedback 2020-06-10 00:44:22 -04:00
Bruno Oliveira 10cee92955 Fix typo 2020-06-09 14:58:57 -03:00
Bruno Oliveira 5a78df4bd0 Update CHANGELOG 2020-06-09 14:43:04 -03:00
ibriquem e2e7f15b71 Make dataclasses/attrs comparison recursive, fixes #4675 2020-06-09 14:39:40 -03:00
piotrhm e862643b3f Update 1120.bugfix.rst 2020-06-09 11:17:31 -03:00
piotrhm bde0ebcda9 Replace cleanup_numbered_dir with atexit.register 2020-06-09 11:17:31 -03:00
Bruno Oliveira d5a8bf7c6c Improve CHANGELOG 2020-06-08 22:26:14 -03:00
piotrhm 51fb11c1d1 Added tests 2020-06-08 22:26:14 -03:00
piotrhm 0b70300ba4 Added requested modifications 2020-06-08 22:26:14 -03:00
Bruno Oliveira fcbaab8b0b
Allow tests to override "global" `log_level` (rebased) (#7340)
Co-authored-by: Ruaridh Williamson <ruaridh.williamson@flexciton.com>
2020-06-08 22:05:46 -03:00
Prashant Anand e78207c936
7119: data loss with mistyped --basetemp (#7170)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-08 21:54:22 -03:00
Fabio Zadrozny 322190fd84
Fix issue where working dir becomes wrong on subst drive on Windows. Fixes #5965 (#6523)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-06-08 10:56:40 -03:00
Bruno Oliveira c17d50829f
Add pyproject.toml support (#7247) 2020-06-08 10:03:10 -03:00
Gleb Nikonorov 13add4df43 documentation fixes 2020-06-07 15:37:50 -04:00
Gleb Nikonorov 42deba59e7 Update documentation as suggested 2020-06-06 22:34:15 -04:00
Gleb Nikonorov f760b105ef Touchup pre-PR 2020-06-06 11:06:08 -04:00
Ran Benita e7c26a92d7
Merge pull request #7253 from bluetech/fixture-special-case
fixtures: remove special cases when deciding when pytest.fixture() is a direct decoration
2020-06-05 11:33:43 +03:00
Bruno Oliveira cf640a9b67
Merge pull request #7292 from kerizane/7259_iniconfig 2020-06-03 19:00:48 -03:00
Bruno Oliveira da5851c13e
Update changelog/7291.trivial.rst 2020-06-02 11:01:37 -03:00
Ronny Pfannschmidt 8faf1e8eca
Merge pull request #7286 from gnikonorov/issue_6856
Output a warning to stderr when an invalid key is read from an INI config file
2020-06-02 15:47:02 +02:00
Gleb Nikonorov a5d13d4ced Add changelog entry 2020-06-02 08:21:57 -04:00
Tor Colvin fe64093411
Fix removal of very long paths on Windows (#6755)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-06-02 08:56:33 -03:00
Keri Volans 2748feed38 7291: Replace py.iniconfig with iniconfig 2020-06-01 18:09:57 +01:00
Gleb Nikonorov 9ae94b08e2 Add documentation 2020-05-31 11:58:39 -04:00
Bruno Oliveira 70b5bdf4ba
Merge pull request #7264 from bluetech/wcwidth
Improve our own wcwidth implementation and remove dependency on wcwidth package
2020-05-31 12:37:58 -03:00
Ronny Pfannschmidt c16ede5ce6
Merge pull request #7255 from gnikonorov/issue_4049
Add new hook pytest_warning_recorded
2020-05-31 12:47:46 +02:00
Maximilian Cosmo Sitter b32f4de891
Issue 7202 - Point development guide to contributing section (#7280) 2020-05-31 09:37:26 +03:00
Bruno Oliveira b98aa195e0 Add test and changelog for #6428 2020-05-30 20:02:47 -03:00
Bruno Oliveira 56bf819c2f
Do not call TestCase.tearDown for skipped tests (#7236)
Fix #7215
2020-05-30 14:33:22 -03:00
Katarzyna Król 94c7b8b47c
Issue 1316 - longrepr is a string when pytrace=False (#7100) 2020-05-30 14:10:58 +03:00
Gleb Nikonorov 14de08011b fix the unit tests, add the proper deprecation warning, and add in a changelog entry 2020-05-27 23:03:07 -04:00
Ran Benita aca534c67d Improve our own wcwidth implementation and remove dependency on wcwidth package
`TerminalWriter`, imported recently from `py`, contains its own
incomplete wcwidth (`char_with`/`get_line_width`) implementation. The
`TerminalReporter` also needs this, but uses the external `wcwidth`
package.

This commit brings the `TerminalWriter` implementation up-to-par with
`wcwidth`, moves to implementation to a new file `_pytest._io.wcwidth`
which is used everywhere, and removes the dependency.

The differences compared to the `wcwidth` package are:

- Normalizes the string before counting.

- Uses Python's `unicodedata` instead of vendored Unicode tables. This
  means the data corresponds to the Python's version Unicode version
  instead of the `wcwidth`'s package version.

- Apply some optimizations.
2020-05-26 17:14:01 +03:00
Ran Benita 5507752c53 fixtures: remove special cases when deciding when pytest.fixture() is a direct decoration
pytest.fixture() can be used either as

    @pytest.fixture
    def func(): ...

or as

    @pytest.fixture()
    def func(): ...

or (while maybe not intended)

    func = pytest.fixture(func)

so it needs to inspect internally whether it got a function in the first
positional argument or not.

Previously, there were was oddity. In the following,

    func = pytest.fixture(func, autouse=True)
    # OR
    func = pytest.fixture(func, parms=['a', 'b'])

The result is as if `func` wasn't passed.

There isn't any reason for this special that I can understand, so remove
it.
2020-05-26 11:48:40 +03:00
Florian Dahlitz 6546d1f725
Prevent pytest from printing ConftestImportFailure traceback 2020-05-25 13:57:03 +02:00
Anthony Sottile c594bbbd19
Merge pull request #7240 from DahlitzFlorian/fix-issue-7233
Add note about --strict and --strict-markers to references
2020-05-23 12:31:27 -07:00
Anthony Sottile 45f53266e6
Merge pull request #7244 from DahlitzFlorian/fix-issue-7150
Prevent hiding underlying exception when ConfTestImportFailure is raised
2020-05-23 12:09:42 -07:00
Claire Cecil 79701c65ed
Added support for less verbose version information (#7169) 2020-05-23 11:27:58 -03:00
Florian Dahlitz d0eb86cfa6
Prevent hiding underlying exception when ConfTestImportFailure is raised 2020-05-22 22:58:35 +02:00
Florian Dahlitz 62d3577435
Add note about --strict and --strict-markers to references 2020-05-22 16:33:50 +02:00
Ran Benita 4a1557fa0e
Merge pull request #7091 from bluetech/capture-invalid-fd
Perform FD capturing even if the FD is invalid
2020-05-22 14:36:49 +03:00
Ran Benita 919ac2239d
Merge pull request #7231 from bluetech/logging-error
logging: propagate errors during log message emits
2020-05-22 14:27:26 +03:00
Ran Benita eaeafd7c30 Perform FD capturing even if the FD is invalid
The `FDCapture`/`FDCaptureBinary` classes, used by `capfd`/`capfdbinary`
fixtures and the `--capture=fd` option (set by default), redirect FDs
1/2 (stdout/stderr) to a temporary file. To do this, they need to save
the old file by duplicating the FD before redirecting it, to be restored
once finished.

Previously, if this duplicating (`os.dup()`) failed, most likely due to
that FD being invalid, the FD redirection would silently not be done. The
FD capturing also performs python-level redirection (monkeypatching
`sys.stdout`/`sys.stderr`) which would still be done, but direct writes
to the FDs would fail.

This is not great. If pytest is run with `--capture=fd`, or a test is
using `capfd`, it expects writes to the FD to work and be captured,
regardless of external circumstances.

So, instead of disabling FD capturing, keep the redirection to a
temporary file, just don't restore it after closing, because there is
nothing to restore to.
2020-05-20 19:32:37 +03:00
Bruno Oliveira 0a03217903
Merge pull request #7046 from blueyed/k-skip-session-upstream 2020-05-19 20:09:36 -03:00
Bruno Oliveira 5a2c69f150 Add CHANGELOG for #6817 2020-05-19 19:35:18 -03:00
Ran Benita b13fcb23d7 logging: propagate errors during log message emits
Currently, a bad logging call, e.g.

    logger.info('oops', 'first', 2)

triggers the default logging handling, which is printing an error to
stderr but otherwise continuing.

For regular programs this behavior makes sense, a bad log message
shouldn't take down the program. But during tests, it is better not to
skip over such mistakes, but propagate them to the user.
2020-05-19 11:16:39 +03:00
Bruno Oliveira ad3169428b Remove unused Function.__init__ 'args' parameter 2020-05-18 14:30:48 -03:00
Daniel Hahler 8b9b81c3c0
Function: use `originalname` in `_getobj` and make it default to `name` (#7035) 2020-05-18 14:08:47 -03:00
Ran Benita 3f8200676f logging: remove deprecated --no-print-logs option/ini
This option was deprecated in 5.4.0 and was marked for removal in 6.0.0.
2020-05-17 21:41:38 +03:00
Ran Benita ac6c02f1e2 logging: use item's store for private attributes
This makes things type-safe and properly private.
2020-05-17 20:42:05 +03:00
Bruno Oliveira c5b367b4f4 Package.name now contains only basname of the package
Previously it contained the entire path, which made '-k' match
against any name in the full path of the package.

Fix #7040
2020-05-16 15:04:07 -03:00
Daniel Hahler 3d3b9511fd -k should not match session name
Fixes https://github.com/pytest-dev/pytest/issues/7040.
2020-05-16 14:15:57 -03:00
Bruno Oliveira f506682abe
Merge pull request #6919 from nicoddemus/backport-6914 2020-05-16 12:42:15 -03:00
Daniel Hahler d530d70128 Fix regressions with `--lf` plugin
Only filter with known failures, and explicitly keep paths of passed
arguments.

This also displays the "run-last-failure" status before collected files,
and does not update the cache with "--collect-only".

Fixes https://github.com/pytest-dev/pytest/issues/6968.
2020-05-15 18:35:38 -03:00
Ran Benita f0f552d60c
Merge pull request #6283 from felixn/master
Create LogCaptureHandler if necessary (closes #6240)
2020-05-15 09:13:57 +03:00
Ran Benita 2ac28f6c65
Merge pull request #7205 from lancelote/7126
Issue 7126 - "saferepr" to avoid BytesWarning when using --setup-show
2020-05-14 16:04:22 +03:00
Felix Nieuwenhuizen 4dfc461036 Create LogCaptureHandler if necessary (closes #6240) 2020-05-13 20:38:14 +02:00
Ran Benita c4f9eaa5de mark: deprecate a couple undocumented -k syntaxes
The `-k '-expr'` syntax is an old alias to `-k 'not expr'`. It's also
not a very convenient to have syntax that start with `-` on the CLI.
Deprecate it and suggest replacing with `not`.

---

The `-k 'expr:'` syntax discards all items until the first match and
keeps all subsequent, e.g. `-k foo` with

    test_bar
    test_foo
    test_baz

results in `test_foo`, `test_baz`. That's a bit weird, so deprecate it
without a replacement. If someone complains we can reconsider or devise
a better alternative.
2020-05-11 16:07:52 +03:00
Pavel Karateev 17857b67df
Better changelog wording
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-10 16:58:22 +03:00
Pavel Karateev feb7a5f0d1 Omit internal solution details 2020-05-10 12:11:59 +03:00
Pavel Karateev a2280d39ec #7126, use past tense in changelog 2020-05-09 14:14:23 +03:00
Pavel Karateev 903e2ab6ee Fix #7126 - saferepr for bytes params
bytes parametrize parameters cause error when --setup-show is used
and Python is called with -bb flag
2020-05-09 13:57:17 +03:00
Bruno Oliveira 9657798c12
Merge pull request #7158 from CarycaKatarzyna/issue_7076 2020-05-08 07:56:03 -03:00
Ran Benita 857b5c9ccd
Merge pull request #7185 from bluetech/sigpipe
Handle SIGPIPE/BrokenPipeError in pytest's CLI
2020-05-08 13:32:34 +03:00
Ran Benita 73448f265d Handle EPIPE/BrokenPipeError in pytest's CLI
Running `pytest | head -1` and similar causes an annoying error to be
printed to stderr:

    Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
    BrokenPipeError: [Errno 32] Broken pipe

(or possibly even a propagating exception in older/other Python versions).

The standard UNIX behavior is to handle the EPIPE silently. To
recommended method to do this in Python is described here:
https://docs.python.org/3/library/signal.html#note-on-sigpipe

It is not appropriate to apply this recommendation to `pytest.main()`,
which is used programmatically for in-process runs. Hence, change
pytest's entrypoint to a new `pytest.console_main()` function, to be
used exclusively by pytest's CLI, and add the SIGPIPE code there.

Fixes #4375.
2020-05-08 12:51:02 +03:00
Anthony Sottile b238845d0f Fix _is_setup_py for files encoded differently than locale 2020-05-07 13:14:58 -07:00
Ran Benita 81da5dac48
Merge pull request #7122 from bluetech/matcher-parser
Stop using Python's eval() for -m and -k
2020-05-07 09:23:29 +03:00
Bruno Oliveira 6c2d358918
Merge pull request #7135 from pytest-dev/terminalwriter 2020-05-06 18:26:44 -03:00
Bruno Oliveira d0022b5a13 'saferepr' handles classes with broken __getattribute__
Fix #7145
2020-05-05 19:22:39 -03:00
Bruno Oliveira 16a44823eb Use reportinfo() instead of location in skipping message 2020-05-04 19:50:40 -03:00
Katarzyna 402ee6fb9d Relative path to invocationdir instead rootdir. 2020-05-03 22:56:38 +02:00
Bruno Oliveira 5c2e96c0e6 Fix cleanup functions not being invoked on test failures
Also delay calling tearDown() when --pdb is given, so users still have
access to the instance variables (which are usually cleaned up during tearDown())
when debugging.

Fix #6947
2020-05-02 15:26:55 -03:00
Bruno Oliveira e3643751bc
Merge pull request #7144 from nicoddemus/async-testcase-7110 2020-05-01 16:44:10 -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
Bruno Oliveira 7f5978c34c Allow File.from_parent to forward custom parameters to the constructor 2020-05-01 11:00:52 -03:00
Ran Benita a718ad6363 Stop using Python's eval() for -m and -k
Previously, the expressions given to the `-m` and `-k` options were
evaluated with `eval`. This causes a few issues:

- Python keywords cannot be used.

- Constants like numbers, None, True, False are not handled correctly.

- Various syntax like numeric operators and `X if Y else Z` is supported
  unintentionally.

- `eval()` is somewhat dangerous for arbitrary input.

- Can fail in many ways so requires `except Exception`.

The format we want to support is quite simple, so change to a custom
parser. This fixes the issues above, and gives us full control of the
format, so can be documented comprehensively and even be extended in the
future if we wish.
2020-05-01 12:59:06 +03:00
Ran Benita e40bf1d1da Add a changelog for TerminalWriter changes 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
Katarzyna Król 7789b51acb
Issue 4677 - always relative path in skip report (#6953) 2020-04-17 08:28:36 +03:00
Simon K de6c28ed1f
Improve error handling around yieldctx fixtures which do not yield a value (#7083) 2020-04-15 12:17:13 +03:00
Simon K 6fd30134d3
Update changelog/4583.bugfix.rst
Co-Authored-By: Ran Benita <ran@unusedvar.com>
2020-04-13 14:29:59 +01:00
symonk 87edc09dea Gracefully handle eval() failure(s) for marker expressions 2020-04-13 13:25:06 +01:00
Ronny Pfannschmidt 19c243f0fa
Merge pull request #6285 from earonesty/patch-1
Add _pytest.fixtures.FixtureLookupError to top level import
2020-04-10 07:58:58 +02:00
Ronny Pfannschmidt c5d636a1b2
Merge pull request #6992 from pytest-dev/revert-6767-tmpdir-cleanup-upstream
Revert "tmpdir: clean up indirection via config for factories"
2020-04-10 07:49:52 +02:00
Ronny Pfannschmidt 1eb2b45db5 Revert "tmpdir: clean up indirection via config for factories (#6767)"
This reverts commit 8a1633c3b4.

+ add changelog
2020-04-10 07:18:54 +02:00
Daniel Hahler 20f6331afd
Fix TerminalRepr instances to be hashable (#6988)
pytest-xdist assumes `ExceptionChainRepr` is hashable.

Fixes https://github.com/pytest-dev/pytest/issues/6925.
Fixes https://github.com/pytest-dev/pytest-xdist/issues/515.
2020-04-03 00:56:53 +02:00
Ronny Pfannschmidt 2d9dac95ec
Merge pull request #6927 from RonnyPfannschmidt/fix-6924-run-async-stdlib-unittests
running stdlib asyncio unittests again
2020-03-30 22:34:17 +02: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
Ronny Pfannschmidt f1d51ba1f5 deprecate the pytest.collect module
changelog

minimal unittest for collect module deprecations

\!fixup - changelog typo
2020-03-30 21:53:07 +02:00
Ronny Pfannschmidt eab2831671 fix #6951: allow to write TerminalReporter.writer 2020-03-30 21:31:53 +02:00
smarie 95fadd5740
Improved time counter used to compute test durations. (#6939)
Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-03-29 15:20:09 +03:00
Daniel Hahler 1fda861190 Fix crash when printing while capsysbinary is active
Previously, writing to sys.stdout/stderr in text-mode (e.g.
`print('foo')`) while a `capsysbinary` fixture is active, would crash
with:

    /usr/lib/python3.7/contextlib.py:119: in __exit__
        next(self.gen)
    E   TypeError: write() argument must be str, not bytes

This is due to some confusion in the types. The relevant functions are
`snap()` and `writeorg()`. The function `snap()` returns what was
captured, and the return type should be `bytes` for the binary captures
and `str` for the regular ones. The `snap()` return value is eventually
passed to `writeorg()` to be written to the original file, so it's input
type should correspond to `snap()`. But this was incorrect for
`SysCaptureBinary`, which handled it like `str`.

To fix this, be explicit in the `snap()` and `writeorg()`
implementations, also of the other Capture types.

We can't add type annotations yet, because the current inheritance
scheme breaks Liskov Substitution and mypy would complain. To be
refactored later.

Fixes: https://github.com/pytest-dev/pytest/issues/6871
Co-authored-by: Ran Benita (some modifications & commit message)
2020-03-16 18:21:33 +02:00
Bruno Oliveira 010e711971 Merge pull request #6914 from nicoddemus/revert-6330
Revert "[parametrize] enforce explicit argnames declaration (#6330)"
2020-03-13 10:49:48 -03:00
Bruno Oliveira 2eedf9c2aa
Merge pull request #6910 from nicoddemus/resultlog-logreport
Handle unknown stats in pytest_report_teststatus hook
2020-03-13 09:30:04 -03:00
Ran Benita 6e70fecbe4
Merge pull request #6903 from bluetech/assume-dup
Assume os.dup is always available
2020-03-13 11:01:44 +02:00
Bruno Oliveira 0c58ed2cc0 Handle unknown stats in pytest_report_teststatus hook
Noticed that the pytest_report_teststatus of reportlog was not properly
handling unknown statuses while taking a look at:

https://github.com/pytest-dev/pytest-rerunfailures/issues/103
2020-03-12 20:52:22 -03:00
Ran Benita 6954b3b0dc Assume os.dup is always available
The commit which added the checks for os.dup a15afb5e48
suggests it was done for Jython. But pytest doesn't support Jython
anymore (Jython is Python 2 only).

Furthermore, it looks like the faulthandler plugin (bundled in pytest
and enabled by default) uses os.dup() unprotected and there have not
been any complaints.

So seems better to just remove these checks, and only add if someone
with a legitimate use case complains.
2020-03-12 16:47:15 +02:00
pytest bot c9fd1bdbd6 Preparing release version 5.4.0 2020-03-12 14:14:35 +00:00
Daniel Hahler acec0b688f
Fix usage of pytester with doctests (#6802)
Use `request.node.name` instead of `request.function.__name__`:
`request.function` is `None` with `DoctestItem`s.
2020-03-04 05:33:50 +01:00
Ronny Pfannschmidt 9fd71d6fe0
fix #571: deprecate pytest_collect_directory as ... (#6847)
Deprecate pytest_collect_directory

Fix #571

Co-authored-by: Daniel Hahler <github@thequod.de>
2020-03-03 18:58:14 -03:00
Bruno Oliveira a03e076e89 Update changelog/6285.feature.rst
Co-Authored-By: Ran Benita <ran234@gmail.com>
2020-03-03 09:59:38 -03:00
earonesty 0f00495548 Create 6285.feature.rst 2020-03-03 09:59:38 -03:00
Ronny Pfannschmidt 194b52145b
Merge pull request #6834 from RonnyPfannschmidt/fix-6833-summarize-warning-item-locations
summarize warning summaries if the number of locations is high
2020-03-01 20:21:36 +01:00
Ronny Pfannschmidt 23c43a37e0 summarize warning summaries if the number of locations is high 2020-03-01 14:08:15 +01:00
Bruno Oliveira ff7b5dbbde
Merge pull request #6784 from nicoddemus/deprecate-terminal-writer
Deprecate TerminalReporter.writer
2020-02-28 21:07:02 -03:00
Daniel Hahler 4b53bbc0a9
docs: use doc/en/_build/html for html output (#6842)
This will use the same directory as `make -C doc/en` then, and reflects
the default location that Sphinx uses.
2020-02-29 00:47:30 +01:00
Daniel Hahler 5819536f00
Improve UsageError with invalid `-o` style (#6795)
This started from fixing the test, where `"xdist_strict True"` was used
as a single argument, although you typically would see `["xdist_strict",
"True"]`.

Improves the error message to mention the option that caused the error.
2020-02-28 19:41:56 +01:00
Daniel Hahler ac3a42bafd
doctest: strip newlines with unexpected exceptions (#6801) 2020-02-24 15:18:08 +01:00
Daniel Hahler c8b4a1a471
Handle `match` with `pytest.raises()` (#6753)
Fixes https://github.com/pytest-dev/pytest/issues/6752.
2020-02-22 23:32:55 +01:00
Daniel Hahler 68fe0eb8f3
Minor cosmetic fixes (#6792) 2020-02-22 19:24:41 +01:00
kpinc eeebcd77dd
doc: add list of fixtures to start of fixture chapter (#6696)
- Add list of fixtures to start of fixture chapter
- Add "fixture" cross ref type
2020-02-22 14:56:19 +01:00
Daniel Hahler 2277817176 Fix grammar in changelog/6737.breaking.rst 2020-02-22 13:15:17 +01:00
Bruno Oliveira 435ad221f9 Deprecate TerminalReporter.writer
Fix #6779
2020-02-20 21:04:49 -03:00
Daniel Hahler 1b30514783
LFPlugin: use sub-plugins to deselect during collection (#6448)
Fixes https://github.com/pytest-dev/pytest/issues/5301.

Refactor/steps:

- use var
- harden test_lastfailed_usecase
- harden test_failedfirst_order
- revisit last_failed_paths
- harden test_lastfailed_with_known_failures_not_being_selected
2020-02-19 21:33:03 +01:00
Daniel Hahler f95c7f5803
doctest: handle any OutcomeException (#6669)
Fixes using `pytest.xfail()` and `pytest.importorskip()` in doctests.

Ref: https://github.com/pytest-dev/pytest/issues/310
2020-02-19 13:16:37 +01: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 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
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
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 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
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
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
Daniel Hahler a8fc056aad
Handle `Exit` exception in `pytest_sessionfinish` (#6660) 2020-02-07 00:40:10 +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 39d9f7cff5
pytester: LineMatcher: typing, docs, consecutive line matching (#6653) 2020-02-04 22:47:18 +01:00
Daniel Hahler aa0328782f
assertion: save/restore hooks on item (#6646) 2020-02-04 02:56:23 +01:00
Daniel Hahler 75714ee707
pluginmanager.consider_preparse: add exclude_only kwarg (#6443)
Plugins specified with ``-p`` are now loaded after internal plugins, which
results in their hooks being called *before* the internal ones.

This makes the ``-p`` behavior consistent with ``PYTEST_PLUGINS``.

* fix/adjust test_disable_plugin_autoload
* adjust test_plugin_loading_order
2020-02-03 14:10:54 +01:00
Daniel Hahler 99d162e44a Handle `Exit` exception in `pytest_sessionfinish`
Similar to a7268aa (https://github.com/pytest-dev/pytest/pull/6258).
2020-02-02 23:13:23 +01:00
Daniel Hahler 5256542ea4 pytester.LineMatcher: add support for matching lines consecutively 2020-02-01 23:48:58 +01:00
Bruno Oliveira 70739296e1 Remove deprecated 'pytest_itemstart' hook
This hook has been deprecated/removed for more than 10 years
in a2fe6714f8.
2020-01-30 21:03:29 -03: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 595d62bc3e
Merge pull request #6607 from asottile/empty_string_parametrize_nodeid
Fix node ids which contain a parametrized empty-string variable
2020-01-29 08:42:04 -08:00
Daniel Hahler 55e5817570 Merge master into features 2020-01-29 03:07:35 +01:00
Daniel Hahler 3ccf2a5e61
Merge pull request #6524 from blueyed/reportchars-default
terminal: default to `fE` with `-r` (reportchars)
2020-01-29 01:00:41 +01:00
Daniel Hahler ddaa5d88ac terminal: default to `fE` with `-r` (reportchars)
Adds handling of `N` to reset `reportchars`, which can be used to get
the old behavior (`-rN`), and also allows for an alternative to
`--disable-warnings` (https://github.com/pytest-dev/pytest/issues/5066),
since `w` was included by default (without `--disable-warnings`).

Fixes https://github.com/pytest-dev/pytest/issues/6454
2020-01-29 00:33:15 +01:00
Anthony Sottile abd5fc80e8 Fix node ids which contain a parametrized empty-string variable 2020-01-28 13:27:54 -08:00
Holger Kohr 80d4dd6f0b Replace `==` with `is` for comparison of cache keys
Closes #6497
2020-01-28 18:05:53 -03:00
Daniel Hahler 30922ee694 Merge master into features 2020-01-28 01:40:14 +01:00
Daniel Hahler 039d582b52 Fix `EncodedFile.writelines`
This is implemented by the underlying stream already, which additionally
checks if the stream is not closed, and calls `write` per line.

Ref/via: https://github.com/pytest-dev/pytest/pull/6558#issuecomment-578210807
2020-01-25 18:06:50 +01:00
Daniel Hahler 57512aa997 _get_main_color: no yellow ("boring") for non-last item
- refactor _get_main_color/build_summary_stats_line
- factor out property _is_last_item; test_summary_stats: tr._is_last_item
- _write_progress_information_filling_space: remove color arg
- use setter for stats, handling main color
- _get_main_color: skip cache for last item
- Handle random order in test for py35.
2020-01-25 15:09:02 +01:00
Daniel Hahler c51173d426 Merge master into features 2020-01-25 14:18:02 +01:00
Tomáš Gavenčiak 5e15c86cc6 Fix EncodedFile.write return value
Make EncodedFile, used for captured output streams, method .write return
the number of characters written. Add test for captured stderr write.
Fixes #6557.

Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2020-01-25 10:36:23 +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
Daniel Hahler cdd6f86e43 bug-fix fixes 2020-01-23 20:34:21 +01:00
Bruno Oliveira 93b74d28d2 Merge remote-tracking branch 'upstream/master' into mm
Conflicts:
 * 	src/_pytest/_code/code.py
 * 	src/_pytest/main.py
 * 	testing/python/metafunc.py
 * 	testing/test_parseopt.py
 * 	testing/test_pytester.py
2020-01-22 11:03:45 -03:00
Bruno Oliveira 6a26ac4125 Preparing release version 5.3.4 2020-01-20 13:53:31 -03:00
Bruno Oliveira 0dc82e8501 Add CHANGELOG entry for #6496 2020-01-20 13:32:27 -03:00
Bruno Oliveira 56dc301c50 Preparing release version 5.3.3 2020-01-16 18:55:41 -05:00
Daniel Hahler 1667cf3350
Merge pull request #6384 from pv/showlocals-short
Make --showlocals work together with --tb=short

Fixes https://github.com/pytest-dev/pytest/issues/494
Ref: https://github.com/pytest-dev/pytest/issues/1715
2020-01-16 22:04:14 +01:00
Daniel Hahler 83813bf515 Merge master into features
Conflicts:
	.github/workflows/main.yml
2020-01-16 19:45:52 +01:00
Bruno Oliveira 9298f7e4a9 Improve CHANGELOG and docs for junit_logging 2020-01-16 07:47:00 -03:00
Jakub Mitoraj ab6406b42e Update junit_logging with no,log,system-out,system-err,out-err,all 2020-01-16 08:14:46 +01:00
Chris NeJame 99180939fe fixtures register finalizers with all fixtures before them in the stack 2020-01-15 11:00:42 -05:00
Ronny Pfannschmidt 8ba0b7bc2a fix #6341 - disallow session/config in Node.from_parent 2020-01-15 13:00:46 +01:00
Pauli Virtanen fd1691a2b3 Make --showlocals work together with --tb=short
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes #494
2020-01-14 21:30:58 +02:00
Daniel Hahler 61d04d3084 terminal: summary_passes: handle teardown sections
Fixes https://github.com/pytest-dev/pytest/issues/2780.
2020-01-11 21:58:19 +01:00
Daniel Hahler 1356d20e90 Merge master into features 2020-01-10 05:20:41 +01:00