Commit Graph

12271 Commits

Author SHA1 Message Date
Ran Benita 7da3e3aaad Increase test_faulthandler.py::test_timeout sleep duration on CI
This might help fix some flakiness.
2020-04-06 11:55:03 +03:00
Daniel Hahler fc645412aa Fix `test_popen_default_stdin_stderr_and_stdin_None` when run with `-s` 2020-04-06 08:32:41 +02:00
Daniel Hahler 51c1ae89cd doc: remove deprecations from pytest 3
This is in line with 9c5da9c0d, which versionadded instructions.
2020-04-06 07:02:15 +02:00
Ran Benita cb06bc7d6e
Merge pull request #7017 from bluetech/doc-pytest_report_teststatus
Document the pytest_report_teststatus hook better and test uncovered functionality
2020-04-04 18:45:50 +03:00
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
Daniel Hahler 354602abe6
Update src/_pytest/hookspec.py
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2020-04-02 12:01:43 +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
Daniel Hahler 607f7603af doc: pytest_collection: has to set `session.items`
Would make sense to use its return value etc, but this helps for now.
2020-03-31 09:39:50 +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 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