Commit Graph

12669 Commits

Author SHA1 Message Date
Andrew a67c553beb
Disable caching when evaluating expressions in marks (#7373) 2020-06-16 12:39:36 +03:00
Ran Benita b6fd89ef31
Merge pull request #7370 from bluetech/typing3
Some type annotations, doc improvements
2020-06-16 11:23:57 +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
Bruno Oliveira d7c5b61f6d
Docs: Update tense, the final Python 2.7 was released in April (#7367)
Docs: Update tense, the final Python 2.7 was released in April
2020-06-15 16:16:39 -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 06489d26c1
Merge pull request #7372 from bluetech/py-182
Require py>=1.8.2 so we can rely on correct hash() of py.path.local n Windows
2020-06-15 20:51:50 +03:00
Ran Benita 7b77fc086a
Merge pull request #7368 from bluetech/teardown-in-setup
runner: don't try to teardown previous items from pytest_runtest_setup
2020-06-15 19:41:21 +03: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
Ran Benita 4f4c2638d0
Merge pull request #7351 from cool-RR/2020-06-11-raise-from
Fix exception causes in config/__init__.py
2020-06-14 18:03:56 +03:00
Ran Benita 33804fd9b7 doc/reference: move "Collection hooks" before "Test running hooks"
Collection occurs before test running, so it seems more logical.
2020-06-14 17:31:38 +03:00
Ran Benita da1124eb98 hookspec: improve runtest hooks documentation 2020-06-14 17:31:38 +03:00
Ran Benita 2a38ca8a0c doc/reference: add CollectReport
CollectReport appears in several hooks, so we should document it. It's
runtest equivalent TestReport is already documented.
2020-06-14 16:55:41 +03:00
Ran Benita 5e35c86a37 doc/reference: refer to function public names instead of internal _pytest names
This way e.g. a :py:func:`pytest.exit` cross-reference works properly.
2020-06-14 16:54:50 +03:00
Ran Benita bb878a2b13 runner: don't try to teardown previous items from pytest_runtest_setup
While working on improving the documentation of the
`pytest_runtest_setup` hook, I came up with this text:

> Called to perform the setup phase of the test item.
>
> The default implementation runs ``setup()`` on item and all of its
> parents (which haven't been setup yet). This includes obtaining the
> values of fixtures required by the item (which haven't been obtained
> yet).

But upon closer inspection I noticed this line at the start of
`SetupState.prepare` (which is what does the actual work for
`pytest_runtest_setup`):

    self._teardown_towards(needed_collectors)

which implies that the setup phase of one item might trigger teardowns
of *previous* items. This complicates the simple explanation. It also
seems like a completely undesirable thing to do, because it breaks
isolation between tests -- e.g. a failed teardown of one item shouldn't
cause the failure of some other items just because it happens to run
after it.

So the first thing I tried was to remove that line and see if anything
breaks -- nothing did. At least pytest's own test suite runs fine. So
maybe it's just dead code?
2020-06-14 13:48:05 +03:00
Ran Benita 314d00968a hookspec: type annotate pytest_runtest_log{start,finish} 2020-06-14 12:51:06 +03:00
Ran Benita bb7b3af9b9 hookspec: fix return type annotation of pytest_runtest_makereport 2020-06-13 22:30:00 +03:00
Ran Benita 25064eba7a pytest.collect: type annotate (backward compat module)
This is just to satisfy typing coverage.
2020-06-13 22:29:24 +03:00
Hugo van Kemenade 03d0a10e3a
The final Python 2.7 was released in April
The final Python 2.7.18 release was on 20 Apr 2020.

https://mail.python.org/archives/list/python-dev@python.org/thread/OFCIETIXLX34X7FVK5B5WPZH22HXV342/#OFCIETIXLX34X7FVK5B5WPZH22HXV342
2020-06-13 20:50:24 +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
Gleb Nikonorov 8a022c0ce3 test to make sure precommit is fixed 2020-06-13 09:57:13 -04:00
Gleb Nikonorov f8a8bdbeb0 remove pre-commit change 2020-06-13 09:55:55 -04:00
Gleb Nikonorov 7ea116d74c Merge remote-tracking branch 'origin' into issue_7346 2020-06-13 09:54:23 -04:00
Bruno Oliveira 3151219785 assertoutcomes() only accepts plural forms
Fix #6505
2020-06-13 10:29:22 -03:00
Ran Benita f551cab877
Merge pull request #7358 from bluetech/typing2
More type annotations, fix some typing bugs
2020-06-13 10:44:11 +03:00
Gleb Nikonorov 6f8633cc17 add in solution barring documentation 2020-06-13 02:47:15 -04:00
Bruno Oliveira aaa6f1c3fa
Merge pull request #7330 from gnikonorov/issue_7305 2020-06-12 19:35:38 -03:00
Ram Rachum caa984c029 Fix exception causes in config/__init__.py 2020-06-12 18:49:57 +03:00
Ran Benita a5ab7c19fb config: reject minversion if it's a list instead of a single string
Fixes:

src/_pytest/config/__init__.py:1071: error: Argument 1 to "Version" has incompatible type "Union[str, List[str]]"; expected "str"  [arg-type]
2020-06-12 17:34:31 +03:00
Ran Benita 1cf9405075 Fix some type errors around py.path.local
These errors are found using a typed version of py.path.local.
2020-06-12 17:34:31 +03:00
Ran Benita 0256cb3aae hookspec: type annotate pytest_internalerror
Also switch to using ExceptionRepr instead of
`Union[ReprExceptionInfo, ExceptionChainRepr]`
which is somewhat annoying and less future proof.
2020-06-12 17:34:31 +03:00
Ran Benita 7081ed19b8 hookspec: type annotate pytest_keyboard_interrupt 2020-06-12 17:34:31 +03:00
Ran Benita b4f046b777 monkeypatch: add type annotations 2020-06-12 17:34:31 +03:00
Ran Benita f84ffd9747 Remove unused type: ignores
Not needed since update from mypy 0.770 -> 0.780.
2020-06-12 17:34:31 +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
Gleb Nikonorov 1474f24c07 Merge branch 'issue_7305' of github.com:gnikonorov/pytest into issue_7305 2020-06-12 08:28:23 -04:00
Gleb Nikonorov 2c8e356174 rename _emit_warning_or_fail to _warn_or_fail_if_strict and fix a doc typo 2020-06-12 08:27:55 -04:00
Bruno Oliveira 72344a5620
Merge pull request #7352 from nicoddemus/lock-unlink-5456
Suppress errors while removing tmpdir's lock files
2020-06-12 08:53:06 -03: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
Bruno Oliveira 0821c5c81d
Merge pull request #7349 from tbm/doc 2020-06-11 07:55:53 -03:00
Martin Michlmayr 68572179cb
doc: Fix typos and cosmetic issues 2020-06-11 16:22:47 +08:00
Gleb Nikonorov c18afb59f5 final touches 2020-06-10 19:09:24 -04:00
Bruno Oliveira c76077c63e
Merge pull request #7345 from The-Compiler/fixture-docs
doc: Explain indirect parametrization and markers for fixtures
2020-06-10 17:16:08 -03: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 c83801eed0
Merge pull request #6835 from iwanb/master 2020-06-09 15:01:35 -03:00
Bruno Oliveira 10cee92955 Fix typo 2020-06-09 14:58:57 -03:00