Commit Graph

12159 Commits

Author SHA1 Message Date
Ran Benita 1ce30fd38f Document the pytest_report_teststatus hook better and test uncovered functionality
This hook has some functionality to provide explicit markup for the test
status. It seemed unused and wasn't tested, so I was tempted to remove
it, but I found that the pytest-rerunfailures plugin uses it, so
document it and add a test instead.
2020-04-04 17:27:59 +03:00
Daniel Hahler e01dcbf323
Cleanup/move imports with tmpdir tests (#7015) 2020-04-04 14:25:34 +02:00
Ran Benita e6563b7ca3
Merge pull request #7010 from bluetech/rm-defaultfuncargprefixmarker
Remove unused defaultfuncargprefixmarker
2020-04-04 14:53:08 +03:00
Ran Benita 4a324ce920 Remove unused defaultfuncargprefixmarker
Unused since 1e80a9cb34.
2020-04-04 14:34:40 +03:00
Daniel Hahler 48c9f556ef
Fix tests: use explicit syspathinsert where tests might hang (#7008)
Use `testdir.syspathinsert()` with multiprocessing tests:

- test_chained_exceptions_no_reprcrash
- test_exception_handling_no_traceback

This only works currently because `_importtestmodule` changes `sys.path`
as a side-effect.

It appears to be only required on Windows though - likely due to the
multiprocessing method used there.
2020-04-04 12:33:15 +02:00
Ran Benita 5d539afd6c
Merge pull request #6998 from alfredodeza/fix-cache-doc
docs: Do not use automatic title in fixture reference
2020-04-03 11:52:31 +03: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
Alfredo Deza 7d75762de6 Do not use automatic title in fixture reference
It creates odd wording otherwise. Keep the reference, update the title
using Sphinx notation.
2020-04-01 09:55:30 -04: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 93b3fee783
Merge pull request #6981 from RonnyPfannschmidt/deprecate-pytest.collect
deprecate the pytest.collect module
2020-03-30 22:32:47 +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 ce429381a7
Merge pull request #6986 from RonnyPfannschmidt/fix-6951-tw.writer-writable
fix #6951: allow to write TerminalReporter.writer
2020-03-30 21:51:06 +02:00
Ronny Pfannschmidt eab2831671 fix #6951: allow to write TerminalReporter.writer 2020-03-30 21:31:53 +02:00
Ran Benita 211adfc945
Merge pull request #6983 from kondratyev-nv/master
Fix documentation typo
2020-03-30 11:32:38 +03:00
Nikolay Kondratyev 285beddf28 Fix documentation typo 2020-03-29 16:55:56 +03: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
Bruno Oliveira f84742d46c
Merge pull request #6980 from nicoddemus/quick-doc-fix
Quick doc fix on xfail reason parameter
2020-03-28 16:11:18 -03:00
Bruno Oliveira c6517e2c3a
Merge pull request #6977 from bluetech/oserror-aliases
Change EnvironmentError, IOError to OSError - they are aliases
2020-03-28 11:32:34 -03:00
Bruno Oliveira 70cbce7ccc Quick doc fix on xfail reason parameter
As per https://github.com/pytest-dev/pytest/pull/6957/files#r399564043
2020-03-28 11:30:15 -03:00
Tim Hoffmann 0e4a44db3b
Better document xfail(condition) (#6957) 2020-03-27 22:46:42 +03:00
Ran Benita a785754523 Change EnvironmentError, IOError to OSError - they are aliases
Since Python 3.3, these are aliases for OSError:
https://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy
2020-03-27 18:40:23 +03:00
Ran Benita 83e18776f6
Merge pull request #6818 from blueyed/fix-assert-exc-upstream
assertion: rewrite: only catch EnvironmentError
2020-03-27 18:33:17 +03:00
Bruno Oliveira 36d0a71be8
Merge pull request #6976 from nicoddemus/fix-linting
Fix linting
2020-03-27 10:30:09 -03:00
Bruno Oliveira a016a75ca7 Fix linting 2020-03-27 09:54:20 -03:00
Bruno Oliveira 429a28eca0
Merge pull request #6782 from nicoddemus/code-highlight-followup
Assorted improvements following up #6658
2020-03-27 08:58:50 -03:00
Daniel Hahler aae0579bcd
doc: use `envvar` directive for environment variables (#6874)
This changes the link anchors in "reference.html", from e.g.
`reference.html#pytest-current-test` to
`reference.html#envvar-PYTEST_CURRENT_TEST`, but I think that is OK, and
not worth adding labels for the old anchors.
2020-03-27 02:40:25 +01:00
Daniel Hahler e651562271
test_warnings: clean up usage of pyfile_with_warnings (#6799)
Remove it where not used / overwritten, and use its reference otherwise,
which makes it clear that it is used actually.
2020-03-27 02:24:00 +01:00
Daniel Hahler 327ec54248
Doc fixes (#6861) 2020-03-27 02:22:03 +01:00
Ran Benita 3b48fce4bc
Merge pull request #6965 from 0cjs/dev/cjs/200325/typo-fixes
CONTRIBUTING: Grammatical clarification and minor typo fixes
2020-03-26 07:20:27 +02:00
Curt J. Sampson 37cbab6899 CONTRIBUTING: Grammatical clarification and minor typo fixes
The main unclear part was that "to contribute changes" read in two
different ways; I've reworded it so it reads only one way.
2020-03-25 21:41:03 +09:00
Ran Benita efada09da2
Merge pull request #6943 from bluetech/mypy-770
Upgrade mypy 0.761 -> 0.770
2020-03-23 11:49:27 +02:00
Ran Benita 77e673c248
Merge pull request #6959 from lewisbelcher/patch-1
Update fixture.rst
2020-03-23 11:49:00 +02:00
Lewis Belcher 27341d17fa
Update fixture.rst
Fix up some mangled wording.
2020-03-23 09:02:06 +01:00
Ran Benita c928550e96
Merge pull request #6949 from Mattwmaster58/patch-1
update available plugin count
2020-03-21 17:18:14 +02:00
Ran Benita 817537523c Upgrade mypy 0.761 -> 0.770
https://mypy-lang.blogspot.com/2020/03/mypy-0770-released.html
2020-03-21 17:16:30 +02:00
Ran Benita 6ca7a0409d
Merge pull request #6950 from bluetech/fix-ci-oldattrs-twisted
ci: twisted and oldattrs tox envs are now incompatible, don't run the…
2020-03-21 17:14:45 +02:00
Ran Benita 2cc3227f6a ci: twisted and oldattrs tox envs are now incompatible, don't run them together
twisted started to use `attr.s(eq)` argument which was added recently,
so it fails with oldattrs. One of the CI jobs ran twisted and oldattrs
together, so it started to fail.

Move the twisted code to be covered by another job, and remove it from
the job with the oldattrs.
2020-03-21 16:22:33 +02:00
Mattwmaster58 c6e530990f
update available plugin count
315+ -> 815+
2020-03-20 22:39:18 -06:00
Ran Benita ded30238f7
Merge pull request #6926 from bluetech/fix-capsysbin-print
Fix crash when printing while capsysbinary is active
2020-03-17 11:21:19 +02: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
Ran Benita c26bbdfaf0
Merge pull request #6854 from gdhameeja/Fix-6822
Check invalid operations for -k
2020-03-15 09:53:36 +02:00
Ran Benita e2dc2d1f0f
Merge pull request #6929 from dannysepler/fix-reference-to-config-cache
Fix reference to the cache fixture
2020-03-15 09:53:00 +02:00
Danny Sepler 2d897ad39f Fix reference to the cache fixture 2020-03-14 20:12:52 -04:00
Ran Benita 1d244b3d82
Merge pull request #6899 from bluetech/rm-dupfile
Remove safe_text_dupfile() and simplify EncodedFile
2020-03-14 13:13:28 +02:00
Ran Benita 29e4cb5d45 Remove safe_text_dupfile() and simplify EncodedFile
I tried to understand what the `safe_text_dupfile()` function and
`EncodedFile` class do. Outside tests, `EncodedFile` is only used by
`safe_text_dupfile`, and `safe_text_dupfile` is only used by
`FDCaptureBinary.__init__()`. I then started to eliminate always-true
conditions based on the single call site, and in the end nothing was
left except of a couple workarounds that are still needed.
2020-03-14 12:57:08 +02:00
Bruno Oliveira d7f01a90eb
Merge pull request #6920 from nicoddemus/cherry-pick-release
Cherry pick CHANGELOG from 5.4.1
2020-03-13 11:16:58 -03:00
Bruno Oliveira 68d4b17a5f Cherry pick CHANGELOG from 5.4.1 2020-03-13 11:13:05 -03:00
Bruno Oliveira 703c948294
Merge pull request #6916 from nicoddemus/no-link-checks
Skip link checks when doing releases through the bot
2020-03-13 10:31:14 -03:00
Bruno Oliveira b1b8ea765e Skip link checks when doing releases through the bot
Unfortunately this is really getting in the way of the releases not because
of broken links, but because it is very flaky.

Related: #6894
2020-03-13 10:27:07 -03:00