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