Compare commits

...

2404 Commits

Author SHA1 Message Date
Bruno Oliveira
109312ba86 Make --version write to stdout rather than stderr
Fix #8246
2021-06-28 15:56:26 -03:00
Bruno Oliveira
2623ee2e0e Merge pull request #8802 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.2.1
Bump anyio[curio,trio] from 3.2.0 to 3.2.1 in /testing/plugins_integration
2021-06-28 15:37:01 -03:00
Florian Bruhin
ba1ad7d517 Opt-out from regendoc for problematic example (#8810)
* Opt-out from regendoc for problematic example

See #8807

* Add comment
2021-06-28 17:47:49 +00:00
Florian Bruhin
c4c3b6d4fd Adjust fixme comments (#8811) 2021-06-28 17:41:22 +00:00
Florian Bruhin
e729e0d1e6 scripts: Don't capture output in prepare-release-pr.py (#8805)
We don't need to access the output in the script, and if we capture it,
we don't get any output on CI, so no way to see why a release failed.
2021-06-28 12:15:25 +00:00
Florian Bruhin
c19f63d39d Adjust releasing infra/docs (#8795)
* Adjust releasing infra/docs

Follow-up for #8150, see #7507

* Add suggestions
2021-06-28 12:24:48 +02:00
dependabot[bot]
51742e14a1 Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.2.0...3.2.1)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-28 03:01:47 +00:00
Srip
6573107b97 doc: Adding exit code for pytest usage examples (#8790) (#8800)
* doc: Adding exit code for pytest usage examples (#8790)

Fix #8790 

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Sripradha Karkala <sripradha.karkala@nutanix.com>
2021-06-27 13:29:16 +00:00
Bruno Oliveira
ef395e1c38 Merge pull request #8799 from pytest-dev/update-plugin-list/patch-cb1dba048
[automated] Update plugin list
2021-06-27 00:17:59 -03:00
pytest bot
f0e5640497 [automated] Update plugin list 2021-06-27 00:08:04 +00:00
Florian Bruhin
cb1dba0489 doc: Add new open trainings (#8793) 2021-06-24 20:21:22 +02:00
Bruno Oliveira
0d6cb3b281 Allow prereleases from prepare-release workflow (#8628)
Fix #7551
2021-06-24 18:05:56 +00:00
Ronny Pfannschmidt
d7b0e17205 issue a warning when Item and Collector are used in diamond inheritance (#8447)
* issue a warning when Items and Collector form a diamond

addresses #8435

* Apply suggestions from code review

Co-authored-by: Ran Benita <ran@unusedvar.com>

* Return support for the broken File/Item hybrids

* adds deprecation
* ads necessary support code in node construction

* fix incorrect mypy based assertions

* add docs for deprecation of Item/File inheritance

* warn when a non-cooperative ctor is encountered

* use getattr instead of cast to get the class __init__ for legacy ctors

* update documentation references for node inheritance

* clean up file+item inheritance test

enhance docs
move import upwards

Co-authored-by: Ran Benita <ran@unusedvar.com>
2021-06-24 11:45:32 +02:00
James Bourbeau
942789bace Fix API links in 'How to capture warnings' documentation page (#8792) 2021-06-23 19:34:48 +00:00
Florian Bruhin
f573b56bb6 Improve cache test and fix it in Docker (#8785)
* cache: Move repetitive code to fixture

* cache: Explicitly test for chmod result

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lint

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-06-23 20:28:09 +02:00
Florian Bruhin
e44300de7e doc: Add history page (#8784)
Based on #8667
2021-06-23 20:26:08 +02:00
Ronny Pfannschmidt
8eb8c42bd6 Merge pull request #8786 from The-Compiler/outside
tests: Use less conflicting name for directory
2021-06-22 21:59:52 +02:00
Florian Bruhin
ac10fe0679 tests: Use less conflicting name for directory
Otherwise, if e.g. /outside is used for a Docker container, the test will fail
2021-06-22 13:25:52 +02:00
Bruno Oliveira
0a6a1fa225 Merge pull request #8782 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.2.0
Bump anyio[curio,trio] from 3.1.0 to 3.2.0 in /testing/plugins_integration
2021-06-21 07:41:15 -03:00
dependabot[bot]
d2886b8d23 Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.1.0...3.2.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-21 03:01:37 +00:00
Bruno Oliveira
68b329dda8 Merge pull request #8764 from pytest-dev/pre-commit-ci-update-config 2021-06-20 12:27:03 -03:00
Anthony Sottile
ab3cd644dc add temporary ignore for FileHandler stream close 2021-06-20 08:09:18 -07:00
Anthony Sottile
a1967e9594 fix overload of __getitem__ for Traceback 2021-06-19 21:41:00 -07:00
Anthony Sottile
c4da6fff42 Add missing types-* stub packages 2021-06-19 21:31:17 -07:00
pre-commit-ci[bot]
605fe29d12 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.5b2 → 21.6b0](https://github.com/psf/black/compare/21.5b2...21.6b0)
- [github.com/asottile/pyupgrade: v2.19.1 → v2.19.4](https://github.com/asottile/pyupgrade/compare/v2.19.1...v2.19.4)
- [github.com/pre-commit/pygrep-hooks: v1.8.0 → v1.9.0](https://github.com/pre-commit/pygrep-hooks/compare/v1.8.0...v1.9.0)
- [github.com/pre-commit/mirrors-mypy: v0.812 → v0.902](https://github.com/pre-commit/mirrors-mypy/compare/v0.812...v0.902)
2021-06-14 17:42:33 +00:00
Bruno Oliveira
ced125ad15 Merge pull request #8761 from nicoddemus/version-tuple 2021-06-14 09:27:22 -03:00
Bruno Oliveira
7eb0792cba Add pytest.version_tuple
This adds `pytest.version_tuple`, which makes it simpler for users to do something depending on the pytest version, such as declaring hooks which are introduced in later versions.

This feature was added originally in https://github.com/pypa/setuptools_scm/pull/475.

Followup to https://github.com/pytest-dev/pytest/pull/7605.
2021-06-14 09:04:14 -03:00
Bruno Oliveira
6447ca5f1e Merge pull request #8756 from pytest-dev/update-plugin-list/patch-c675d8054
[automated] Update plugin list
2021-06-13 00:56:20 -03:00
pytest bot
5ea541d415 [automated] Update plugin list 2021-06-13 00:10:04 +00:00
Bruno Oliveira
c675d8054d Merge pull request #8754 from nicoddemus/fix-deprecation-docs 2021-06-12 12:52:29 -03:00
Bruno Oliveira
16685dc279 Change os.getuid() guard in tmpdir.py
This matches the guard used by typeshed and avoid mypy errors on Windows:

48a346920b/stdlib/os/__init__.pyi (L388)
2021-06-12 12:31:58 -03:00
Bruno Oliveira
c85b21eaa0 Remove outdated docs about pytest.warns and DeprecatedWarning
Since #2908, the user doesn't need to set warning filters to capture
`DeprecationWarning` with `pytest.warns`.

Fix #8666
2021-06-12 12:09:26 -03:00
Bruno Oliveira
fb7e36b2f7 Merge pull request #8735 from pytest-dev/update-plugin-list/patch-8300b266a
[automated] Update plugin list
2021-06-12 10:49:02 -03:00
Anthony Sottile
c94766a580 Merge pull request #8738 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.4.0
Bump pytest-django from 4.3.0 to 4.4.0 in /testing/plugins_integration
2021-06-10 17:42:34 -07:00
dependabot[bot]
85faaf8a1d Bump pytest-django from 4.3.0 to 4.4.0 in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.3.0...v4.4.0)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 00:18:17 +00:00
Anthony Sottile
5a9139c5ec Merge pull request #8739 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-2.12.1
Bump pytest-cov from 2.12.0 to 2.12.1 in /testing/plugins_integration
2021-06-10 17:17:18 -07:00
dependabot[bot]
b04aa015b9 Bump pytest-cov from 2.12.0 to 2.12.1 in /testing/plugins_integration
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.12.0...v2.12.1)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-10 23:10:22 +00:00
Anthony Sottile
657e35618f Merge pull request #8737 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2.4
Bump django from 3.2.3 to 3.2.4 in /testing/plugins_integration
2021-06-10 16:09:40 -07:00
Bruno Oliveira
8010fb9f40 Merge pull request #8749 from beniwohli/fix-at-level-type-hints
updated type hints for caplog.at_level to match caplog.set_level
2021-06-10 19:33:35 -03:00
Benjamin Wohlwend
58036d463d updated type hints for caplog.at_level to match caplog.set_level
The underlying logging API accepts the log level both as int and
as string.
2021-06-10 09:34:54 +02:00
Bruno Oliveira
992eabc29e Merge pull request #8747 from asottile/typo-fix
Fix typo in fixture.rst
2021-06-09 19:54:23 -03:00
Jason Haugen
479209bde1 Fix typo in fixture.rst
Example referenced the wrong function name
2021-06-09 15:13:48 -07:00
Bruno Oliveira
68bb0db808 Merge pull request #8742 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-06-09 17:23:14 -03:00
pre-commit-ci[bot]
595b7e894c [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.19.0 → v2.19.1](https://github.com/asottile/pyupgrade/compare/v2.19.0...v2.19.1)
2021-06-08 01:55:19 +00:00
dependabot[bot]
bce0ceafe4 Bump django from 3.2.3 to 3.2.4 in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.3 to 3.2.4.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.3...3.2.4)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 03:01:43 +00:00
pytest bot
50b166ff0b [automated] Update plugin list 2021-06-06 00:17:08 +00:00
Bruno Oliveira
8300b266a8 Merge pull request #8732 from domdfcoding/patch-1
Fix typo (setupttools -> setuptools)
2021-06-05 15:10:24 -03:00
Dominic Davis-Foster
7fb5a9d033 Fix typo (setupttools -> setuptools) 2021-06-05 16:03:59 +01:00
Anthony Sottile
bb9683deea Merge pull request #8729 from asottile/revert-traceback-frame
Revert "Merge pull request #8227 from encukou/defensive-get_source"
2021-06-03 12:46:53 -07:00
Anthony Sottile
77235e2759 Revert "Merge pull request #8227 from encukou/defensive-get_source"
This reverts commit 67af623d9e, reversing
changes made to aead41e449.
2021-06-03 08:45:57 -07:00
Florian Bruhin
9ad726a9a0 Switch to irc.libera.chat (#8722) 2021-06-01 17:34:29 +02:00
Bruno Oliveira
cde6920e49 Merge pull request #8719 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-05-31 16:34:45 -03:00
pre-commit-ci[bot]
c51520ab2a [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.5b1 → 21.5b2](https://github.com/psf/black/compare/21.5b1...21.5b2)
- [github.com/asottile/pyupgrade: v2.18.2 → v2.19.0](https://github.com/asottile/pyupgrade/compare/v2.18.2...v2.19.0)
2021-05-31 17:32:52 +00:00
Bruno Oliveira
360ce686f1 Merge pull request #8713 from pytest-dev/update-plugin-list/patch-43faea832
[automated] Update plugin list
2021-05-31 10:54:38 -03:00
Bruno Oliveira
7ce69347ce Merge pull request #8717 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-10.0
Bump pytest-rerunfailures from 9.1.1 to 10.0 in /testing/plugins_integration
2021-05-31 09:30:19 -03:00
Bruno Oliveira
788d8785ce Merge pull request #8718 from dlax/docs/tmpdir_factory
Fix a typo in documentation about tmpdir_factory
2021-05-31 09:22:26 -03:00
Denis Laxalde
cf7425d22b Fix a typo in documentation about tmpdir_factory
The section refers to tmpdir_factory, but the sentence mentionned
tmp_path_factory.
2021-05-31 09:36:18 +02:00
dependabot[bot]
20f00997ff Bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 9.1.1 to 10.0.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/9.1.1...10.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-31 03:01:08 +00:00
pytest bot
4b7d8b2edd [automated] Update plugin list 2021-05-30 00:23:19 +00:00
Bruno Oliveira
43faea832d Merge pull request #8704 from offbyone/doc-getting-started-test-instance
Make the test class instance behaviour clearer
2021-05-26 18:42:37 -03:00
Bruno Oliveira
798bca4076 Merge pull request #8705 from MapleCCC/main
Fix cyclic links in goodpractices.rst
2021-05-26 18:41:13 -03:00
MapleCCC
627b446252 Fix cyclic links in goodpractices.rst 2021-05-27 04:33:49 +08:00
Chris Rose
640b2c0e13 Make the test class instance behaviour clearer
In the "Getting Started" doc, the test class instance example for
instance sharing doesn't actually demonstrate anything about the
reinstantiation of the class. This change shows clearly how the instance
data isn't retained between test runs.
2021-05-26 09:12:29 -07:00
Florian Bruhin
1d5ee4dd7c doc: Remove training sidebar (#8701) 2021-05-26 14:15:00 +02:00
Ran Benita
1ba5b48565 Merge pull request #8697 from bluetech/expose-config
config: expose Config and PytestPluginManager for typing purposes
2021-05-26 11:20:42 +03:00
Ran Benita
1b5f5326d7 Merge pull request #8695 from bluetech/export-parser
argparsing: export Parser and OptionGroup for typing purposes
2021-05-26 11:20:03 +03:00
pre-commit-ci[bot]
c5bf5f6fb0 [pre-commit.ci] pre-commit autoupdate (#8699)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v2.16.0 → v2.18.2](https://github.com/asottile/pyupgrade/compare/v2.16.0...v2.18.2)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-05-26 11:19:45 +03:00
Ran Benita
ef9d01826a Merge pull request #8693 from pytest-dev/update-plugin-list/patch-c198a7a67
[automated] Update plugin list
2021-05-24 19:14:03 +03:00
Ran Benita
847d8f42ea Merge pull request #8696 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.1.0
Bump anyio[curio,trio] from 3.0.1 to 3.1.0 in /testing/plugins_integration
2021-05-24 19:13:20 +03:00
Ran Benita
e6ed28f0e7 Merge pull request #8694 from bluetech/rec-eval-wrapper
code: remove unneeded comparison eval wrapper
2021-05-24 19:12:56 +03:00
Ran Benita
9719237fe6 doc: refer to type by its public name 2021-05-24 12:31:28 +03:00
Ran Benita
c0d525e44c config: expose PytestPluginManager for typing purposes
This type is used in hooks and transitively through `Config`.
2021-05-24 12:27:07 +03:00
Ran Benita
88d84a5791 config: expose Config for typing purposes
This type is used in hooks and fixtures.

The constructor is publicly documented so is not marked private.
2021-05-24 12:26:22 +03:00
dependabot[bot]
4a472952f7 Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.0.1 to 3.1.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.0.1...3.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 03:01:18 +00:00
Ran Benita
538b5c2499 argparsing: export Parser and OptionGroup for typing purposes
`Parser` is used by many plugins and custom hooks. `OptionGroup` is
exposed by the `parser.addgroup` API.

The constructors of both are marked private, they are not meant to be
constructed directly.
2021-05-24 00:52:03 +03:00
Ran Benita
c90fdc684b code: remove unneeded comparison eval wrapper
Given a `RecursionError` traceback, the `Traceback.recursionindex()`
method returns the index of the frame which started the recursion
(repeated set of frames). To do so it attempts to check whether two
frames are equivalent. Just checking the function/line is not enough
because the recursion variable(s) might differ (e.g. imagine the numeric
value in a recursive factorial implementation). So it also compares the
`f_locals` (local variables) of each frame for equivalence.

For some reason, the locals comparison is wrapped in an `eval` whose
purpose is to evaluate the comparison in one of the compared frame's
context (locals + globals in scope). However, I can not think of any way
in which the global scope could affect the evaluation. It would have an
affect when the locals are bound but that's already done. So this seems
unnecessary - remove it.
2021-05-23 20:59:38 +03:00
pytest bot
11538e35e4 [automated] Update plugin list 2021-05-23 00:12:33 +00:00
Zac Hatfield-Dodds
c198a7a67e Merge pull request #8677 from olgarithms/warns-no-arg-catches-any 2021-05-19 17:47:39 +10:00
Ran Benita
ff6d29717c Merge pull request #8681 from bluetech/ci-permissions
ci: few security/permissions improvements
2021-05-18 22:21:25 +03:00
Ran Benita
864a2bc0a3 ci: use GitHub Actions token instead of chatops/release_notes secrets
It seems more secure to use the controlled & limited token than an
ambient secret.
2021-05-18 16:05:14 +03:00
Ran Benita
6bc6ec323a ci: reduce workflow permissions
Decrease security exposure by restricting what the code executing in the
actions is allowed to do (in terms of GitHub operations).
2021-05-18 16:05:14 +03:00
Ran Benita
e2567a680e scripts: improve upload-coverage.sh
Mostly, verify the bash uploader hash and make it more strict and
verbose.
2021-05-18 16:05:14 +03:00
Anthony Sottile
d52cd08757 Merge pull request #8687 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-05-17 22:11:31 -07:00
pre-commit-ci[bot]
249c5b37dd [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v3.4.0 → v4.0.1](https://github.com/pre-commit/pre-commit-hooks/compare/v3.4.0...v4.0.1)
- [github.com/asottile/pyupgrade: v2.15.0 → v2.16.0](https://github.com/asottile/pyupgrade/compare/v2.15.0...v2.16.0)
2021-05-17 17:29:57 +00:00
Bruno Oliveira
0d502328ea Merge pull request #8653 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.6.1 2021-05-17 08:21:42 -03:00
dependabot[bot]
53a74feea7 Bump pytest-mock from 3.6.0 to 3.6.1 in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.6.0 to 3.6.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.6.0...v3.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:53:38 +00:00
Bruno Oliveira
88944bec6a Merge pull request #8684 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.3.0
Bump pytest-django from 4.2.0 to 4.3.0 in /testing/plugins_integration
2021-05-17 07:52:55 -03:00
dependabot[bot]
8872e8e7c7 Bump pytest-django from 4.2.0 to 4.3.0 in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:51:47 +00:00
Bruno Oliveira
eb7acba9e9 Merge pull request #8683 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2.3
Bump django from 3.2.2 to 3.2.3 in /testing/plugins_integration
2021-05-17 07:51:36 -03:00
Bruno Oliveira
e59d0c461b Merge pull request #8682 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-2.12.0
Bump pytest-cov from 2.11.1 to 2.12.0 in /testing/plugins_integration
2021-05-17 07:51:24 -03:00
Olga Matoula
3f414d7bbe Ignore depredcated warns(None) overload errors from mypy 2021-05-17 09:50:59 +01:00
Olga Matoula
dd8ad3fa9c Split warns matching string in multiple lines 2021-05-17 09:23:08 +01:00
dependabot[bot]
06718da5d6 Bump django from 3.2.2 to 3.2.3 in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.2...3.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 03:01:19 +00:00
dependabot[bot]
c73e354019 Bump pytest-cov from 2.11.1 to 2.12.0 in /testing/plugins_integration
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.11.1 to 2.12.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.11.1...v2.12.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 03:01:15 +00:00
Olga Matoula
2414d23c78 Remove default arg from overloaded warns 2021-05-16 13:44:56 +01:00
Olga Matoula
24ad886b15 Remove the option to pass None in warns() 2021-05-16 12:10:32 +01:00
Olga Matoula
dbe66d97b4 Add better warning msg for deprecated warns(None) 2021-05-16 12:07:39 +01:00
Bruno Oliveira
b8f1b7cdc6 Merge pull request #8680 from pytest-dev/update-plugin-list/patch-c516dba
[automated] Update plugin list
2021-05-15 23:47:35 -03:00
pytest bot
a69ed66c2e [automated] Update plugin list 2021-05-16 00:10:52 +00:00
pre-commit-ci[bot]
6ae71a2c2b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-05-15 17:51:55 +00:00
Olga Matoula
8b2f83772d Catch any warning on warns with no arg passed 2021-05-15 18:50:39 +01:00
Rahul Kumaresan
c516dba69a add feature to view fixture source location in invocations with --fixtures-per-test option (#8626)
* add feature to view fixture source location in invocations with --fixtures-per-test option

* remove unrelated changes to show_fixtures_per_test::test_doctest_items

* eshew the extraneous else in _show_fixtures_per_test.write_fixture

* enable the accommodation of multi-line docstring with --fixtures-per-test option

* add feature to view fixture source location in invocations with --fixtures

* add colour encoding to fixture location paths

* add changelog for #8606 fixing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-05-14 14:38:55 +02:00
Zack Kneupper
33c6ad5bf7 Replace some for loops, and other minor changes (#8660)
* Replace for loop using the  operator

* Replace for loop with a generator expression inside any()

* Replace for loop with a dictionary comprehension

* Use list comprehension

* Simplify arguments for range()

* Change newfuncargs variable to in-line dictionary comprehension

* is_ancestor: return base.is_relative_to(query)

* Remove unneeded import of pathlib

* Try using PurePath

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Import PurePath on new line

* Revert and remove is_relative_to

Co-authored-by: Zachary Kneupper <zacharykneupper@Zacharys-MBP.lan>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-05-14 09:32:50 +02:00
Ran Benita
364bbe42fc Merge pull request #8649 from Saiprasad16/main
UPDATE LICENSE
2021-05-13 17:34:18 +03:00
Ran Benita
c5de274136 Merge pull request #8650 from pytest-dev/update-plugin-list/patch-3ae0103
[automated] Update plugin list
2021-05-13 17:33:22 +03:00
Ran Benita
850a844779 Merge pull request #8664 from hroncok/test_unittest-ignore_DeprecationWarning-from-twisted
Ignore DeprecationWarnings in test_trial_error
2021-05-13 17:27:43 +03:00
Miro Hrončok
51293de324 Ignore DeprecationWarnings in test_trial_error
Fixes https://github.com/pytest-dev/pytest/issues/8663
2021-05-12 13:38:19 +02:00
Saiprasad Kale
0d6e3b7005 Update AUTHORS 2021-05-11 16:39:25 +05:30
Zack Kneupper
045ad5ac2d Replaced if-else statements with ternary expression (#8658)
* Replace if-else with ternary expression

* assign out variable in readouterr() with ternary expression

* assign err variable in readouterr() with ternary expression

* Assign precision with ternary expression

* ternary expression for collected/collecting

* Assign thread_name with ternary expression

* Update AUTHORS

Co-authored-by: Zachary Kneupper <zacharykneupper@Zacharys-MBP.lan>
2021-05-11 11:52:55 +02:00
Ronny Pfannschmidt
7cec85a37d Merge pull request #8657 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-05-11 11:42:03 +02:00
Zack Kneupper
b4cd14aae3 Open log file in context manager (#8659)
Co-authored-by: Zachary Kneupper <zacharykneupper@Zacharys-MBP.lan>
2021-05-11 09:10:01 +00:00
James Gerity
822624c252 Update help text for --pdbcls to match behavior (closes #8655) (#8656)
* Clarify help text for --pdbcls

* Add changelog entry for --pdbcls
2021-05-11 09:04:50 +00:00
dependabot[bot]
0a07b71046 Bump django from 3.2 to 3.2.2 in /testing/plugins_integration (#8652)
Bumps [django](https://github.com/django/django) from 3.2 to 3.2.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2...3.2.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-11 10:44:32 +02:00
Zack Kneupper
48f14c48ea Remove unnecessary else clause in repr_failure() (#8661)
* Remove unnecessary else clause in repr_failure()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Zachary Kneupper <zacharykneupper@Zacharys-MBP.lan>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-05-11 10:36:36 +02:00
pre-commit-ci[bot]
c519dd64ed [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.4b2 → 21.5b1](https://github.com/psf/black/compare/21.4b2...21.5b1)
- [github.com/PyCQA/flake8: 3.9.1 → 3.9.2](https://github.com/PyCQA/flake8/compare/3.9.1...3.9.2)
- [github.com/asottile/pyupgrade: v2.14.0 → v2.15.0](https://github.com/asottile/pyupgrade/compare/v2.14.0...v2.15.0)
2021-05-10 20:25:55 +00:00
pytest bot
e0a3dc7bf8 [automated] Update plugin list 2021-05-09 00:05:23 +00:00
Saiprasad Kale
7caf47acc6 Update AUTHORS 2021-05-08 23:50:17 +05:30
Saiprasad Kale
337a729d95 Update license.rst 2021-05-08 23:45:20 +05:30
Saiprasad Kale
6b53714d57 Update conf.py 2021-05-08 23:43:33 +05:30
Saiprasad Kale
647ac4a79d Update LICENSE 2021-05-08 23:38:48 +05:30
Zac Hatfield-Dodds
3ae0103975 Merge pull request #8641 from rahul-kumi/fix/8548
add support for precision bit in LEVEL_NAME_FMT regex
2021-05-08 01:17:55 +10:00
Rahul Kumaresan
9e11d645b1 cleanup tests by removal of unused code elements 2021-05-07 17:56:35 +05:30
Rahul Kumaresan
80acc0ed6f fix test_coloredlogformatter_with_width_precision test 2021-05-07 16:25:19 +05:30
Rahul Kumaresan
1e3fcece6d enhance support for precision bit in LEVELNAME_FMT_REGEX regex 2021-05-07 16:16:40 +05:30
Ran Benita
886fd70e2a Merge pull request #8594 from bluetech/addini-paths
argparsing: support parser.addini(type="paths") which returns pathlib.Paths
2021-05-07 12:44:53 +03:00
Ross Vandegrift
124691122a Expand command line argument examples with validation examples (#8610)
* Expand command line argument examples with validation examples

This shows how to pass more detailed error messages back to the user when
they've provided an incorrect value for a custom command line option.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-05-07 10:48:46 +03:00
Ran Benita
113a860a1f argparsing: support parser.addini(type="paths") which returns pathlib.Paths 2021-05-07 09:58:51 +03:00
Rahul Kumaresan
4b6188b3b1 add support for precision bit in LEVEL_NAME_FMT regex 2021-05-07 00:45:52 +05:30
Anthony Sottile
634312b14a Merge pull request #8633 from The-Compiler/ci-colors
ci: Force colors on
2021-05-05 08:09:47 -07:00
Rahul Kumaresan
245eefafcf clarify documentation about tolerance setting in unittest.TestCase.assertAlmost() (#8614) 2021-05-05 14:23:39 +02:00
Florian Bruhin
adc197424d Merge pull request #8555 from The-Compiler/py310-fix
Fix Python 3.10 test issues
2021-05-05 14:21:40 +02:00
mobius-crypt
385988ca1a Updated (#8620) 2021-05-05 14:16:21 +02:00
Tarcísio Fischer
b7416f7abd Suggest numpy testing module on pytest approx docs (#8615)
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Tarcisio Fischer <tarcisio@esss.co>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-05-04 23:08:41 -03:00
Anthony Sottile
a62a28b4b8 Merge pull request #8635 from asottile/fix-release
fix a command in RELEASING.rst
2021-05-04 09:40:25 -07:00
Bruno Oliveira
2534b7725e Merge pull request #8634 from The-Compiler/tidelift
Add myself to tidelift
2021-05-04 13:40:08 -03:00
Anthony Sottile
27564e7768 Merge pull request #8636 from asottile/cherry-pick-release
cherry-pick release notes from 6.2.4
2021-05-04 09:32:02 -07:00
Anthony Sottile
915ff7640b Merge pull request #8632 from pytest-dev/release-6.2.4
Prepare release 6.2.4

(cherry picked from commit 15a45388fa)
2021-05-04 09:27:16 -07:00
Anthony Sottile
5ae2106059 fix a command in RELEASING.rst 2021-05-04 09:25:11 -07:00
Florian Bruhin
3f71d63067 ci: Force colors on
See #7443
2021-05-04 17:55:47 +02:00
Florian Bruhin
4fc67eea4f Add myself to tidelift 2021-05-04 17:46:35 +02:00
Florian Bruhin
382599287f Fix test_errors_in_xfail_skip_expressions on Python 3.10 2021-05-04 17:26:53 +02:00
Florian Bruhin
61be48b485 Fix test_collect_symlink_dir on Windows 2021-05-04 17:25:08 +02:00
Florian Bruhin
e354c5c919 Fix warning filters used in tests 2021-05-04 17:25:02 +02:00
Florian Bruhin
710446420c Adjust enum reprs for Python 3.10
Potential fix for #8546
2021-05-04 17:24:50 +02:00
Florian Bruhin
f1570dc038 Ignore various warnings from Python 3.10
https://github.com/benjaminp/six/issues/341
https://github.com/benjaminp/six/pull/352
https://github.com/pypa/setuptools/pull/2517
2021-05-04 17:24:50 +02:00
Anthony Sottile
2637ec3921 Merge pull request #8624 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-05-03 18:27:37 -07:00
alshapton
4e048e0827 8625 - small grammar fix (#8627) 2021-05-03 20:42:23 +00:00
pre-commit-ci[bot]
f772e5e2b3 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.4b0 → 21.4b2](https://github.com/psf/black/compare/21.4b0...21.4b2)
- [github.com/asottile/pyupgrade: v2.13.0 → v2.14.0](https://github.com/asottile/pyupgrade/compare/v2.13.0...v2.14.0)
2021-05-03 17:21:32 +00:00
Bruno Oliveira
9c4da3e7b6 Merge pull request #8622 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.0.1
Bump anyio[curio,trio] from 3.0.0 to 3.0.1 in /testing/plugins_integration
2021-05-03 09:32:52 -03:00
dependabot[bot]
f1a97512da Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.0.0...3.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-03 03:01:15 +00:00
Bruno Oliveira
9fa205290e [automated] Update plugin list (#8618)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2021-05-02 10:23:11 -03:00
pytest bot
8f49ffdb57 [automated] Update plugin list 2021-05-02 00:12:49 +00:00
Tarcísio Fischer
9d9b84d175 Improve pytest.approx error messages readability (Pull request) (#8429)
Improve pytest.approx error messages readability (Pull request)
2021-04-30 07:36:56 -03:00
Parth Patel
992c403fc8 Improve iterparentnodeids to consume / parts until the first :: (#8577)
* Fix issue where TestCase.setUpClass is not called for test methods with a / in its name by checking if there is ::  before the selected / or any :: after. Also added a test case for this.

* removed print statement that was added

* Change iterparentnodeids to consume / parts until the first ::. Then consider ::. Tests were changed to reflect this.

* Update changelog/8509.improvement.rst

Co-authored-by: Ran Benita <ran@unusedvar.com>
2021-04-29 17:02:43 +03:00
Anthony Sottile
2049ae271e Merge pull request #8596 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-04-26 10:45:08 -07:00
pre-commit-ci[bot]
f5c22a6b45 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 20.8b1 → 21.4b0](https://github.com/psf/black/compare/20.8b1...21.4b0)
- [github.com/asottile/reorder_python_imports: v2.4.0 → v2.5.0](https://github.com/asottile/reorder_python_imports/compare/v2.4.0...v2.5.0)
- [github.com/asottile/pyupgrade: v2.12.0 → v2.13.0](https://github.com/asottile/pyupgrade/compare/v2.12.0...v2.13.0)
2021-04-26 17:23:05 +00:00
Ran Benita
134d8f78d8 Merge pull request #8595 from nschloe/url-fixes
"fix" a couple of http -> https redirects
2021-04-26 20:05:32 +03:00
Nico Schlömer
9ef608ef76 "fix" a couple of http -> https redirects
Found with
urli-fix . -a http: -i pytest
2021-04-26 17:44:27 +02:00
Bruno Oliveira
1e2c2d972d Merge pull request #8588 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.15.1
Bump pytest-asyncio from 0.15.0 to 0.15.1 in /testing/plugins_integration
2021-04-26 10:44:01 -03:00
Bruno Oliveira
0d0e5ed74a Merge pull request #8589 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.0.0
Bump anyio[curio,trio] from 2.2.0 to 3.0.0 in /testing/plugins_integration
2021-04-26 10:43:55 -03:00
Bruno Oliveira
ff24dfbc9f Merge pull request #8590 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.6.0
Bump pytest-mock from 3.5.1 to 3.6.0 in /testing/plugins_integration
2021-04-26 10:43:41 -03:00
dependabot[bot]
8d93f6ff0b Bump pytest-mock from 3.5.1 to 3.6.0 in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.5.1 to 3.6.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.5.1...v3.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 03:01:18 +00:00
dependabot[bot]
11f6dc9de6 Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 2.2.0 to 3.0.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/2.2.0...3.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 03:01:15 +00:00
dependabot[bot]
5a7be03285 Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.15.0 to 0.15.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.15.0...v0.15.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 03:01:13 +00:00
Anthony Sottile
0341893512 Merge pull request #8584 from nicoddemus/pygments-testing-extra
Make pygments part of 'testing' extras
2021-04-24 19:55:13 -07:00
Anthony Sottile
67af623d9e Merge pull request #8227 from encukou/defensive-get_source
Make code.FormattedExcinfo.get_source more defensive
2021-04-24 19:42:53 -07:00
Bruno Oliveira
aead41e449 Merge pull request #8586 from pytest-dev/update-plugin-list/patch-35c8139
[automated] Update plugin list
2021-04-24 22:51:32 -03:00
pytest bot
788d445b7b [automated] Update plugin list 2021-04-25 00:20:16 +00:00
Bruno Oliveira
35c8139e09 Merge pull request #8575 from domdfcoding/domdfcoding-patch-1
Remove "upload_sphinx" section from setup.cfg
2021-04-24 11:02:58 -03:00
Bruno Oliveira
c9e30a7035 Make pygments part of 'testing' extras
Tests in test_terminalwriter depend on pygments being installed
to work, so it should be installed with the `testing` extras.
2021-04-24 10:11:47 -03:00
Miro Hrončok
0a75c8e57b Add a regression test for a more defensive code.FormattedExcinfo.get_source 2021-04-22 19:17:54 +02:00
Dominic Davis-Foster
f9d1fa4c4b Remove "upload_sphinx" section from setup.cfg
The `Sphinx-PyPI-upload` tool the section corresponds to hasn't been updated since 2009, and the new (c. 2018) PyPI doesn't support documentation uploads anyway.
2021-04-21 16:46:28 +01:00
Ran Benita
4764c85275 Merge pull request #8570 from soxofaan/main
Logging docs: fix reference to pytest.LogCaptureFixture.
2021-04-20 16:42:54 +03:00
Ran Benita
c772d6d6a3 Merge pull request #8563 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-04-20 16:28:01 +03:00
Ran Benita
e5292ed8dc Merge pull request #8561 from pytest-dev/update-plugin-list/patch-9078c3c
[automated] Update plugin list
2021-04-20 16:26:23 +03:00
Ran Benita
513247863a Merge pull request #8562 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.15.0
Bump pytest-asyncio from 0.14.0 to 0.15.0 in /testing/plugins_integration
2021-04-20 16:25:57 +03:00
Ran Benita
c7e146da0f Merge pull request #8567 from codingjoe/patch-1
Fix typos & missing commas in CONTRIBUTING.rst
2021-04-20 16:25:30 +03:00
Stefaan Lippens
7e82f6fc38 Logging docs: fix reference to pytest.LogCaptureFixture. 2021-04-20 15:21:30 +02:00
Johannes Maron
3cbbb0bb0d Fix typos & missing commas in CONTRIBUTING.rst 2021-04-20 12:30:27 +02:00
Miroslav Šedivý
fbe66244b8 Fix some typos, remove redundant words and escapes (#8564)
* doc: Fix typos, remove double words

* Remove redundant escapes in regex
2021-04-19 20:39:08 +00:00
pre-commit-ci[bot]
5d7fe91bd5 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 3.9.0 → 3.9.1](https://github.com/PyCQA/flake8/compare/3.9.0...3.9.1)
2021-04-19 17:11:11 +00:00
dependabot[bot]
fb35851440 Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.14.0...v0.15.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 03:01:33 +00:00
pytest bot
c117bc350e [automated] Update plugin list 2021-04-18 00:18:53 +00:00
Abdelrahman Elbehery
9078c3ce23 fix #8464 wrong root dir when -c is passed (#8537)
fix #8464 wrong root dir when -c is passed
2021-04-16 14:38:35 -03:00
Florian Bruhin
d2f3d40510 doc: Update open trainings (#8551) 2021-04-15 19:09:06 +02:00
Bruno Oliveira
af31c60db1 Merge pull request #8540 from hauntsaninja/assert310 2021-04-15 08:55:42 -03:00
Ran Benita
8dd64622ca Merge pull request #8538 from pytest-dev/update-plugin-list/patch-9653a0e
[automated] Update plugin list
2021-04-14 12:52:29 +03:00
Ran Benita
3c451751af Merge pull request #8542 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.2.0
Bump pytest-django from 4.1.0 to 4.2.0 in /testing/plugins_integration
2021-04-14 12:50:28 +03:00
Ran Benita
6152135c29 Merge pull request #8541 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2
Bump django from 3.1.8 to 3.2 in /testing/plugins_integration
2021-04-14 12:50:01 +03:00
pre-commit-ci[bot]
d200598de9 [pre-commit.ci] pre-commit autoupdate (#8547)
* [pre-commit.ci] pre-commit autoupdate

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2021-04-14 12:49:09 +03:00
Albert Villanova del Moral
4b214a6049 Add tmp_path_factory methods to the docs (#8550)
* Add tmp_path_factory methods to the docs

Add the methods of tmp_path_factory to the docs.

Currently, only the class description appears in the docs.

* Add tmpdir_factory methods to the docs
2021-04-14 12:06:35 +03:00
hauntsaninja
e3dc34ee41 fixup comments 2021-04-12 11:34:14 -07:00
dependabot[bot]
22a17dba4e Bump pytest-django from 4.1.0 to 4.2.0 in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.1.0...v4.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-12 03:01:33 +00:00
dependabot[bot]
e14bd4a480 Bump django from 3.1.8 to 3.2 in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.8 to 3.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.8...3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-12 03:01:30 +00:00
pre-commit-ci[bot]
da66f00413 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-04-11 22:44:33 +00:00
hauntsaninja
8be1628042 Fix assertion rewriting on Python 3.10
Fixes https://github.com/pytest-dev/pytest/issues/8539

This seems to have been the result of https://bugs.python.org/issue43798
2021-04-11 15:42:42 -07:00
pytest bot
67d61e56e9 [automated] Update plugin list 2021-04-11 00:20:34 +00:00
Ran Benita
9653a0e9f4 Merge pull request #8531 from pytest-dev/graingert-patch-1
fix pytest 6.2.3 #8414 changelog entry grammar
2021-04-10 19:05:19 +03:00
Bruno Oliveira
047c9603f6 Merge pull request #8535 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.8
Bump django from 3.1.7 to 3.1.8 in /testing/plugins_integration
2021-04-08 22:15:45 -03:00
Daniele Procida
70daa279a7 Further rationalised "how to invoke pytest" material. (#8536)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-04-08 21:19:30 -03:00
dependabot[bot]
207c07285f Bump django from 3.1.7 to 3.1.8 in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.7 to 3.1.8.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.7...3.1.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-08 20:05:44 +00:00
Thomas Grainger
97a61916a6 fix pytest 6.2.3 #8414 changelog entry grammar 2021-04-08 15:40:58 +01:00
Ronny Pfannschmidt
41a90cd9fe Merge pull request #8463 from RonnyPfannschmidt/workaround-8361
address #8361 - introduce hook caller wrappers that enable backward compat
2021-04-05 22:50:31 +02:00
Tadeu Manoel
b706a2c048 Fix error with --import-mode=importlib and modules containing dataclasses or pickle (#7870)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

Fixes #7856, fixes #7859
2021-04-05 17:10:03 -03:00
Anthony Sottile
366c36a168 Merge pull request #8522 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-04-05 10:52:33 -07:00
pre-commit-ci[bot]
0b299044d1 [pre-commit.ci] pre-commit autoupdate 2021-04-05 17:10:40 +00:00
Ran Benita
43b547a1cb Merge pull request #8521 from pytest-dev/update-plugin-list/patch-07c6b3f
[automated] Update plugin list
2021-04-04 13:40:37 +03:00
Ran Benita
00f4cfe403 Merge pull request #8520 from bluetech/cherry-pick-release
Cherry pick 6.2.3 release notes
2021-04-04 13:40:18 +03:00
pytest bot
f3337c1854 [automated] Update plugin list 2021-04-04 00:19:23 +00:00
Ran Benita
5d2fad5362 Merge pull request #8519 from pytest-dev/release-6.2.3
Prepare release 6.2.3

(cherry picked from commit 724e22cb00)
2021-04-04 01:08:26 +03:00
Ran Benita
07c6b3fb21 Merge pull request #8516 from bluetech/mktmp
Fix minor temporary directory security issue
2021-04-04 00:33:53 +03:00
Ran Benita
c49100cef8 tmpdir: prevent using a non-private root temp directory
pytest uses a root temp directory named `/tmp/pytest-of-<username>`. The
name is predictable, and the directory might already exists from a
previous run, so that's allowed.

This makes it possible for my_user to pre-create
`/tmp/pytest-of-another_user`, thus giving my_user control of
another_user's tempdir.

Prevent this scenario by adding a couple of safety checks. I believe
they are sufficient.

Testing the first check requires changing the owner, which requires
root permissions, so can't be unit-tested easily, but I checked it
manually.
2021-04-03 23:42:53 +03:00
Ran Benita
1278f8b97e tmpdir: fix temporary directories created with world-readable permissions
(Written for a Unix system, but might be applicable to Windows as well).

pytest creates a root temporary directory under /tmp, named
`pytest-of-<username>`, and creates tmp_path's and other under it.
/tmp is shared between all users of the system.

This root temporary directory was created with 0o777&~umask permissions,
which usually becomes 0o755, meaning any user in the system could list
and read the files, which is undesirable.

Use 0o700 permissions instead. Also for subdirectories, because the root
dir is adjustable.
2021-04-03 23:42:53 +03:00
Ran Benita
0dd1e5b4f4 pathlib: inline ensure_reset_dir()
This is only used in TempPathFactory.getbasetemp(). We'll be wanting
further control/care there, so move it into there.
2021-04-03 23:42:53 +03:00
Ran Benita
78122a5304 pathlib: remove useless temporary variable 2021-04-03 23:42:53 +03:00
Ronny Pfannschmidt
aa10bff750 fix deprecation test for path/fspath hook args 2021-04-03 14:51:36 +02:00
Ronny Pfannschmidt
53ebe34ca2 Apply suggestions from code review
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-04-03 12:46:50 +02:00
Ronny Pfannschmidt
deb5b5bd96 fix #8371: fix stack-level 2021-04-02 00:58:05 +02:00
Ronny Pfannschmidt
9c151a65c8 Merge pull request #8503 from pytest-dev/require_setuptools
monkeypatch.syspath_prepend: Skip fixup_namespace_packages if pkg_resources not imported
2021-04-01 21:49:29 +02:00
Miro Hrončok
778d2b2499 monkeypatch.syspath_prepend: Skip fixup_namespace_packages if pkg_resources not imported
Calling pkg_resources.fixup_namespace_packages() is only needed for packages
that use pkg_resources.declare_namespace() and hence they already imported
pkg_resources. When pkg_resources is not imported, we don't need to use it.

This avoids an unneeded runtime dependency on setuptools.
The code is tested by test_syspath_prepend_with_namespace_packages,
behavior should remain unchanged, hence no new test was added.

When people drop pkg_resources from sys.modules, they are on their own.
If someone has a actual use case making this valid to support,
they can come in and provide a test, a reference and a fix.
2021-04-01 20:24:21 +02:00
Mehera Emrich
0061ec5555 Fix typo (#8504) 2021-04-01 15:13:12 +02:00
Bruno Oliveira
b96e229c95 Fix plugin-list label in the docs (#8505)
Last time I "fixed" this I left a `\` at the start of the string
to avoid an initial newline, but didn't realize it was a raw string.

This should fix it now for good.
2021-04-01 15:12:46 +02:00
Ronny Pfannschmidt
bad1963697 fix #8361: address review/quality comments 2021-03-29 22:29:35 +02:00
Bruno Oliveira
ca4a7a085e Merge pull request #8496 from pytest-dev/update-plugin-list/patch-9052a9e
[automated] Update plugin list
2021-03-27 22:53:43 -03:00
pytest bot
bfdfab00dd [automated] Update plugin list 2021-03-28 00:18:38 +00:00
Ronny Pfannschmidt
9052a9e313 Merge pull request #8462 from RonnyPfannschmidt/main_fixup_followup
port the rest of the scripts/docs over to the main branch
2021-03-27 15:49:20 +01:00
Bruno Oliveira
c1bdff9e69 Merge pull request #8494 from nicoddemus/python-3.10 2021-03-27 11:32:31 -03:00
Bruno Oliveira
a7416a535a Add classifier for Python 3.10 and CHANGELOG entry 2021-03-27 11:13:16 -03:00
Bruno Oliveira
913cffa45f Add warnings filter for disutils deprecation
Deprecated in 3.10, scheduled for removal in 3.12
2021-03-27 11:13:16 -03:00
Bruno Oliveira
b2954e85d6 Adjust message for Python 3.10
Now the message includes the class name ("Skip.__init__() got multiple...").
2021-03-27 11:13:16 -03:00
Bruno Oliveira
878a51ef53 Merge pull request #8493 from pytest-dev/docs-fix
tweak documentation of report's sections attribute
2021-03-26 07:47:38 -03:00
Bruno Oliveira
d9f4cedf17 Merge pull request #8472 from bluetech/rm-unnecessary-py-path-4
testing: stop relying on comparing to py.path in fnmatcher tests
2021-03-26 07:43:37 -03:00
Bruno Oliveira
8c65a4f174 Configure support for Python 3.10 2021-03-26 07:33:24 -03:00
Bruno Oliveira
ddbc00d61e Merge pull request #8391 from nicoddemus/ellipsis-verbose-6682
Increase truncation threshold with -v, disable with -vv
2021-03-26 07:29:36 -03:00
Bruno Oliveira
c1e057065c Fix plugin-list label and script
This was changed during the current docs restructing and
we missed that it changed the label.
2021-03-26 07:13:52 -03:00
Bruno Oliveira
be8d63e33b Increase truncation threshold with -v, disable with -vv
Fix #6682
Fix #8403
2021-03-26 07:05:30 -03:00
Bruno Oliveira
9e8a6b6eeb Merge pull request #8477 from evildmp/evolutionary-documentation-restructure 2021-03-26 06:32:26 -03:00
wim glenn
76ab94e4a0 fix some bunk formatting in the CollectReport, and reword the description of the 'sections' attribute 2021-03-25 22:25:19 -05:00
Bruno Oliveira
8d21df0dc6 Merge pull request #8473 from pytest-dev/update-plugin-list/patch-35df3e6
[automated] Update plugin list
2021-03-25 17:36:25 -03:00
Bruno Oliveira
7dfaaa1e16 Merge pull request #8476 from symonk/cmdline-main-docs
Remove note on conftest.py files as part of pytest_cmdline_main hookspec
2021-03-25 17:23:24 -03:00
pre-commit-ci[bot]
f28421cc70 [pre-commit.ci] pre-commit autoupdate (#8480)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-03-23 19:05:19 +00:00
Daniele Procida
a7d528e058 Restructured 'How to invoke pytest' guide 2021-03-22 22:47:13 +00:00
Simon K
a6cf0a0a0e rename master to main in PULL_REQUEST_TEMPLATE.md (#8481) 2021-03-22 22:06:46 +00:00
Florian Bruhin
bc055e8e69 Fix required_plugins with prereleases (#8469)
* Fix required_plugins with prereleases

Fixes #8456

* Fix existing tests

* Update changelog/8456.bugfix.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-03-21 22:51:12 +01:00
symonk
42ece0ca81 remove conftest note on pytest_cmdline_main, the hook is invoked 2021-03-21 20:06:18 +00:00
pytest bot
3add1a4d0f [automated] Update plugin list 2021-03-21 00:50:28 +00:00
Ronny Pfannschmidt
7ac7610089 add tresting for implication 2021-03-20 23:44:36 +01:00
Ronny Pfannschmidt
4ddf6c647c test warnings and fix invocation bugs 2021-03-20 23:39:38 +01:00
Ronny Pfannschmidt
2994022753 reshape typing for hook invocation proxying 2021-03-20 23:02:03 +01:00
Ronny Pfannschmidt
a550db4b6c drop internal py.path.local objects from hook calls 2021-03-20 21:50:40 +01:00
Ran Benita
945cc0b5a1 testing: stop relying on comparing to py.path in fnmatcher tests 2021-03-20 21:58:45 +02:00
Ronny Pfannschmidt
30f1b81eb2 address #8361 - introduce hook caller wrappers that enable backward compat 2021-03-18 23:08:03 +01:00
Ronny Pfannschmidt
ff6d5ae278 port the rest of the scripts/docs over to the main branch 2021-03-18 22:13:12 +01:00
Bruno Oliveira
35df3e68d5 Merge pull request #8459 from bluetech/unnecessary-py-path-3 2021-03-18 09:05:45 -03:00
Jürgen Gmach
fb481c7e6f fix typo (#8460) 2021-03-18 12:34:01 +01:00
Ran Benita
4690e4c510 reports: support any PathLike instead of only Path, py.path
The goal is to avoid referring to the legacy py.path.
2021-03-18 10:23:48 +02:00
Ran Benita
202dd9f423 pytester: add & use our own copytree instead of py.path's
Fixes the TODO note.
2021-03-18 10:23:48 +02:00
Ran Benita
ccdadb64ea main: add Session.startpath, make Session.startdir a property that can be deprecated
Same as in Config.
2021-03-18 10:23:48 +02:00
Ran Benita
6a174afdfe terminal: move startdir attribute to a property that can be deprecated
Same as in Config.
2021-03-18 10:23:48 +02:00
Ran Benita
e515264eb1 Remove yet more unnecessary py.path uses 2021-03-18 10:23:48 +02:00
Ran Benita
fe215bda6b Merge pull request #8446 from bluetech/unnecessary-py-path-2
More py.path removal work
2021-03-18 10:20:59 +02:00
Ran Benita
f7efb9a01c Merge pull request #8455 from evildmp/evolutionary-documentation-restructure
Explicitly listed the four documentation sections on index.rst
2021-03-18 09:52:31 +02:00
Ronny Pfannschmidt
6071b2c647 Merge pull request #8449 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-03-17 15:09:46 +01:00
Kale Kundert
dd3709718d Merge pull request #8453 from encukou/rel-error-message
Fix value in error message about negative relative tolerance
2021-03-16 16:43:31 -04:00
Daniele Procida
6ab461f460 Explicitly listed the four documentation sections on index.rst 2021-03-16 20:26:05 +00:00
pre-commit-ci[bot]
da4abd1c82 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-03-16 19:10:55 +00:00
Petr Viktorin
43b451e95e Add tests for the error message 2021-03-16 20:09:17 +01:00
Petr Viktorin
1f131afb07 Fix value in error message about negative relative tolerance 2021-03-16 18:54:52 +01:00
Bruno Oliveira
2ce446a75f Merge pull request #8451 from evildmp/evolutionary-documentation-restructure 2021-03-16 10:52:49 -03:00
Daniele Procida
7781582d52 Restructured global TOC
* Changed "Table Of Contents" link to a plain heading.
* Removed Customize, API Reference, 3rd party plugins links altogether.
* Added an "About the project" heading
2021-03-15 23:20:55 +00:00
Daniele Procida
c83b05af6b Merge remote-tracking branch 'origin/main' into evolutionary-documentation-restructure 2021-03-15 22:28:50 +00:00
pre-commit-ci[bot]
584fd0f387 [pre-commit.ci] pre-commit autoupdate 2021-03-15 17:01:35 +00:00
Ran Benita
f0c7043138 Remove/replace some more unnecessary uses of py.path 2021-03-15 10:39:44 +02:00
Ran Benita
a03ee02817 config: make collect_ignore accept any PathLike
The main reason is to remove a reference to `py.path`.
2021-03-15 10:39:32 +02:00
Ran Benita
b26d1bb18f cacheprovider: add cache.mkdir() as a Path-returning replacement to makedir()
It is not possible to change a return type in a compatible way, so a new
method is added.
2021-03-15 10:39:31 +02:00
Daniele Procida
2641761c1c Merge pull request #8441 from evildmp/evolutionary-documentation-restructure
Moved more sections from reference to how-to.
2021-03-15 10:22:11 +02:00
Daniele Procida
64107be443 Amended plugin list script for moved file. 2021-03-14 22:44:20 +00:00
Daniele Procida
d171a3f52d Moved more sections from reference to how-to.
* re-ordered and grouped how-to guides in how-to landing page
* retitled moved documents appropriately
* separated writing plugins/writing hook functions into two documents
2021-03-14 19:33:43 +00:00
Ran Benita
63bc49de70 Merge pull request #8440 from bluetech/unnecessary-py-path
Remove/replace some unneeded usages of py.path
2021-03-14 15:56:07 +02:00
Ran Benita
59251e8a2a Remove/replace some unneeded usages of py.path 2021-03-14 14:12:28 +02:00
Bruno Oliveira
cdbeb03aef Merge pull request #8442 from pytest-dev/update-plugin-list/patch-ba0193a
[automated] Update plugin list
2021-03-14 07:18:15 -03:00
pytest bot
493b54e21e [automated] Update plugin list 2021-03-14 00:49:15 +00:00
Ran Benita
ba0193ad06 Merge pull request #8439 from bluetech/doc-tmpdir-reduce
doc/tmpdir: significantly reduce space dedicated to tmpdir/tmpdir_factory
2021-03-13 21:35:00 +02:00
Ran Benita
3075078498 Merge pull request #8438 from bluetech/setuptools-dash-deprecation
setup.cfg: fix setuptools dash-separator warnings
2021-03-13 20:56:13 +02:00
Ran Benita
ba7bd3d77c doc/tmpdir: significantly reduce space dedicated to tmpdir/tmpdir_factory
Emphasize tmp_path/tmp_path_factory and just note the legacy ones.
2021-03-13 20:44:23 +02:00
Ran Benita
8c350b9837 setup.cfg: fix setuptools dash-separator warnings
Warnings like this:

python3.9/site-packages/setuptools/dist.py:634: UserWarning: Usage of
dash-separated 'upload-dir' will not be supported in future versions.
Please use the underscore name 'upload_dir' instead
2021-03-13 20:30:24 +02:00
Bruno Oliveira
ef1308c23b Merge pull request #8407 from nicoddemus/type-annotations-description-8405
Add type annotations to the description instead of signature
2021-03-13 14:46:37 -03:00
Ran Benita
db539ed2b0 Merge pull request #8437 from bluetech/rm-typevar-prefix
Remove `_` prefix from TypeVars, expose ExceptionInfo
2021-03-13 19:01:29 +02:00
Bruno Oliveira
9fa6673222 Merge pull request #8434 from evildmp/evolutionary-documentation-restructure 2021-03-13 12:50:45 -03:00
Pierre Mourlanne
af9f27a874 Approx decimal sequence mapping (#8422) 2021-03-13 16:01:23 +02:00
Ran Benita
f2d65c85f4 code: export ExceptionInfo for typing purposes
This type is most prominent in `pytest.raises` and we should allow to
refer to it by a public name.

The type is not in a perfectly "exposable" state. In particular:

- The `traceback` property with type `Traceback` which is derived from
  the `py.code` API and exposes a bunch more types transitively. This
  stuff is *not* exported and probably won't be.

- The `getrepr` method which probably should be private.

But they're already used in the wild so no point in just hiding them
now.

The __init__ API is hidden -- the public API for this are the `from_*`
classmethods.
2021-03-13 15:59:44 +02:00
Ran Benita
96ef7d678b code: fix outdated reference in ExceptionInfo.exconly docstring
No such thing as `_pytest._code.AssertionError`, it's just the built-in
`AssertionError`.
2021-03-13 14:44:50 +02:00
Ran Benita
5bbfb4e058 Remove _ prefix from TypeVars which appear in public API
The prefixes make the API Reference docs (for e.g. `pytest.raises`,
`pytest.fixture`) uglier.

Being under `_pytest` is sufficient from a privacy perspective, so let's
drop them.
2021-03-13 14:44:50 +02:00
Daniele Procida
dd576509e1 Merge branch 'main' into evolutionary-documentation-restructure 2021-03-13 12:09:36 +00:00
Bruno Oliveira
146eda93e7 Merge pull request #8436 from pytest-dev/doc-fix-toc
doc: fix broken links in left-hand TOC
2021-03-13 08:24:35 -03:00
Ran Benita
639c4e64a1 doc: fix broken links in left-hand TOC
Due to recent renamings.
2021-03-13 12:44:30 +02:00
Daniele Procida
843e9eac2c Added myself to AUTHORS 2021-03-12 23:14:18 +00:00
Daniele Procida
8410d9ac54 Created a new Explanation section and new landing pages for main sections.
Added landing pages for:

How-to guides
Reference guides
Explanation

Added links to the main landing pages to the sidebar.
2021-03-12 22:57:53 +00:00
Daniele Procida
ff2ee96b8c Split fixtures documentation into separate documents.
Sections have been moved to:

* reference/fixtures.rst
* how-to/fixtures.rst
* fixtures.rst

according to their function. Further refinement and rewriting will be required.

Some material has been moved to a new "Anatomy of a test" document, in
anticipation that material from other sections will also find a natural
home there later.

Removed several unneeded reference targets from fixtures documentation.
2021-03-12 22:16:47 +00:00
Bruno Oliveira
32ad70dea8 Merge pull request #8433 from evildmp/evolutionary-documentation-restructure
Added how-to and reference directories.
2021-03-11 19:26:09 -03:00
Daniele Procida
d8695410a4 Added how-to and reference directories.
Moved various documents into subdirectories, how-to and
reference.

Updated multiple links to use `:ref:` instead of `:doc:`,
meaning that files can henceforth be moved around without
breaking references.
2021-03-11 22:13:01 +00:00
Bruno Oliveira
4b7edef08f Merge pull request #8431 from evildmp/evolutionary-documentation-restructure
Moved documentation topics to group them by theme.
2021-03-11 16:32:16 -03:00
Daniele Procida
a362200d47 Moved documentation topics to group them by theme.
Reordered items in:

* _templates/globaltoc.html
* contents.rst
2021-03-11 17:22:54 +00:00
Ran Benita
2a789b9e3a Merge pull request #8409 from pytest-dev/update-plugin-list/patch-620e819
[automated] Update plugin list
2021-03-11 18:26:12 +02:00
Ran Benita
c9867bcc9d Merge pull request #8416 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-03-11 09:17:40 +02:00
Ran Benita
ce2ad8ebd4 Merge pull request #8430 from evildmp/evolutionary-documentation-restructure
Renamed Install to Getting started; moved notes to index.
2021-03-11 09:17:03 +02:00
Daniele Procida
d2d975d6cf Reworded titles of some clear how-to guides
Files retitled:

assert.rst
bash-completion.rst
capture.rst
existingtestsuite.rst
mark.rst
monkeypatch.rst
nose.rst
parametrize.rst
plugins.rst
skipping.rst
tmpdir.rst
usage.rst
2021-03-10 20:26:06 +00:00
Daniele Procida
4a19533ba5 Renamed Install to Getting started; moved notes to index 2021-03-10 19:20:32 +00:00
Ronny Pfannschmidt
bfbf733a3e Merge pull request #8425 from RonnyPfannschmidt/main-fixes
reconfigure everything for main
2021-03-09 22:54:01 +01:00
Ronny Pfannschmidt
dbed1ff68f adopt main terminology in the configs
ref pytest-dev/meta#8
2021-03-09 22:35:34 +01:00
Anthony Sottile
38d8deb74d Merge pull request #8419 from pytest-dev/all-repos_autofix_all-repos-manual
clean up mkdtemp usage
2021-03-09 07:04:32 -08:00
Anthony Sottile
7a6ec5616d clean up mkdtemp usage
Committed via https://github.com/asottile/all-repos
2021-03-08 19:12:08 -08:00
pre-commit-ci[bot]
ddde3266c6 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-03-08 16:55:59 +00:00
pre-commit-ci[bot]
125633728f [pre-commit.ci] pre-commit autoupdate 2021-03-08 16:54:31 +00:00
Anthony Sottile
79b03ce8db Merge pull request #8411 from RonnyPfannschmidt/example-outcomes-check
fix bug in test for issue 519
2021-03-07 08:17:34 -08:00
Bruno Oliveira
fc651fb158 Merge pull request #8251 from RonnyPfannschmidt/pathlib-node-path 2021-03-07 11:10:07 -03:00
Ronny Pfannschmidt
412fc001a0 fix bug in test for issue 519
assert the actual outcome and fix the filename
2021-03-07 15:01:39 +01:00
pytest bot
f0ad73c4b0 [automated] Update plugin list 2021-03-07 00:48:50 +00:00
Florian Bruhin
620e819656 Add enterPy training (#8396) 2021-03-06 22:59:33 +01:00
Ronny Pfannschmidt
77cb110258 drop usage of py.path.local calls
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-03-06 21:32:03 +01:00
Ronny Pfannschmidt
22dad53a24 implement Node.path as pathlib.Path
* reorganize lastfailed node sort

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-03-06 21:32:03 +01:00
Bruno Oliveira
7c792e96c6 Add type annotations to the description instead of signature
This configures Sphinx autodoc to include the type annotations
along with the description of the function/method, instead of including
it into the signature.

Fix #8405
2021-03-05 22:22:53 -03:00
Alexandros Tzannes
19a2f7425d Merge pull request #8399 from atzannes/master
closes #8394

Generated fixture names for unittest/xunit/nose should start with underscore
2021-03-04 22:45:57 +02:00
Ran Benita
6e7dc8bac8 Merge pull request #8357 from matthewhughes934/remove-tmpdir-from-tests
Remove tmpdir from tests
2021-03-04 18:34:19 +02:00
Florian Bruhin
c14a9adba3 Fix skip signature (#8392)
* Fix test_strict_and_skip

The `--strict` argument was removed in #2552, but the removal wasn't
actually correct - see #1472.

* Fix argument handling in pytest.mark.skip

See #8384

* Raise from None

* Fix test name
2021-03-04 11:56:21 +01:00
Bruno Oliveira
4dbb29431a Merge pull request #8385 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-03-02 17:33:55 -03:00
Bruno Oliveira
bc0af99e5e Merge pull request #8383 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-21.2.0
build(deps): bump twisted from 20.3.0 to 21.2.0 in /testing/plugins_integration
2021-03-02 17:33:35 -03:00
Bruno Oliveira
284b9dba9d Merge pull request #8382 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--2.2.0
build(deps): bump anyio[curio,trio] from 2.1.0 to 2.2.0 in /testing/plugins_integration
2021-03-02 17:33:09 -03:00
pre-commit-ci[bot]
decca74788 [pre-commit.ci] pre-commit autoupdate 2021-03-01 16:53:28 +00:00
dependabot[bot]
897b5a3bd6 build(deps): bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 20.3.0 to 21.2.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/twisted-21.2.0/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-20.3.0...twisted-21.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 03:02:50 +00:00
dependabot[bot]
62ef875796 build(deps): bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/2.1.0...2.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 03:02:48 +00:00
Bruno Oliveira
cd783eba03 Merge pull request #8376 from pytest-dev/update-plugin-list/patch-22c0dac
[automated] Update plugin list
2021-02-28 07:55:43 -03:00
pytest bot
a623b1b086 [automated] Update plugin list 2021-02-28 00:48:46 +00:00
Simon K
22c0dace3b change istestfunction to callable() (#8374) 2021-02-25 20:32:27 +00:00
Simon K
b7f2d7ca61 Fixed an issue where getpass.getuser() contained illegal characters for file directories (#8365)
* retry writing pytest-of dir when invalid chars are in directory name

* add unit tests for getbasetemp() and changelog

* patch _basetemp & _given_basetemp for testing basetemp()

* Tweak changelog for #8317, tidy up comments
2021-02-25 08:28:57 +00:00
Matthew Hughes
514f8e0680 fixup! Rename variables 'tmpdir'->'tmp_path' 2021-02-24 20:55:35 +00:00
Bruno Oliveira
bbea18d7f9 Merge pull request #8367 from The-Compiler/class-fromparent-kw 2021-02-23 16:25:14 -03:00
Bruno Oliveira
690fb26ec7 Merge pull request #8368 from The-Compiler/fromparent-changelog
Fix typo in changelog
2021-02-23 16:24:24 -03:00
Florian Bruhin
9d09d19911 Fix typo in changelog
See #7143
2021-02-23 18:03:10 +01:00
pre-commit-ci[bot]
3b7fc2c9c8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-02-23 17:02:50 +00:00
Florian Bruhin
54a154c86f Allow Class.from_parent to forward custom parameters to the constructor
Similarly to #7143, at work we have a project with a custom pytest.Class
subclass, adding an additional argument to the constructor.

All from_parent implementations in pytest accept and forward *kw, except
Class (before this change) and DoctestItem - since I'm not familiar with
doctest support, I've left the latter as-is.
2021-02-23 18:00:56 +01:00
Bruno Oliveira
d6522b517b Merge pull request #8364 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-02-22 18:36:43 -03:00
Bruno Oliveira
d37fe13af5 Merge pull request #8362 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.7
build(deps): bump django from 3.1.6 to 3.1.7 in /testing/plugins_integration
2021-02-22 17:36:58 -03:00
Bruno Oliveira
d76f7b3039 Merge pull request #8359 from pytest-dev/update-plugin-list/patch-4964b46
[automated] Update plugin list
2021-02-22 17:34:40 -03:00
pre-commit-ci[bot]
e503e27579 [pre-commit.ci] pre-commit autoupdate 2021-02-22 17:04:30 +00:00
dependabot[bot]
060cbef260 build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.6 to 3.1.7.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.6...3.1.7)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-22 03:01:27 +00:00
Matthew Hughes
c9bb4c418f fixup! Rename variables 'tmpdir'->'tmp_path'
* Add some more of these
* Also reintroduce+rename instances of fixture usages that were
'tmpdir'->'tmp_path'
2021-02-21 13:10:07 +00:00
pytest bot
56421aed01 [automated] Update plugin list 2021-02-21 00:46:01 +00:00
Matthew Hughes
09d4c5e30a Rename variables 'tmpdir'->'tmp_path'
Rename this variables reflecting the migrations made with 3bcd316f0 and
ed658d682
2021-02-20 18:24:58 +00:00
Matthew Hughes
0e5e4e03e6 Remove some unused 'tmpdir's 2021-02-20 18:01:42 +00:00
Ran Benita
4964b468c8 Merge pull request #8354 from feanil/patch-1
Remove a redundant paragraph
2021-02-20 17:19:54 +02:00
Feanil Patel
e6012612b9 Remove a redundant paragraph
doc This paragraph looks like it is a more verbose version of the sentence right above it.  Removing it doesn't reduce the amount of information here but does make the section flow a little better.
2021-02-19 13:46:29 -05:00
Ran Benita
a44dcf5ece Merge pull request #8351 from vpoulailleau/patch-1
Update number of plugins
2021-02-18 17:28:44 +02:00
Vincent Poulailleau
565fe0fb7d Update number of plugins
According to the source, there are 801 plugins now!
2021-02-18 15:27:39 +01:00
Bruno Oliveira
c9d623971a Merge pull request #8349 from maskypy40/patch-1
Removes 2 empty lines from example code
2021-02-18 08:16:54 -03:00
maskypy40
532543b4ef Remove empty lines from code-block
In assert.rst at line 175 and further there is an example of an assert encountering comparisons. The code-block for this example starts with a comment (line 177)  and then it has 2 empty lines. Comparing this example code (test_assert2.py) with the previously mentioned example code on the same page (i.e. test_assert1.py) you can see that there should not be 2 empty lines after the comment. These 2 empty lines are removed.
2021-02-17 09:33:04 +01:00
Ran Benita
ab2eb94054 Merge pull request #8345 from pytest-dev/update-plugin-list/patch-16e21c2
[automated] Update plugin list
2021-02-15 15:08:17 +02:00
pytest bot
a0ae5fd652 [automated] Update plugin list 2021-02-14 00:45:06 +00:00
Bruno Oliveira
16e21c22a3 Merge pull request #8336 from sbellem/typos/setup.cfg
Remove duplicate '>=' in setup.cfg
2021-02-11 07:53:02 -03:00
Sylvain Bellemare
3d831225bb Remove duplicate '>=' in setup.cfg 2021-02-10 22:17:39 +00:00
Anthony Sottile
92959fe236 Merge pull request #8329 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-02-08 09:38:02 -08:00
pre-commit-ci[bot]
6432fc2302 [pre-commit.ci] pre-commit autoupdate 2021-02-08 16:50:48 +00:00
Ran Benita
1003beaffa Merge pull request #8323 from bluetech/setupstate-refactor-3
runner: a few more tweaks to SetupState
2021-02-08 13:56:04 +02:00
Bruno Oliveira
f85427b92a Merge pull request #8326 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.6
build(deps): bump django from 3.1.5 to 3.1.6 in /testing/plugins_integration
2021-02-08 08:09:23 -03:00
Bruno Oliveira
e9d554c5f5 Merge pull request #8324 from pytest-dev/update-plugin-list/patch-bcfe253
[automated] Update plugin list
2021-02-08 08:04:16 -03:00
Bruno Oliveira
7b91302b33 Merge branch 'master' into dependabot/pip/testing/plugins_integration/django-3.1.6 2021-02-08 08:03:23 -03:00
Bruno Oliveira
ee5afb2a8f Merge pull request #8325 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--2.1.0
build(deps): bump anyio[curio,trio] from 2.0.2 to 2.1.0 in /testing/plugins_integration
2021-02-08 08:02:41 -03:00
dependabot[bot]
ef14f286a3 build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.5...3.1.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-08 03:02:01 +00:00
dependabot[bot]
e8d7a7b843 build(deps): bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 2.0.2 to 2.1.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/2.0.2...2.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-08 03:01:58 +00:00
Ronny Pfannschmidt
325d701f6e Merge pull request #8248 from RonnyPfannschmidt/mixin-mro-position
alter the PyObjMixin to carry over typing information from Node
2021-02-07 18:44:44 +01:00
pytest bot
3c6bd7eb27 [automated] Update plugin list 2021-02-07 00:44:13 +00:00
Ran Benita
5822888d73 runner: add clarifying comments on why runtestprotocol re-inits the FixtureRequest 2021-02-06 20:46:08 +02:00
Ran Benita
f42b68ccaa runner: rename SetupState.prepare -> setup
This is the usual terminology we use, and matches better with
`teardown_exact()` and `pytest_runtest_setup()`.
2021-02-06 20:46:08 +02:00
Ran Benita
f674f6da9f runner: add a safety assert to SetupState.prepare
This ensures that the teardown for the previous item was done properly
for this (next) item, i.e. there are no leftover teardowns.
2021-02-06 20:46:08 +02:00
Pax
bcfe253f5b Type annotation for request.param (#8319) 2021-02-05 22:03:58 +02:00
Bruno Oliveira
150bdceb7a Merge pull request #8322 from pytest-dev/fixture-docs
doc: Remove confusing fixture sentence
2021-02-05 15:11:17 -03:00
Florian Bruhin
c604f3f0c5 doc: Remove confusing fixture sentence
There is no previous `test_ehlo` example (it follows much later) - and the same thing is described further down in ""Requesting" fixtures" already.
2021-02-05 17:47:37 +01:00
Bruno Oliveira
ed8cabe4fd Merge pull request #8320 from nicoddemus/change-update-plugins-cron
Update plugin-list every Sunday instead of everyday
2021-02-05 07:48:31 -03:00
Bruno Oliveira
e3c0fd3203 Update plugin-list every Sunday instead of everyday
Every day seems a bit excessive lately, let's make it less frequent.
2021-02-05 07:29:12 -03:00
Bruno Oliveira
375e95180c Merge pull request #8318 from pytest-dev/update-plugin-list/patch-b3115c1
[automated] Update plugin list
2021-02-04 23:10:54 -03:00
pytest bot
16af1a31fd [automated] Update plugin list 2021-02-05 00:24:50 +00:00
Ran Benita
b3115c1b06 Merge pull request #8315 from bluetech/parser-proper-deprecation
config/argparsing: use proper deprecations instead of ad-hoc DeprecationWarning
2021-02-05 00:37:38 +02:00
Ran Benita
d358a060ad config/argparsing: use proper deprecations instead of ad-hoc DeprecationWarning
Proper for removing this in the next major pytest release.
2021-02-05 00:05:47 +02:00
Hong Xu
80c223474c Type annotation polishing for symbols around Pytester.run (#8298)
* Type annotation polishing for symbols around Pytester.run

Hopefully these will help document readers understand pertinent methods
and constants better.

Following up #8294

* Use NOTSET instead of object
2021-02-04 23:44:22 +02:00
Bruno Oliveira
bebb6953eb Merge pull request #8312 from matthewhughes934/add-regendoc-runs-for-fixture-docs 2021-02-04 15:50:48 -03:00
Matthew Hughes
709c211e68 Run regendoc over fixture docs
This is the result of running:

    $ cd doc/en && make regen REGENDOC_FILES=fixture.rst
2021-02-04 18:32:52 +00:00
Matthew Hughes
97cfd66806 Add regendoc runs for emaillib tests in fixture
Also update these tests ensure they pass, and be explicit about the test
file called in an existing test to avoid unintentional calls to the
added tests
2021-02-04 18:32:28 +00:00
Bruno Oliveira
287bab09a4 Merge pull request #8314 from pytest-dev/update-plugin-list/patch-275174e
[automated] Update plugin list
2021-02-04 11:54:29 -03:00
Bruno Oliveira
7c622d7462 Merge pull request #8316 from The-Compiler/training-update
doc: Remove past training
2021-02-04 10:02:02 -03:00
Florian Bruhin
b77f071bef doc: Remove past training 2021-02-04 11:40:28 +01:00
Ran Benita
3907856cb3 Merge pull request #8297 from pytest-dev/monkeypatch-docs
doc: Point out two-argument form of monkeypatch.setattr
2021-02-04 10:13:27 +02:00
pytest bot
1d895dd46c [automated] Update plugin list 2021-02-04 00:26:06 +00:00
Matthew Hughes
298541f540 Add basic emaillib for tests in fixture.rst
This will be used to power regendoc runs for later tests
2021-02-03 13:14:31 +00:00
Matthew Hughes
100c8deab5 Fix various typos in fixture docs 2021-02-03 13:14:31 +00:00
Bruno Oliveira
275174e147 Merge pull request #8308 from pytest-dev/update-plugin-list/patch-c26dddc
[automated] Update plugin list
2021-02-02 09:05:04 -03:00
Bruno Oliveira
3568df22b0 Merge pull request #8302 from pytest-dev/update-plugin-list/patch-ed8f424
[automated] Update plugin list
2021-02-02 08:43:51 -03:00
pytest bot
3165b1e323 [automated] Update plugin list 2021-02-02 00:31:11 +00:00
Bruno Oliveira
c26dddc651 Merge pull request #8306 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-02-01 17:37:14 -03:00
pre-commit-ci[bot]
1b2ca22e9b [pre-commit.ci] pre-commit autoupdate 2021-02-01 16:49:41 +00:00
pytest bot
5c61d60b0d [automated] Update plugin list 2021-02-01 00:32:44 +00:00
Ran Benita
ed8f424bcb Merge pull request #8299 from pytest-dev/update-plugin-list/patch-38a3e30
[automated] Update plugin list
2021-01-30 15:13:22 +02:00
Ran Benita
c971f2f474 ci: give pytest bot the credit for updating the plugin list 2021-01-30 13:04:10 +02:00
bluetech
de06f468ed [automated] Update plugin list 2021-01-30 00:30:28 +00:00
Florian Bruhin
f0f19aa8d9 doc: Point out two-argument form of monkeypatch.setattr
See the "for convenience" part here: https://docs.pytest.org/en/stable/reference.html#pytest.MonkeyPatch.setattr
2021-01-29 21:08:37 +01:00
Bruno Oliveira
38a3e30cd9 Merge pull request #8296 from bluetech/mypy-800-ignores
Remove some no longer needed type-ignores
2021-01-29 16:35:33 -03:00
Ran Benita
afea190797 Remove some no longer needed type-ignores 2021-01-29 20:40:43 +02:00
Hong Xu
07f0eb26b4 Doc: Clarify pytester.run (#8294)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-01-29 12:54:06 -03:00
Ran Benita
63ea727bc2 changelog: fix missing tick (#8295)
Messes with the rendering.
2021-01-29 16:21:25 +02:00
Maximilian Cosmo Sitter
beda7a8a31 Add plugin list 2021-01-29 16:19:54 +02:00
Ran Benita
0b510bcc51 changelog: fix missing tick
Messes with the rendering.
2021-01-29 16:06:36 +02:00
Bruno Oliveira
6a5d47a243 Merge pull request #8260 from nicoddemus/faulthandler-mode-X-8258 2021-01-28 13:03:24 -03:00
Bruno Oliveira
7b4ee65bdc Merge pull request #8284 from encukou/patch-1
Doc: Fix typo
2021-01-27 09:40:55 -03:00
Bruno Oliveira
0365b1be64 Merge pull request #8280 from xuhdev/module
Doc: Move the module declaration to index.rst
2021-01-27 09:05:36 -03:00
Petr Viktorin
56cea26445 Doc: Fix typo 2021-01-27 10:23:18 +01:00
Ran Benita
0939c3e022 Merge pull request #8279 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-01-26 11:17:58 +02:00
Hong Xu
8bb3977cb6 Doc: Move the module declaration to index.rst
When the declaration stays in reference.rst, it creates duplicated
"pytest" symbols such as `pytest.pytest.mark.filterwarnings`.
2021-01-26 00:48:01 -08:00
Bruno Oliveira
dfe933cdb4 Remove mypy workaround after 0.800 update 2021-01-25 15:23:13 -03:00
pre-commit-ci[bot]
6806091b93 [pre-commit.ci] pre-commit autoupdate 2021-01-25 16:41:17 +00:00
Bruno Oliveira
33861098d9 Only re-enable fauthandler during unconfigure if it was enabled before 2021-01-25 12:28:00 -03:00
Christian Steinmeyer
781b73bb52 Mention that class variables are shared between tests
Close #8252
2021-01-25 12:02:59 -03:00
Bruno Oliveira
f3efc4e049 Merge pull request #8277 from nicoddemus/cherry-pick-release
Merge pull request #8275 from pytest-dev/release-6.2.2
2021-01-25 12:02:49 -03:00
Bruno Oliveira
2a890286f8 Merge pull request #8275 from pytest-dev/release-6.2.2
Prepare release 6.2.2

(cherry picked from commit 8220eca963)
2021-01-25 11:53:05 -03:00
Ran Benita
fff9f28fdd Merge pull request #8272 from bluetech/setupstate-refactor-2
runner: avoid using node's store in SetupState
2021-01-25 16:00:05 +02:00
Bruno Oliveira
5cc295e74b Merge pull request #8273 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-2.11.1
build(deps): bump pytest-cov from 2.10.1 to 2.11.1 in /testing/plugins_integration
2021-01-25 09:12:14 -03:00
dependabot[bot]
83ee1a1f3b build(deps): bump pytest-cov in /testing/plugins_integration
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.10.1 to 2.11.1.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.10.1...v2.11.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 03:16:50 +00:00
Ran Benita
48fb989a71 runner: avoid using node's store in SetupState
SetupState maintains its own state, so it can store the exception
itself, instead of using the node's store, which is better avoided when
possible.

This also reduces the lifetime of the reference-cycle-inducing exception
objects which is never a bad thing.
2021-01-24 15:05:03 +02:00
Ran Benita
d5df8f99ab Merge pull request #8219 from bluetech/setupstate-refactor
runner: refactor SetupState
2021-01-24 14:51:58 +02:00
Ran Benita
c30feeef8b runner: add docstring to SetupState and improve variable naming a bit 2021-01-24 14:29:54 +02:00
Ran Benita
0d19aff562 runner: schedule node.teardown() call already at setup
This is more elegant.
2021-01-24 14:08:39 +02:00
Ran Benita
1db78bec31 runner: use insertion-ordered dict instead of stack, dict pair
Since dicts are now ordered, we can use the finalizers dict itself as
the dict, simplifying the code.
2021-01-24 14:08:39 +02:00
Ran Benita
03c3a90c68 runner: replace setdefault with an unconditional set
The already-exists case is not supposed to happen.
2021-01-24 14:08:39 +02:00
Ran Benita
960ebae943 runner: enable a commented assertion in SetupState.addfinalizer
The assertion ensures that when `addfinalizer(finalizer, node)` is
called, the node is in the stack. This then would ensure that the
finalization is actually properly executed properly during the node's
teardown. Anything else indicates something is wrong.

Previous commits fixed all of the tests which previously failed this, so
can be reenabeld now.
2021-01-24 14:08:39 +02:00
Ran Benita
6db082a448 fixtures: make sure to properly setup stack for _fill_fixtures_impl
This code is weird, dead, deprecated and will be removed in pytest 7,
but for now some tests execute it, so fix it up in preparation for
some changes.
2021-01-24 14:08:39 +02:00
Ran Benita
637300d13d testing: fix some tests to be more realistic
Perform the operations in the order and context in which they can
legally occur.
2021-01-24 14:08:39 +02:00
Ran Benita
c83d030028 testing/test_runner: make SetupState tests use a proper SetupState
Previously the tests (probably unintentionally) mixed a fresh SetupState
and the generated item Session's SetupState, which led to some serious
head scratching when prodding it a bit.
2021-01-24 14:08:39 +02:00
Ran Benita
0d4121d24b runner: collapse exception handling in SetupState.teardown_exact()
This is equivalent but simpler.
2021-01-24 14:08:39 +02:00
Ran Benita
bb3d43c9a6 runner: ensure item.teardown() is called even if a finalizer raised
If one finalizer fails, all of the subsequent finalizers still run, so
the `teardown()` method should behave the same.
2021-01-24 14:08:39 +02:00
Ran Benita
14d71b2c22 runner: make sure SetupState._finalizers is always set for a node in the stack
This makes the stack <-> _finalizers correspondence clearer.
2021-01-24 14:08:39 +02:00
Ran Benita
d1fcd425a3 runner: inline SetupState._pop_and_teardown()
This will enable a simplification in the next commit.
2021-01-24 14:08:39 +02:00
Ran Benita
2b14edb108 runner: express SetupState.teardown_all() in terms of teardown_exact() and remove it
Makes it easier to understand with fewer methods.
2021-01-24 14:08:39 +02:00
Ran Benita
ceb4d6f6d5 runner: inline a couple of SetupState methods
Code is clearer this way.
2021-01-24 14:08:39 +02:00
Ran Benita
5f4e55fb6d runner: remove dead code in teardown_all()
When the stack is empty, the finalizers which are supposed to be
attached to nodes in the stack really ought to be empty as well. So the
code here is dead. If this doesn't happen, the assert will trigger.
2021-01-24 14:08:39 +02:00
Ran Benita
42ae8180dd runner: inline SetupState._teardown_towards()
Doesn't add much.
2021-01-24 14:08:39 +02:00
Ran Benita
410622f719 runner: reorder SetupState method to make more sense
The setup stuff happens before the teardown stuff, so put it first so
that reading the code from top to bottom makes more sense.
2021-01-24 14:08:39 +02:00
Ran Benita
f7b0b1dd1f runner: use node's Store to keep private SetupState state instead of an attribute
This way it gets proper typing and decoupling.
2021-01-24 14:08:39 +02:00
Ran Benita
da70f61f67 runner: complete type annotations of SetupState 2021-01-24 14:08:39 +02:00
Hong Xu
d4f8e4b40c Explain how to create binary files in the doc of pytest.makefile. (#8255) 2021-01-21 09:58:52 -03:00
Bruno Oliveira
adc0f29b8f Always handle faulthandler stderr even if already enabled
It seems the code that would not install pytest's faulthandler support
if it was already enabled is not really needed at all, and even detrimental
when using `python -X dev -m pytest` to run Python in "dev" mode.

Also simplified the plugin by removing the hook class, now the hooks
will always be active so there's no need to delay the hook definitions anymore.

Fix #8258
2021-01-20 10:29:05 -03:00
Bruno Oliveira
bda9ce4e0f Merge pull request #8250 from daq-tools/fix-twisted-capture 2021-01-20 09:45:58 -03:00
Jeff Widman
eef2d1a8e2 Fix pep8 import order in docs (#8253) 2021-01-19 11:45:45 -03:00
Andreas Motl
9ba1821e91 Fix faulthandler for Twisted Logger when used with "--capture=no"
The Twisted Logger will return an invalid file descriptor since it is
not backed by an FD. So, let's also forward this to the same code path
as with `pytest-xdist`.
2021-01-18 17:51:08 +01:00
Ran Benita
7f782c72ba Merge pull request #8242 from bluetech/deprecate-unittest-skip-collection
Deprecate raising unittest.SkipTest to skip tests during collection
2021-01-18 17:46:00 +02:00
Ronny Pfannschmidt
a9e43152bc alter the PyObjMixin to carry over typing information from Node
as PyObjMixin is always supposed to be mixed in the mro
before nodes.Node the behavior doesn't change,
but all the typing information carry over to help mypy.

extracted from #8037
2021-01-17 14:36:28 +01:00
Ran Benita
c9e9a599fe Merge pull request #8241 from bluetech/skip-improvements
Minor code improvements in nose, unittest, skipping
2021-01-15 15:35:57 +02:00
Ran Benita
25e657bfc1 Deprecate raising unittest.SkipTest to skip tests during collection
It is not very clear why this code exists -- we are not running any
unittest or nose code during collection, and really these frameworks
don't have the concept of collection at all, and just raising these
exceptions at e.g. the module level would cause an error. So unless I'm
missing something, I don't think anyone is using this.

Deprecate it so we can eventually clear up this code and keep unittest
more tightly restricted to its plugin.
2021-01-15 00:05:33 +02:00
Ran Benita
7f989203ed Improve way in which skip location is fixed up when skipped by mark
When `pytest.skip()` is called inside a test function, the skip location
should be reported as the line that made the call, however when
`pytest.skip()` is called by the `pytest.mark.skip` and similar
mechanisms, the location should be reported at the item's location,
because the exact location is some irrelevant internal code.

Currently the item-location case is implemented by the caller setting a
boolean key on the item's store and the `skipping` plugin checking it
and fixing up the location if needed. This is really roundabout IMO and
breaks encapsulation.

Instead, allow the caller to specify directly on the skip exception
whether to use the item's location or not. For now, this is entirely
private.
2021-01-14 18:07:25 +02:00
Ran Benita
3dde519f53 nose: type annotate with some resulting refactoring 2021-01-14 17:42:38 +02:00
Ran Benita
096bae6c68 unittest: add clarifying comment on unittest.SkipTest -> pytest.skip code
I was tempted to remove it, until I figured out why it was there.
2021-01-14 17:06:14 +02:00
Ran Benita
addbd3161e nose,fixtures: use the public item API for adding finalizers 2021-01-14 16:53:07 +02:00
Anton
42d5545f42 unittest: cleanup unexpected success handling (#8231)
* unittest: cleanup unexpected success handling

* update comment
2021-01-13 17:02:26 -08:00
Bruno Oliveira
7a5a6cb51c Merge pull request #8235 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.5
build(deps): bump django from 3.1.4 to 3.1.5 in /testing/plugins_integration
2021-01-11 08:24:47 -03:00
Bruno Oliveira
203a9b3ab2 Merge pull request #8234 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.5.1
build(deps): bump pytest-mock from 3.4.0 to 3.5.1 in /testing/plugins_integration
2021-01-11 08:24:33 -03:00
dependabot[bot]
cfa0c3b0d9 build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.4...3.1.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-11 03:16:03 +00:00
dependabot[bot]
af78efc7fa build(deps): bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.4.0 to 3.5.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.4.0...v3.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-11 03:15:59 +00:00
Ran Benita
f6529fd3a1 Merge pull request #8232 from imrehg/doc
Add missing import into example script in documentation
2021-01-08 14:08:47 +02:00
Gergely Imreh
80c33c8178 Add missing import into example script in documentation 2021-01-08 11:43:51 +00:00
Petr Viktorin
78fb97105f Make code.FormattedExcinfo.get_source more defensive
When line_index was a large negative number, get_source failed
on `source.lines[line_index]`.
Use the same dummy Source as with a large positive line_index.
2021-01-06 13:33:33 +01:00
Bruno Oliveira
31ae4e1764 Merge pull request #8225 from The-Compiler/training-update
doc: Add note about training early bird discount
2021-01-05 16:31:04 -03:00
Florian Bruhin
65b8391ead doc: Add note about training early bird discount 2021-01-05 19:39:50 +01:00
Bruno Oliveira
329fff69a3 Merge pull request #8220 from xuhdev/module-doc
DOC: Mark pytest module
2021-01-05 13:25:02 -03:00
Ran Benita
5336ba28cc Merge pull request #8218 from bluetech/reports2
Misc small code improvements
2021-01-04 22:47:32 +02:00
bengartner
8e00df4c4b Add dot prefix if file makefile extension is invalid for pathlib (#8222) 2021-01-04 15:58:11 +02:00
Ran Benita
8d16bec329 Merge pull request #8216 from xuhdev/testdir-pytester
DOC: Update multiple references to testdir to pytester
2021-01-02 11:58:59 +02:00
Hong Xu
14b5f5e528 DOC: Mark pytest module
Pytest document currently does not index the top-level package name
`pytest`, which causes some trouble when building documentation that
cross-refers to the pytest package via ``:mod:`pytest` ``.
2021-01-02 00:34:52 -08:00
Ran Benita
2ff88098a7 python: inline a simple method
I don't think it adds much value!
2021-01-01 23:23:08 +02:00
Ran Benita
8ee6d0a866 Always use getfixturemarker() to access _pytestfixturefunction
Keep knowledge of how the marker is stored encapsulated in one place.
2021-01-01 23:22:10 +02:00
Ran Benita
ade253c790 fixtures: type annotate FixtureRequest.keywords 2021-01-01 23:18:17 +02:00
Ran Benita
6c575ad8c8 fixtures: simplify FixtureRequest._get_fixturestack() 2021-01-01 23:15:57 +02:00
Hong Xu
b02f1c8ae7 DOC: Update multiple references to testdir to pytester
In https://docs.pytest.org/en/stable/reference.html#testdir, it is
suggested:

> New code should avoid using testdir in favor of pytester.

Multiple spots in the documents still use testdir and they can be quite
confusing (especially the plugin writing guide).
2021-01-01 12:21:39 -08:00
Ran Benita
bbd22e1769 Merge pull request #8214 from sousajf1/sousajo_patch_8204_1
pytest-dev#8204 migrate tests on testing/code/test_source to tmp_path
2021-01-01 20:44:40 +02:00
sousajo
ac428f67eb pytest-dev#8204 migrate tests on testing/code/test_source to tmp_path 2021-01-01 16:55:03 +00:00
sousajf1
20c59e3aa4 pytest-dev#8204 migrate some tests to tmp_path fixture (#8209)
migrating some tests from tmpdir to tmp_path fixture
2021-01-01 17:25:11 +02:00
Ran Benita
73c4105230 reports: improve a type annotation 2021-01-01 15:22:05 +02:00
Ran Benita
7d306e9e86 reports: BaseReport.{passed,failed,skipped} more friendly to mypy
Not smart enough to understand the previous code.
2021-01-01 15:22:05 +02:00
mefmund
5f11a35b99 Add missing fixture (#8207)
Co-authored-by: Florian Bruhin <me@the-compiler.org>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-12-31 15:25:44 -03:00
Anton
48c9a96a03 Fix failing staticmethod tests if they are inherited (#8205)
* Fix failing staticmethod tests if they are inherited

* add comments, set default=None
2020-12-30 19:00:37 -08:00
Ran Benita
7585221d55 Merge pull request #8195 from christophebedard/add-missing-space-version-option-help-message
Add missing space in '--version' help message
2020-12-30 11:57:02 +02:00
pre-commit-ci[bot]
ee03e31831 [pre-commit.ci] pre-commit autoupdate (#8201)
* [pre-commit.ci] pre-commit autoupdate

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* manual fixes after configuration update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Anthony Sottile <asottile@umich.edu>
2020-12-30 11:56:09 +02:00
Ran Benita
7751904875 Merge pull request #8194 from bluetech/typing-public-3
Export pytest.Metafunc and pytest.Callinfo, hide NodeKeywords
2020-12-29 18:22:02 +02:00
Ran Benita
e772f02d15 Merge pull request #8188 from antonblr/subprocess-coverage
coverage: Include code that runs in subprocesses
2020-12-28 19:05:33 +02:00
Christophe Bedard
bf9b59b3c8 Add missing space in '--version' help message 2020-12-28 10:50:06 -05:00
antonblr
8550c29180 coverage: Include code that runs in subprocesses 2020-12-26 16:59:07 -08:00
Ran Benita
96ea867fec runner: export pytest.CallInfo for typing purposes
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.

This also documents `from_call` as public, because at least
pytest-forked uses it, so we must treat it as public already anyway.
2020-12-26 21:38:37 +02:00
Ran Benita
bd76042344 python: export pytest.Metafunc for typing purposes
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-26 21:05:02 +02:00
Ran Benita
6d3a66d947 nodes: avoid needing to expose NodeKeywords for typing
It adds no value over exporting just the ABC so do that to reduce the
API surface.
2020-12-26 19:54:07 +02:00
Ran Benita
d8d2df7e6f Merge pull request #8174 from bluetech/py-to-pathlib-5
More py.path -> pathlib conversions
2020-12-26 15:01:07 +02:00
Bruno Oliveira
da01ee0a4b Merge pull request #8185 from bluetech/revert-docs-pygments-workaround
Revert "doc: temporary workaround for pytest-pygments lexing error"
2020-12-22 20:36:29 -03:00
Bruno Oliveira
af5da977e3 Merge pull request #8187 from pytest-dev/asottile-patch-1
Add badge for pre-commit.ci
2020-12-22 20:08:01 -03:00
Anthony Sottile
35d6a7e78e Add badge for pre-commit.ci
See #8186
2020-12-22 14:57:04 -08:00
Ran Benita
5e323becb7 Revert "doc: temporary workaround for pytest-pygments lexing error"
Support was added in pytest-pygments 2.2.0.

This reverts commit 0feeddf8ed.
2020-12-22 21:15:27 +02:00
Ran Benita
ca4effc822 Convert most of the collection code from py.path to pathlib 2020-12-22 21:09:36 +02:00
Ran Benita
4faed28261 testing: convert some tmpdir to tmp_path
The tmpdir fixture (and its factory variant) is soft-deprecated in favor
of the tmp_path fixture.
2020-12-22 21:08:25 +02:00
Ran Benita
a218413008 pathlib: missing type annotation for fnmatch_ex 2020-12-22 21:08:25 +02:00
Ran Benita
170a2c5040 testing/test_config: check inipath instead of inifile
inifile is soft-deprecated in favor of inipath.
2020-12-22 21:08:25 +02:00
Ran Benita
8b220fad4d testing/test_helpconfig: remove unclear comment 2020-12-22 21:08:25 +02:00
Ran Benita
92ba96b061 code: convert from py.path to pathlib 2020-12-22 21:08:25 +02:00
Ran Benita
813ce45985 Merge pull request #8179 from bluetech/typing-public-mark
mark: expose Mark, MarkDecorator, MarkGenerator under pytest for typing purposes
2020-12-22 16:32:02 +02:00
Bruno Oliveira
d64706c33d Merge pull request #8180 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.4.0
build(deps): bump pytest-mock from 3.3.1 to 3.4.0 in /testing/plugins_integration
2020-12-21 09:38:00 -03:00
dependabot[bot]
1839713b71 build(deps): bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.3.1...v3.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-21 03:07:23 +00:00
Ran Benita
6aa4d1c7ab mark: export pytest.MarkGenerator for typing purposes
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-20 15:59:20 +02:00
Ran Benita
69c302479e mark: export pytest.MarkDecorator for typing purposes
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-20 15:59:06 +02:00
Ran Benita
2ec372df8b mark: export pytest.Mark for typing purposes
The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.
2020-12-20 15:58:49 +02:00
Ran Benita
7aa2240832 testing/test_nodes: fix fake session to be more accurate
The type of _initialpaths is `FrozenSet[Path]`.
2020-12-19 14:52:40 +02:00
Ran Benita
042d12fae6 doctest: use Path instead of py.path where possible 2020-12-19 14:52:40 +02:00
Ran Benita
2c05a7babb config: let main() accept any os.PathLike instead of just py.path.local
Really it ought to only take the List[str], but for backward
compatibility, at least get rid of the explicit py.path.local check.
2020-12-19 14:52:40 +02:00
Ran Benita
73586be08f terminal: remove unused union arm in WarningReport.fslocation 2020-12-19 13:33:34 +02:00
Ran Benita
89dcfbf293 Merge pull request #8168 from antonblr/testdir-to-pytester-incr2
tests: Migrate to pytester - final update
2020-12-19 13:32:20 +02:00
antonblr
196b173c8a address comments 2020-12-18 12:36:20 -08:00
antonblr
15156e94c4 tests: Migrate to pytester - final update 2020-12-18 11:02:38 -08:00
Anthony Sottile
f14ab08de3 Merge pull request #8172 from pytest-dev/revert-8171-fix-ci-setup-python
Use new pypy3 github actions syntax
2020-12-18 11:01:48 -08:00
Anthony Sottile
293a7c962d Use new pypy3 github actions syntax 2020-12-18 10:45:28 -08:00
Anthony Sottile
4da445dc2e Revert "infra: Temporary pin setup-python GH action to v2.1.4" 2020-12-18 10:44:20 -08:00
Bruno Oliveira
403424d60b Merge pull request #8171 from antonblr/fix-ci-setup-python
infra: Temporary pin setup-python GH action to v2.1.4
2020-12-18 08:02:44 -03:00
antonblr
1264404fe7 infra: Temporary pin setup-python GH action to v2.1.4 2020-12-17 21:01:20 -08:00
Adam Johnson
bd894e3065 Add Changelog to setup.cfg (#8166)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-12-17 13:55:36 -03:00
Bruno Oliveira
ce206ae462 Merge pull request #8162 from nicoddemus/rm-travis-badge 2020-12-17 09:10:21 -03:00
Bruno Oliveira
3eef150f2e Remove other references to Travis 2020-12-17 08:19:50 -03:00
Ran Benita
02e69e5cdc Merge pull request #8152 from bluetech/empty-skip
terminal: fix "(<Skipped instance>)" skip reason in test status line
2020-12-17 12:58:00 +02:00
Bruno Oliveira
8255effc5b Remove Travis badge from README
Since we stopped testing Python 3.5, we no longer use Travis.
2020-12-16 15:43:58 -03:00
Chris NeJame
534d174fd2 Clarify fixture execution order and provide visual aids (#7381)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-12-16 13:53:14 -03:00
Bruno Oliveira
cab16f3aac Use transparent PNG for logo (#8159) 2020-12-16 11:19:45 -03:00
Bruno Oliveira
a1c5111a40 Fix events variable in prepare-release-pr.yml 2020-12-16 07:53:05 -03:00
Bruno Oliveira
f1a1de2257 Use manual trigger to prepare release PRs (#8150)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-12-16 07:50:02 -03:00
Ran Benita
d46ecbc18b terminal: fix "(<Skipped instance>)" skip reason in test status line 2020-12-15 22:24:25 +02:00
Bruno Oliveira
950fbbc326 Merge pull request #8151 from nicoddemus/cherry-pick-release
Merge pull request #8149 from pytest-dev/release-6.2.1
2020-12-15 15:58:13 -03:00
Bruno Oliveira
56600414df Merge pull request #8149 from pytest-dev/release-6.2.1
Prepare release 6.2.1

(cherry picked from commit a566eb9c70)
2020-12-15 12:41:02 -03:00
Jakob van Santen
9ccbf5b899 python_api: handle array-like args in approx() (#8137) 2020-12-15 08:49:29 -03:00
Ran Benita
6c899a0afa Merge pull request #8144 from bluetech/py-to-pathlib-4
hookspec: add pathlib.Path alternatives to py.path.local parameters in hooks
2020-12-15 13:06:06 +02:00
Anton
8eef8c6004 tests: Migrate to pytester - incremental update (#8145) 2020-12-15 13:02:32 +02:00
Ran Benita
592b32bd69 hookspec: add pathlib.Path alternatives to py.path.local parameters in hooks
As part of the ongoing migration for py.path to pathlib, make sure all
hooks which take a py.path.local also take an equivalent pathlib.Path.
2020-12-15 00:34:23 +02:00
Ran Benita
2cb34a99cb Some py.path.local -> pathlib.Path 2020-12-15 00:29:13 +02:00
Bruno Oliveira
cb8142b8ec Merge pull request #8139 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-html-3.1.1
build(deps): bump pytest-html from 3.1.0 to 3.1.1 in /testing/plugins_integration
2020-12-14 08:13:44 -03:00
Bruno Oliveira
382cb2aae1 Merge pull request #8138 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-bdd-4.0.2
build(deps): bump pytest-bdd from 4.0.1 to 4.0.2 in /testing/plugins_integration
2020-12-14 08:13:22 -03:00
dependabot[bot]
a09d8b1599 build(deps): bump pytest-html in /testing/plugins_integration
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v3.1.0...v3.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-14 03:07:30 +00:00
dependabot[bot]
92b444a914 build(deps): bump pytest-bdd in /testing/plugins_integration
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/4.0.1...4.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-14 03:07:27 +00:00
Ran Benita
ad65e816e4 Merge pull request #8111 from antonblr/testdir-to-pytester-python
tests: Migrate testing/python to pytester fixture
2020-12-13 23:19:31 +02:00
antonblr
4ed9a38519 tests: Migrate testing/python to pytester fixture 2020-12-13 07:42:12 -08:00
Bruno Oliveira
7e2e6630ad Merge pull request #8123 from nicoddemus/import-mismatch-unc
Compare also paths on Windows when considering ImportPathMismatchError
2020-12-13 10:35:11 -03:00
Ran Benita
fa784e1436 Merge pull request #8104 from bot2x/patch-1
migrates test_warnings.py from testdir to pytester
2020-12-13 15:21:37 +02:00
bot2x
28588bf535 migrates test_warnings.py from testdir to pytester 2020-12-13 14:13:49 +02:00
Ran Benita
37b154b1ec Merge pull request #8122 from bluetech/py-to-pathlib-3
Some py.path.local -> pathlib.Path
2020-12-13 10:54:19 +02:00
Ran Benita
09582048be Merge pull request #8131 from bluetech/cherry-pick-release
Merge pull request #8130 from pytest-dev/release-6.2.0
2020-12-12 23:28:31 +02:00
Ran Benita
54a7356a9f Merge pull request #8130 from pytest-dev/release-6.2.0
Prepare release 6.2.0

(cherry picked from commit c475106f12)
2020-12-12 23:23:19 +02:00
Ran Benita
683f29f84d Merge pull request #8129 from bluetech/docs-pygments-workaround
doc: temporary workaround for pytest-pygments lexing error
2020-12-12 22:31:10 +02:00
Ran Benita
0feeddf8ed doc: temporary workaround for pytest-pygments lexing error
pytest-pygments doesn't yet recognize the skip reason in summary line
added recently. Workaround it until we get to updating it.
2020-12-12 22:18:23 +02:00
Ran Benita
b478275777 Merge pull request #8128 from bluetech/skip-reason-empty
terminal: when the skip/xfail is empty, don't show it as "()"
2020-12-12 22:18:06 +02:00
Ran Benita
3302ff9949 terminal: when the skip/xfail is empty, don't show it as "()"
Avoid showing a line like

    x.py::test_4 XPASS ()   [100%]

which looks funny.
2020-12-12 22:09:00 +02:00
Ran Benita
59bd0f6912 Merge pull request #8126 from bluetech/tox-regen-pretend-scm2
tox: use pip legacy resolver for regen job
2020-12-12 20:50:10 +02:00
Ran Benita
6298ff1f4e tox: use pip legacy resolver for regen job
The env var effects all of the pip installs, including regendoc which
also uses setuptools-scm, so it gets the wrong version, and fails to
install with the new pip resolver:

    ERROR: Requested regendoc from 206e495142/regendoc-0.6.1.tar.gz (sha256)=db1e8c9ae02c1af559eae105bfd77ba41ed07fc8ca7030ea59db5f3f161236a4 has different version in metadata: '6.2.0'
2020-12-12 20:27:59 +02:00
Ran Benita
d51ecbd44d Merge pull request #8125 from bluetech/tox-rm-pip-req
tox: remove requires: pip>=20.3.1
2020-12-12 19:11:27 +02:00
Ran Benita
f237b077fc tox: remove requires: pip>=20.3.1
Causes some trouble in CI and not really needed as old pip should still
work.
2020-12-12 18:31:52 +02:00
Ran Benita
95e0e19b8d Merge pull request #8124 from bluetech/s0undt3ch-feature/skip-context-hook
Add `pytest_markeval_namespace` hook.
2020-12-12 18:14:02 +02:00
Anton
cf1051cfba infrastructure: Stricter tox dependensies (#8119) 2020-12-12 18:08:15 +02:00
Pedro Algarvio
b16c091253 Add pytest_markeval_namespace hook.
Add a new hook , `pytest_markeval_namespace` which should return a dictionary.
This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers.

Pseudo example

``conftest.py``:

.. code-block:: python
   def pytest_markeval_namespace():
       return {"color": "red"}
``test_func.py``:

.. code-block:: python
   @pytest.mark.skipif("color == 'blue'", reason="Color is not red")
   def test_func():
       assert False
2020-12-12 17:41:37 +02:00
Ran Benita
ed658d6829 Some py.path.local -> pathlib.Path
- Some conftest related functions
- _confcutdir
- Allow arbitrary os.PathLike[str] in gethookproxy.
2020-12-12 17:33:28 +02:00
Bruno Oliveira
572dfcd160 Compare also paths on Windows when considering ImportPathMismatchError
On Windows, os.path.samefile returns false for paths mounted in UNC paths which
point to the same location.

I couldn't reproduce the actual case reported, but looking at the code it seems
this commit should fix the issue.

Fix #7678
Fix #8076
2020-12-12 08:54:49 -03:00
Ran Benita
902739cfc3 Merge pull request #7208 from CarycaKatarzyna/issue2044
Issue 2044 - show skipping reason in verbose mode
2020-12-09 10:11:47 +02:00
Katarzyna
612f157dbd Show reason for skipped test in verbose mode 2020-12-09 09:43:47 +02:00
Anton
810b878ef8 Migrate to pytester: test_capture.py, test_terminal.py, approx.py (#8108)
* Migrate to pytester: test_capture.py, test_config.py, approx.py

* migrate test_terminal.py

* revert test_config.py

* more typing in test_terminal.py

* try-out 'tr' fixture update

* revert 'tr' fixture, update test_config.py
2020-12-08 22:20:02 +02:00
Bruno Oliveira
059f6ff315 Merge pull request #8107 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-html-3.1.0
build(deps): bump pytest-html from 3.0.0 to 3.1.0 in /testing/plugins_integration
2020-12-07 08:52:56 -03:00
Bruno Oliveira
f3006ecb2b Merge pull request #8106 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.4
build(deps): bump django from 3.1.3 to 3.1.4 in /testing/plugins_integration
2020-12-07 08:52:36 -03:00
dependabot[bot]
19de6bccff build(deps): bump pytest-html in /testing/plugins_integration
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v3.0.0...v3.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 03:08:29 +00:00
dependabot[bot]
8c120c042c build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.3...3.1.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 03:08:29 +00:00
Bruno Oliveira
68a0f22eee Merge pull request #8100 from nicoddemus/doctest-alternatives
List pytest-doctestplus in doctest docs
2020-12-05 17:42:09 -03:00
Ran Benita
1a1bb61340 Merge pull request #8038 from matthewhughes934/note-tmpdir-lifetime
Docs: Note lifetime of temporary directories
2020-12-05 21:54:04 +02:00
Ran Benita
e398c93884 Merge pull request #8055 from bluetech/unraisable
Add unraisableexception and threadexception plugins
2020-12-05 21:52:17 +02:00
Ran Benita
760a73c08c Merge pull request #8017 from bluetech/typing-public-fixtures
Export types of builtin fixtures for type annotations
2020-12-05 21:51:20 +02:00
Bruno Oliveira
4fc20c8d28 List pytest-doctestplus in doctest docs
As per https://github.com/pytest-dev/pytest/discussions/8088
2020-12-04 15:24:56 -03:00
Ran Benita
954151cdbd Merge pull request #8092 from cmecklenborg/pytester_refactor_test_pastebin
Migrate test_pastebin.py from testdir to pytester
2020-12-02 18:17:59 +02:00
Christine Mecklenborg
eeb3afb8ab Migrate test_pastebin.py from testdir to pytester 2020-12-01 12:55:59 -06:00
Ran Benita
64bb5f2ad1 Merge pull request #8091 from cmecklenborg/pytester_refactor_test_parseopt
Migrate test_parseopt.py from testdir to pytester
2020-12-01 14:10:09 +02:00
Ran Benita
0d0dfdd7aa Merge pull request #8090 from cmecklenborg/pytester_refactor_test_nose
Migrate test_nose.py from testdir to pytester
2020-12-01 14:07:55 +02:00
dependabot[bot]
7a06bc2416 build(deps): bump pytest-flakes in /testing/plugins_integration (#8087)
Bumps [pytest-flakes](https://github.com/asmeurer/pytest-flakes) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/asmeurer/pytest-flakes/releases)
- [Commits](https://github.com/asmeurer/pytest-flakes/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 14:06:38 +02:00
Christine Mecklenborg
4abd71121d Migrate test_parseopt.py from testdir to pytester 2020-11-30 16:27:39 -06:00
Christine Mecklenborg
d4c81ffab4 Migrate test_nose.py from testdir to pytester 2020-11-30 16:07:26 -06:00
Shubham Adep
d1cb9de211 Custom multiple marker execution order (#8065)
* Custom multiple marker execution order

https://github.com/pytest-dev/pytest/issues/8020 issue stated that ordering of multiple custom markers is from inside - out. I have added example for the same in the documentation. Please let me know for further changes / concerns.

* remove trailing spaces

The last commit was failing due to extra spaces

* Ran tox tests locally to debug white space trimming issues

* Resolve: ERROR:   docs: commands failed for tox -e docs

* Update doc/en/reference.rst

Committed PR suggestions.

Co-authored-by: Florian Bruhin <me@the-compiler.org>

* Added reference to Node.iter_markers_with_node in documentation

* Add myself to Authors

Co-authored-by: Shubham <shubham.adep@wsu.edu>
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2020-11-30 16:48:08 +01:00
Matthew Hughes
6a256606c6 Docs: Note lifetime of temporary directories
Explanation: The default handling of these lifetimes is done in
`tmpdir.TempPathFactory.getbasetemp`, which passes `keep=3` to
`pathlib.make_numbered_dir_with_cleanup`.

GH Issue: #8036
2020-11-28 21:18:16 +00:00
Prakhar Gurunani
3405c7e6a8 Add more info about skipping doctests (#8080)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-11-28 12:47:02 -03:00
Dominic Mortlock
775ba63c67 Refactor acceptance_test to use pytester (#8070) 2020-11-25 14:42:47 +02:00
Ran Benita
70823da7ed Merge pull request #8064 from symonk/fix-typo-in-mock-timing
fix mock_timing fixture name (typo) in timing.py
2020-11-25 12:29:34 +02:00
Jürgen Gmach
d27806295a fix typo (#8069) 2020-11-24 22:27:34 +01:00
Simon K
b310872300 fix mock_timing fixture name (typo) in timing.py 2020-11-23 20:45:12 +00:00
Ran Benita
d50df85e26 Add unraisableexception and threadexception plugins 2020-11-21 21:11:48 +02:00
Ran Benita
d59a4996ae Merge pull request #8057 from nicoddemus/changelog-links
Add links to some CHANGELOG entries
2020-11-21 20:47:27 +02:00
Maximilian Cosmo Sitter
0cef530d10 Add str() support to LineMatcher (#8050) 2020-11-21 20:45:20 +02:00
Bruno Oliveira
31021ac8d5 Add links to some CHANGELOG entries
While adding links to https://github.com/pytest-dev/pytest/pull/8052, noticed
a few more missing.
2020-11-21 11:05:54 -03:00
Simon K
52fef811c2 permit node to warn with any warning type, not just PytestWarning (#8052)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-11-21 10:49:17 -03:00
Ran Benita
148e3c582a pytester: always close stdin pipe in pytester.run()
If the user passed stdin=PIPE for some reason, they have no way to close
it themselves since it is not exposed.
2020-11-20 17:55:30 +02:00
Ran Benita
3e0bbd2f57 testing: fix ResourceWarning in broken-pipe test 2020-11-20 17:55:23 +02:00
Tim Hoffmann
afd53ede6f Link mentioned functions instead of using literals (#8045) 2020-11-19 15:44:59 +01:00
Bruno Oliveira
329e66c22e Merge pull request #8051 from The-Compiler/nose-fixup
Fix nose documentation
2020-11-19 10:04:59 -03:00
Florian Bruhin
c6ac618baf Fix nose documentation
Follow-up to #8048 which seems to have been merged without the suggested changes.
2020-11-19 13:54:40 +01:00
Bruno Oliveira
42f9622a90 Merge pull request #8048 from mickeypash/patch-1
Add small section on migrating from nose to pytest.
2020-11-19 09:02:04 -03:00
mickeypash
ce825ed16c Add small section on migrating from nose to pytest
The section currently features the nose2pytest tool with plans to expand
on some of the common gotchas when performing such migrations.
2020-11-19 08:50:11 -03:00
Petter Strandmark
eda681af2b Call Python 3.8 doClassCleanups (#8033) 2020-11-19 12:07:15 +02:00
Tim Hoffmann
b7ba76653d Prefix contextmanagers with module name in doc examples (#8044)
* Prefix contextmanagers with module name in doc examples

* Import pytest explicitly for doctests

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-11-19 12:06:24 +02:00
Ran Benita
30d89fd07e Merge pull request #8039 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-html-3.0.0
build(deps): bump pytest-html from 2.1.1 to 3.0.0 in /testing/plugins_integration
2020-11-19 12:05:04 +02:00
Ran Benita
8ea8cdb36d Merge pull request #8040 from symonk/remove-unused-var-in-pytester
stop assigning nextline if its potentially not used
2020-11-17 18:00:17 +02:00
symonk
3b677f79f4 stop assigning nextline if its potentially not used 2020-11-17 11:30:09 +00:00
Ran Benita
537215a16c Merge pull request #7987 from bluetech/ci-deprecated
ci: fix deprecation message & couple updates
2020-11-16 23:29:35 +02:00
Ran Benita
c2f949d68e Merge pull request #8013 from itsmegarvi/master
#7942 migrate from tempdir to pytester
2020-11-16 19:44:43 +02:00
Garvit Shubham
6fe9d2fb9f testing: convert test_{conftest,recwarn,tmpdir} to pytester 2020-11-16 19:22:57 +02:00
dependabot[bot]
3a899ced76 build(deps): bump pytest-html in /testing/plugins_integration
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 2.1.1 to 3.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v2.1.1...v3.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-16 03:15:18 +00:00
Ran Benita
825b81ba52 Merge pull request #8014 from bluetech/pyc-pep552
assertion/rewrite: write pyc's according to PEP-552 on Python>=3.7
2020-11-14 23:38:45 +02:00
Ran Benita
1d532da49e assertion/rewrite: write pyc's according to PEP-552 on Python>=3.7
Python 3.7 changes the pyc format by adding a flags byte. Even though it
is not necessary for us to match it, it is nice to be able to read pyc
files we emit for debugging the rewriter.

Update our custom pyc files to use that format. We write flags==0
meaning we still use the mtime+size format rather the newer hash format.
2020-11-14 23:20:12 +02:00
Ran Benita
767cbeb086 Merge pull request #8002 from mcsitter/add-pythonenv-gitignore
Add pythonenv* to gitignore
2020-11-13 23:14:23 +02:00
Maximilian Cosmo Sitter
25e4dd0d2c Fix scope to accomodate requested changes 2020-11-13 20:00:44 +00:00
Ran Benita
c14f498622 Merge pull request #7908 from bluetech/post-release-tag
RELEASING: make sure we have an accurate version in a commit in master
2020-11-13 12:57:53 +02:00
Ran Benita
f6b682ad49 RELEASING: start new dev cycle by tagging MAJOR.{MINOR+1}.0.dev0 in master
This is needed so setuptools-scm in master shows an accurate version.
In particular, higher than the stable branch.
2020-11-13 12:38:58 +02:00
Ran Benita
701ff1f5a1 ci: only deploy to PyPI on X.Y.Z{,rcN} tags
We want to reserve other tags for our own purposes without it creating a
release.
2020-11-13 12:38:30 +02:00
Ran Benita
f1e6fdcddb Export types of builtin fixture for type annotations
In order to allow users to type annotate fixtures they request, the
types need to be imported from the `pytest` namespace. They are/were
always available to import from the `_pytest` namespace, but that is
not guaranteed to be stable.

These types are only exported for the purpose of typing. Specifically,
the following are *not* public:

- Construction (`__init__`)
- Subclassing
- staticmethods and classmethods

We try to combat them being used anyway by:

- Marking the classes as `@final` when possible (already done).

- Not documenting private stuff in the API Reference.

- Using `_`-prefixed names or marking as `:meta private:` for private
  stuff.

- Adding a keyword-only `_ispytest=False` to private constructors,
  warning if False, and changing pytest itself to pass True. In the
  future it will (hopefully) become a hard error.

Hopefully that will be enough.
2020-11-13 11:25:09 +02:00
Ran Benita
b050578882 pytester: split asserts to a separate plugin, don't rewrite pytester itself
An upcoming commit wants to import from `_pytest.pytester` in the public
`pytest` module. This means that `_pytest.pytester` would start to get
imported during import time, which it hasn't up to now -- it was
imported by the plugin loader (if requested). When a plugin is loaded,
it is subjected to assertion rewriting, but only if the module isn't
imported yet, it issues a warning "Module already imported so cannot be
rewritten" and skips the rewriting. So we'd end up with the pytester
plugin not being rewritten, but it wants to be.

Absent better ideas, the solution here is to split the pytester
assertions to their own plugin (which will always only be imported by
the plugin loader) and exclude pytester itself from plugin rewriting.
2020-11-13 11:25:09 +02:00
Ran Benita
66311ff702 Merge pull request #8022 from bluetech/doctest-init
main: fix only one doctest collected on pytest --doctest-modules __init__.py
2020-11-13 10:46:46 +02:00
Ran Benita
ea3c0aa245 Merge pull request #8019 from JosiasAurel/mypytester-change-01
Migrate from testdir to pytester
2020-11-13 10:36:03 +02:00
Bruno Oliveira
843bca8c0c Merge pull request #8025 from adamchainz/issue_8023_norecursedirs
Add 'node_modules' to norecursedirs
2020-11-12 07:36:38 -03:00
Josias Aurel
fa148eadfe Update testing/test_faulthandler.py
Co-authored-by: Sanket Duthade <duthades@gmail.com>
2020-11-11 18:35:06 +01:00
Bruno Oliveira
ff9e35243e Merge pull request #7928 from graingert/feature-request-template 2020-11-11 09:20:00 -03:00
Josias Aurel
06a597db14 Add type annotations 2020-11-11 05:02:32 +01:00
Josias Aurel
1ed8159c7d Update testing/test_faulthandler.py
Co-authored-by: Sanket Duthade <duthades@gmail.com>
2020-11-11 04:45:57 +01:00
Josias Aurel
8320c07134 Update testing/test_faulthandler.py
Co-authored-by: Sanket Duthade <duthades@gmail.com>
2020-11-11 04:45:42 +01:00
Adam Johnson
39b2706f6a Add 'node_modules' to norecursedirs
Fixes #8023.
2020-11-11 01:52:18 +00:00
Ran Benita
265cc2cfec main: fix only one doctest collected on pytest --doctest-modules __init__.py
When --doctest-modules is used, an `__init__.py` file is not a `Package`
but a `DoctestModule`, but some collection code assumed that
`__init__.py` implies a `Package`. That code caused only a single test
to be collected in the scenario in the subject.

Tighten up this check to explicitly check for `Package`. There are
better solutions, but for another time.

Report & test by Nick Gates <nickgatzgates@gmail.com>.
2020-11-10 22:50:46 +02:00
Josias Aurel
043ed55056 Migrate from testdir to pytester 2020-11-09 18:07:34 +01:00
Ran Benita
e986d84466 Merge pull request #8006 from bluetech/export-MonkeyPatch
Export MonkeyPatch as pytest.MonkeyPatch
2020-11-09 11:45:38 +02:00
Ran Benita
6f13d1b03b Export MonkeyPatch as pytest.MonkeyPatch
We want to export `pytest.MonkeyPatch` for the purpose of
type-annotating the `monkeypatch` fixture. For other fixtures we export
in this way, we also make direct construction of them (e.g.
`MonkeyPatch()`) private. But unlike the others, `MonkeyPatch` is also
widely used directly already, mostly because the `monkeypatch` fixture
only works in `function` scope (issue #363), but also in other cases. So
making it private will be annoying and we don't offer a decent
replacement yet.

So, let's just make direct construction public & documented.
2020-11-09 11:28:15 +02:00
Ran Benita
7aa5e49fc4 Merge pull request #8012 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.3
build(deps): bump django from 3.1.2 to 3.1.3 in /testing/plugins_integration
2020-11-09 11:26:35 +02:00
dependabot[bot]
02d4b3d75f build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.2...3.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-09 03:17:35 +00:00
Bruno Oliveira
b2e7b9df9e Merge pull request #8010 from nicoddemus/pluralize 2020-11-08 13:31:27 -03:00
Bruno Oliveira
c7f8ad17f5 Rename _make_plural to pluralize
A bit shorter and a better name, IMHO.
2020-11-08 12:42:52 -03:00
Hugo Martins
5b2e5e8a40 Improve summary stats when using '--collect-only' (#7875)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-11-08 11:45:10 -03:00
Ran Benita
29f2f4e854 Merge pull request #8005 from bluetech/pytest-import
Stop importing `pytest` to avoid upcoming import cycles
2020-11-08 14:15:19 +02:00
Bruno Oliveira
10a3a49bd6 Merge pull request #8007 from bluetech/dont-ignore-already-imported
testing: don't ignore "Module already imported so cannot be rewritten" warning
2020-11-07 22:46:15 -03:00
frankgerhardt
9bc633064b Capitalize headlines (#8008) 2020-11-07 22:44:04 -03:00
Ran Benita
361f9e20c3 testing: don't ignore "Module already imported so cannot be rewritten" warning
The test suite passes without it being ignored. The absence of this
warning cost me some head-scratching time, so enable it again.
2020-11-07 18:14:21 +02:00
Ran Benita
1cbb0c3554 Stop importing pytest to avoid upcoming import cycles
Don't import `pytest` from within some `_pytest` modules since an
upcoming commit will import from them into `pytest`.

It would have been nice not to have to do it, so that internal plugins
look more like external plugins, but with the existing layout this seems
unavoidable.
2020-11-07 18:08:30 +02:00
Ran Benita
c784c142a4 Merge pull request #7988 from bluetech/deprecate-yield-fixture
fixtures: deprecate pytest.yield_fixture()
2020-11-07 18:07:00 +02:00
Ran Benita
4c0513bc18 fixtures: deprecate pytest.yield_fixture() 2020-11-07 17:06:40 +02:00
Sanket Duthade
3bcd316f07 test_collection.py migrate from testdir to Pytester (#8003) 2020-11-07 16:56:00 +02:00
Garvit Shubham
6a5037a25b #7942 test_setupplan.py migrate from testdir to Pytester (#8004)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-11-07 09:29:45 -03:00
Maximilian Cosmo Sitter
a73fb6e006 Add pythonenv* to gitignore 2020-11-06 14:29:12 +00:00
Bruno Oliveira
30287b49cd Deprecate --strict (#7985)
Fix #7530
2020-11-06 09:48:20 +01:00
Anthony Sottile
4cd0fde277 Merge pull request #8001 from bluetech/silence-pyparsing-warning
testing: silence deprecation warning from older pyparsing releases
2020-11-05 08:46:50 -08:00
Ran Benita
070f8e0f9d testing: silence deprecation warning from older pyparsing releases
This causes some tests to fail when using these older versions.
2020-11-05 16:08:54 +02:00
Ran Benita
1d4cc7eb36 Merge pull request #7997 from duthades/master
#7942 test_session.py migrate from testdir to Pytester
2020-11-05 15:55:36 +02:00
duthades
b815f430e5 #7942 test_session.py migrate from testdir to pytester
- Add name to AUTHORS
2020-11-04 21:55:07 +05:30
Ran Benita
3adece9fb7 Merge pull request #7990 from bluetech/xunit-quadratic-3
unittest: fix quadratic behavior in collection of unittests using setUpClass/setup_method
2020-11-03 18:01:25 +02:00
Ran Benita
489f6f4499 unittest: fix quadratic behavior in collection of unittests using setUpClass/setup_method
This is similar to 50114d4731876dae; I missed that unittest does the
same thing.
2020-11-01 15:17:42 +02:00
Ran Benita
a95da7a425 Merge pull request #7980 from bluetech/code-changes
code: a few minor improvements
2020-11-01 09:51:39 +02:00
Ran Benita
8aa9ea95e1 ci: test on Python 3.9 final 2020-11-01 09:49:41 +02:00
Ran Benita
76226182ae ci: change cache action to v2
Supposed to be faster.
2020-11-01 09:49:41 +02:00
Ran Benita
f9d82a34f4 ci: replace deprecated ::set-env 2020-11-01 09:49:23 +02:00
Ran Benita
7fb0ea3f68 Merge pull request #7956 from csernazs/fix-7951
Fix handling recursive symlinks
2020-10-31 18:59:50 +02:00
Cserna Zsolt
8a38e7a6e8 Fix handling recursive symlinks
When pytest was run on a directory containing a recursive symlink it failed
with ELOOP as the library was not able to determine the type of the
direntry:

src/_pytest/main.py:685: in collect
    if not direntry.is_file():
E   OSError: [Errno 40] Too many levels of symbolic links: '/home/florian/proj/pytest/tests/recursive'

This is fixed by handling ELOOP and other errors in the visit function in
pathlib.py, so the entries whose is_file() call raises an OSError with the
pre-defined list of error numbers will be exluded from the result.

The _ignore_errors function was copied from Lib/pathlib.py of cpython 3.9.

Fixes #7951
2020-10-31 17:40:56 +01:00
Ran Benita
1c18fb8ccc Merge pull request #7553 from tirkarthi/namedtuple-diff
Add support to display field names in namedtuple diffs.
2020-10-31 15:02:31 +02:00
Bruno Oliveira
2753859ff0 Merge pull request #7979 from nicoddemus/metafunc-ref
Add FunctionDefinition to the reference docs
2020-10-31 10:00:48 -03:00
Ran Benita
a14a229d1b Merge pull request #7982 from bluetech/symlink-collect
pathlib: fix symlinked directories not followed during collection
2020-10-31 14:46:50 +02:00
Karthikeyan Singaravelan
9a0f4e57ee Add support to display field names in namedtuple diffs. 2020-10-31 14:41:53 +02:00
Ran Benita
dd323980f9 Merge pull request #7978 from nicoddemus/port-4.6-release-notes
Manually add the remaining 4.6.x release notes to the changelog
2020-10-31 14:37:45 +02:00
Ran Benita
6cdae8ed40 pathlib: fix symlinked directories not followed during collection 2020-10-31 14:22:15 +02:00
Bruno Oliveira
569c091769 Add FunctionDefinition to the reference docs
Fix #7968
2020-10-31 08:45:34 -03:00
Bruno Oliveira
0c7233032f Manually add the remaining 4.6.x release notes to the changelog
Fix #7967
2020-10-31 08:36:26 -03:00
Ran Benita
531416cc5a code: simplify Code construction 2020-10-31 12:40:25 +02:00
Ran Benita
6506f016ac testing/test_source: use unqualified imports 2020-10-31 12:40:25 +02:00
Ran Benita
a1df458e85 code: use properties for derived attributes, use slots
Make the objects more light weight.

Remove unused properties.
2020-10-31 12:40:25 +02:00
Ariel Pillemer
a7e38c5c61 pytest-dev#7942 test_runner_xunit.py (#7964) 2020-10-31 12:38:11 +02:00
crricks
3c7eb5a398 migrated test_nodes.py from testdir to pytester #7492. (#7969) 2020-10-30 22:34:05 +02:00
Ran Benita
ad94456ca0 Merge pull request #7976 from symonk/7942-refactor-stepwise-to-use-pytester
#7942 refactor stepwise tests to utilize pytester
2020-10-30 22:15:12 +02:00
Christine Mecklenborg
aa843746a4 Migrate test_error_diffs.py from testdir to pytester (#7971) 2020-10-30 22:12:40 +02:00
symonk
c58abf7ad1 #7942 refactor stepwise tests to utilize pytester 2020-10-30 19:21:42 +00:00
Ran Benita
5913cd20ec assertion/util: remove unhelpful type_fns indirection
It doesn't serve any purpose that I am able to discern.
2020-10-30 21:15:48 +02:00
Simon K
6cddeb8cb3 #7938 - [Plugin: Stepwise][Enhancements] Refactoring, smarter registration & --sw-skip functionality (#7939)
* adding --sw-skip shorthand for stepwise skip

* be explicit rather than implicit with default args for stepwise

* add constant for sw cache dir; only register plugin if necessary rather check check activity always;

* use str format; remove unused args in hooks

* assert cache upfront, allow stepwise to have a reference to the cache

* type hinting lf, skip, move literal strings into module constants

* convert parametrized option into a list

* add a sessionfinish hook for stepwise to keep backwards behaviour the same

* add changelog for #7938

* Improve performance of stepwise modifyitems & address PR feedback

* add test for stepwise deselected based on performance enhancements

* Apply suggestions from code review

* delete from items, account for edge case where failed_index = 0

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-30 19:13:06 +00:00
Ran Benita
0cd190f037 Merge pull request #7970 from cmecklenborg/pytester_refactor_test_assertion
Migrate test_assertion.py from testdir to pytester
2020-10-30 20:56:21 +02:00
Christine Mecklenborg
47ff911c8f Migrate test_assertion.py from testdir to pytester 2020-10-29 20:39:44 -05:00
Ran Benita
8f52fc777a Merge pull request #7962 from bluetech/mypy-typed-deps
pre-commit: install typed dependencies in the mypy target
2020-10-29 17:52:12 +02:00
Ran Benita
65dfa98877 Merge pull request #7961 from bluetech/rm-checkqa-mypy
tox: remove checkqa-mypy environment
2020-10-29 17:25:51 +02:00
Christine Mecklenborg
65148e3120 Migrate test_compat.py from testdir to pytester (#7963) 2020-10-29 09:56:34 +02:00
Christine Mecklenborg
460b51dd95 Migrate test_setuponly.py from testdir to pytester (#7959) 2020-10-29 09:55:30 +02:00
Christine Mecklenborg
efe470bf1c Migrate test_assertrewrite.py from testdir to pytester (#7952) 2020-10-29 09:54:34 +02:00
Ran Benita
e3ce5d6b53 pre-commit: install typed dependencies in the mypy target
Otherwise, mypy doesn't know about them and their types are considered
Any.
2020-10-28 22:22:33 +02:00
Ran Benita
de810152ec tox: remove checkqa-mypy environment
We run mypy through pre-commit, and we don't keep duplicate targets in
tox for all of the other linters. Since this adds some (small)
maintenance overhead, remove it.
2020-10-28 22:16:25 +02:00
Bruno Oliveira
b95991aeea Merge pull request #7960 from nicoddemus/cherry-pick-release
Merge pull request #7958 from pytest-dev/release-6.1.2
2020-10-28 14:36:37 -03:00
Bruno Oliveira
5711ced250 Merge pull request #7958 from pytest-dev/release-6.1.2
Prepare release 6.1.2

(cherry picked from commit 1ed903e8fc)
2020-10-28 14:23:09 -03:00
Christine M
8d369f73ba Migrate test_skipping.py from testdir to pytester (#7953) 2020-10-28 17:05:54 +02:00
Ran Benita
6cd6d9b61a Merge pull request #7949 from gcamargo1/gcamargo1-patch-1
Update doctest.rst
2020-10-28 15:56:59 +02:00
Vasilis Gerakaris
a431310c0a Increase temp dir deletion period to 3 days (#7914)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-28 08:23:35 -03:00
Ran Benita
78c09b9931 Merge pull request #7944 from symonk/refactor-test-mark-to-use-pytester
Refactor test_warning_types.py & test_mark.py to use pytester
2020-10-27 21:06:42 +02:00
symonk
434e30424e Address feedback for converting testdir to pytester 2020-10-27 17:50:54 +00:00
Gustavo Camargo
b308c6ddb3 Update doctest.rst 2020-10-26 14:30:00 -05:00
Ran Benita
0fe8a8dfe6 Merge pull request #7945 from proggga/fix_test_helpconfig_7942
#7942 test_helpconfig.py migrate from testdir to pytester
2020-10-26 17:52:41 +02:00
Mikhail Fesenko
cd9b3618c7 #7942 test_helpconfig.py migrate from testdir to pytester 2020-10-26 18:30:48 +03:00
Bruno Oliveira
20b710c4b4 Merge pull request #7948 from bluetech/testing-conftest-pytester
testing: make conftest stuff check for pytester not testdir
2020-10-26 12:08:19 -03:00
Ran Benita
c31f4dc112 testing: make conftest stuff check for pytester not testdir
testdir uses pytester so this applies to it as well, but now includes
pytester as well.
2020-10-26 15:01:38 +02:00
Ran Benita
096d096539 Merge pull request #7946 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.1.0
build(deps): bump pytest-django from 4.0.0 to 4.1.0 in /testing/plugins_integration
2020-10-26 14:36:49 +02:00
dependabot[bot]
f7c5067823 build(deps): bump pytest-django in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.0.0...v4.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-26 03:15:50 +00:00
symonk
cde50db6e7 add type hint to parametrized warning_class 2020-10-25 18:31:43 +00:00
symonk
c818ac2248 Tidy up type hints for pytest in test_marks & test_warning_types 2020-10-25 18:03:59 +00:00
symonk
6b7203aba7 add conversion for test_warning_types.py also 2020-10-25 17:38:12 +00:00
symonk
7495d2c345 add missing pytester type hints 2020-10-25 17:33:40 +00:00
symonk
1bd83e75a4 refactor test mark to use new pytester 2020-10-25 17:27:19 +00:00
Ran Benita
8105e60f20 Merge pull request #7937 from bluetech/testing-fixes
testing: fix pexpect hang
2020-10-25 16:53:03 +02:00
Ran Benita
ca82214444 pytester: workaround issue causing spawn to crash or hang
In pytester tests, pytest stashes & restores the sys.modules for each
test. So if the test imports a new module, it is initialized anew each
time.

Turns out the readline module isn't multi-init safe, which causes
pytester.spawn to crash or hang. So preserve it as a workaround.
2020-10-25 16:31:47 +02:00
Ran Benita
897f151e94 testing: use pytester.spawn instead of testdir
Part of investigating a bug, but didn't fix it.
2020-10-25 10:11:10 +02:00
Ran Benita
25dee8fef6 testing: fix test_assertrewrite with PYTHONPYCACHEPREFIX
Make the tests work when running with PYTHONPYCACHEPREFIX (possible when
running in a dirty environment, not under tox).
2020-10-25 10:11:10 +02:00
Ran Benita
d9ac2efbcd testing: python 3.10 fix 2020-10-25 01:27:44 +02:00
Ran Benita
65e6e39b76 Merge pull request #7931 from bluetech/xunit-quadratic-2
fixtures: fix quadratic behavior in the number of autouse fixtures
2020-10-25 01:24:38 +03:00
Ran Benita
470ea504e2 fixtures: fix quadratic behavior in the number of autouse fixtures
It turns out all autouse fixtures are kept in a global list, and thinned
out for a particular node using a linear scan of the entire list each
time.

Change the list to a dict, and only take the nodes we need.
2020-10-25 00:49:23 +03:00
Ran Benita
d6becfa177 fixtures: change _getautousenames to an iterator
This reads better.
2020-10-25 00:49:06 +03:00
Ran Benita
aa0e2d654f fixtures: use a faster replacement for ischildnode
ischildnode can be quite hot in some cases involving many fixtures.
However it is always used in a way that the nodeid is constant and the
baseid is iterated. So we can save work by pre-computing the parents of
the nodeid and use a simple containment test.

The `_getautousenames` function has the same stuff open-coded, so change
it to use the new function as well.
2020-10-25 00:48:35 +03:00
Bruno Oliveira
f7d4f457d0 Merge pull request #7934 from symonk/small-adjustment-to-hookspec-docstrings
Replace term 'triple' with 'tuple' in hookspec docstrings
2020-10-24 08:01:05 -03:00
symonk
751575fa97 make some hookspec docstrings technically correct 2020-10-24 10:59:25 +01:00
Thomas Grainger
e14b724ff4 Update .github/ISSUE_TEMPLATE/2_feature_request.md 2020-10-23 22:35:56 +01:00
Bruno Oliveira
daa11ab9f1 Merge pull request #7930 from bluetech/pytester-doc-fixes
pytester: minor doc fixes
2020-10-23 17:21:22 -03:00
Ran Benita
0b14350f23 Merge pull request #7929 from bluetech/xunit-quadratic-1
python: fix quadratic behavior in collection of items using xunit fixtures
2020-10-23 23:10:25 +03:00
Ran Benita
50114d4731 python: fix quadratic behavior in collection of items using xunit fixtures
Since commit 0f918b1a9d pytest uses auto-generated autouse
pytest fixtures for the xunit fixtures
{setup,teardown}_{module,class,method,function}. All of these fixtures
were given the same name.

Unfortunately, pytest fixture lookup for a name works by grabbing all of
the fixtures globally declared with a name and filtering to only those
which match the specific node. So each xunit-using item iterates over a
list (of fixturedefs) of a size of all previous same-xunit-using items,
i.e. quadratic.

Fixing this properly to use a better data structure is likely to take
some effort, but we can avoid the immediate problem by just using
a different name for each item's autouse fixture, so it only matches
itself.

A benchmark is added to demonstrate the issue. It is still way too slow
after the fix and possibly still quadratic, but for a different reason
which is another matter.

Running --collect-only, before (snipped):

         202533232 function calls (201902604 primitive calls) in 86.379 seconds

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000   85.688   85.688 main.py:320(pytest_collection)
        1    0.000    0.000   85.688   85.688 main.py:567(perform_collect)
80557/556    0.021    0.000   85.050    0.153 {method 'extend' of 'list' objects}
85001/15001  0.166    0.000   85.045    0.006 main.py:785(genitems)
    10002    0.050    0.000   84.219    0.008 runner.py:455(collect_one_node)
    10002    0.049    0.000   83.763    0.008 runner.py:340(pytest_make_collect_report)
    10002    0.079    0.000   83.668    0.008 runner.py:298(from_call)
    10002    0.019    0.000   83.541    0.008 runner.py:341(<lambda>)
     5001    0.184    0.000   81.922    0.016 python.py:412(collect)
     5000    0.020    0.000   81.072    0.016 python.py:842(collect)
    30003    0.118    0.000   78.478    0.003 python.py:218(pytest_pycollect_makeitem)
    30000    0.190    0.000   77.957    0.003 python.py:450(_genfunctions)
    40001    0.081    0.000   76.664    0.002 nodes.py:183(from_parent)
    30000    0.087    0.000   76.629    0.003 python.py:1595(from_parent)
    40002    0.092    0.000   76.583    0.002 nodes.py:102(_create)
    30000    0.305    0.000   76.404    0.003 python.py:1533(__init__)
    15000    0.132    0.000   74.765    0.005 fixtures.py:1439(getfixtureinfo)
    15000    0.165    0.000   73.664    0.005 fixtures.py:1492(getfixtureclosure)
    15000    0.044    0.000   57.584    0.004 fixtures.py:1653(getfixturedefs)
    30000   18.840    0.001   57.540    0.002 fixtures.py:1668(_matchfactories)
 37507500   31.352    0.000   38.700    0.000 nodes.py:76(ischildnode)
    15000   10.464    0.001   15.806    0.001 fixtures.py:1479(_getautousenames)
112930587/112910019   7.333    0.000    7.339    0.000 {built-in method builtins.len}

After:

         51890333 function calls (51259706 primitive calls) in 27.306 seconds

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000   26.783   26.783 main.py:320(pytest_collection)
        1    0.000    0.000   26.783   26.783 main.py:567(perform_collect)
80557/556    0.020    0.000   26.108    0.047 {method 'extend' of 'list' objects}
85001/15001  0.151    0.000   26.103    0.002 main.py:785(genitems)
    10002    0.047    0.000   25.324    0.003 runner.py:455(collect_one_node)
    10002    0.045    0.000   24.888    0.002 runner.py:340(pytest_make_collect_report)
    10002    0.069    0.000   24.805    0.002 runner.py:298(from_call)
    10002    0.017    0.000   24.690    0.002 runner.py:341(<lambda>)
     5001    0.168    0.000   23.150    0.005 python.py:412(collect)
     5000    0.019    0.000   22.223    0.004 python.py:858(collect)
    30003    0.101    0.000   19.818    0.001 python.py:218(pytest_pycollect_makeitem)
    30000    0.161    0.000   19.368    0.001 python.py:450(_genfunctions)
    30000    0.302    0.000   18.236    0.001 python.py:1611(from_parent)
    40001    0.084    0.000   18.051    0.000 nodes.py:183(from_parent)
    40002    0.116    0.000   17.967    0.000 nodes.py:102(_create)
    30000    0.308    0.000   17.770    0.001 python.py:1549(__init__)
    15000    0.117    0.000   16.111    0.001 fixtures.py:1439(getfixtureinfo)
    15000    0.134    0.000   15.135    0.001 fixtures.py:1492(getfixtureclosure)
    15000    9.320    0.001   14.738    0.001 fixtures.py:1479(_getautousenames)
2020-10-23 22:36:23 +03:00
Ran Benita
1c0c56dfb9 pytester: minor doc fixes 2020-10-23 21:01:31 +03:00
Emiel van de Laar
0d9e27a363 doc: Remove unused imports in examples (#7924)
The "os" imports in the `tmp_path` and `tmpdir` fixture examples are
unused and thus have been removed to prevent confusion.
2020-10-23 17:31:17 +03:00
Ran Benita
0cdbf8b377 Merge pull request #7910 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-trio-0.7.0
build(deps): bump pytest-trio from 0.6.0 to 0.7.0 in /testing/plugins_integration
2020-10-23 16:52:54 +03:00
Ran Benita
e1848349a7 Merge pull request #7909 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.0.0
build(deps): bump pytest-django from 3.10.0 to 4.0.0 in /testing/plugins_integration
2020-10-23 16:52:29 +03:00
Thomas Grainger
03363473f7 expand feature request issue template 2020-10-23 14:03:24 +01:00
Matthias Gabriel
e8504e04f3 Fix small typo in reference.rst (#7922)
Co-authored-by: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
2020-10-22 07:11:49 -03:00
Bruno Oliveira
824e9cf67a Merge pull request #7917 from bluetech/ci-timeout
ci: decrease job timeout from 6 hours to 30 minutes
2020-10-21 08:02:30 -03:00
Ran Benita
fe69d0d680 ci: decrease job timeout from 6 hours to 30 minutes
We don't have any jobs that should go beyond that, so let's be nicer to
the CI host and quicker to report the failure.
2020-10-21 10:17:25 +03:00
Ran Benita
a66b6b857a Merge pull request #7915 from bluetech/fix-lf-package
cacheprovider: fix some files in packages getting lost from --lf
2020-10-21 10:12:32 +03:00
Ran Benita
afaabdda8c cacheprovider: fix some files in packages getting lost from --lf
--lf has an optimization where it skips collecting Modules (python
files) which don't contain failing tests. The optimization works by
getting the paths of all cached failed tests and skipping the collection
of Modules whose path is not included in that list.

In pytest, Package nodes are Module nodes with the fspath being the file
`<package dir>/__init__.py`. Since it's a Module the logic above
triggered for it, and because it's an `__init__.py` file which is
unlikely to have any failing tests in it, it is skipped, which causes
its entire directory to be skipped, including any Modules inside it with
failing tests.

Fix by special-casing Packages to never filter. This means entire
Packages are never filtered, the Modules themselves are always checked.
It is reasonable to consider an optimization which does filter entire
packages bases on parent paths etc. but this wouldn't actually save any
real work so is really not worth it.
2020-10-19 19:02:43 +03:00
Bruno Oliveira
f453460ae7 Merge pull request #7912 from hugovk/rm-3.5 2020-10-19 10:27:49 -03:00
Hugo van Kemenade
c9e5042d6d Remove redundant Python 2.7 code 2020-10-19 10:47:35 +03:00
Hugo van Kemenade
a642650e17 Drop support for EOL Python 3.5 2020-10-19 10:02:36 +03:00
dependabot[bot]
f335144d1d build(deps): bump pytest-trio in /testing/plugins_integration
Bumps [pytest-trio](https://github.com/python-trio/pytest-trio) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/python-trio/pytest-trio/releases)
- [Commits](https://github.com/python-trio/pytest-trio/compare/v0.6.0...v0.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-19 03:05:42 +00:00
dependabot[bot]
23aac10391 build(deps): bump pytest-django in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 3.10.0 to 4.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v3.10.0...v4.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-19 03:05:42 +00:00
Ran Benita
f61d4ed9d5 Merge pull request #7907 from bluetech/mypy-790
Update mypy 0.782 -> 0.790, iniconfig typing
2020-10-19 00:28:04 +03:00
Ran Benita
09e38b1697 runner: combine a sort+reverse to a sort(reverse=True)
Suggested by Zac-HD.
2020-10-19 00:02:01 +03:00
Ran Benita
1b23a111d2 Update mypy 0.782 -> 0.790 2020-10-17 19:25:45 +03:00
Ran Benita
e5e47c1097 Fix typing related to iniconfig
iniconfig now has typing stubs which reveal a couple issues.
2020-10-17 19:25:45 +03:00
Bruno Oliveira
0a258f534f Fix linting 2020-10-17 08:42:15 -03:00
Bruno Oliveira
f58d0a8c3d Merge pull request #7903 from ekrecker/patch-1
Fix typos
2020-10-17 08:41:10 -03:00
Nimesh Vashistha
991bc7bd50 Added note to writing_plugins.rst (#7896)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-17 08:26:30 -03:00
kwgchi
fc70fd23a2 Fix typos 2020-10-16 21:29:58 +09:00
Bruno Oliveira
b4c28dcaa2 Merge pull request #7893 from nicoddemus/testdir-docs-7892
List Testdir members in the docs
2020-10-14 10:34:49 -03:00
Prashant Sharma
5182c73fea Add example for registering multiple custom mark (#7886) 2020-10-14 15:17:50 +03:00
Bruno Oliveira
3cae145e41 List Testdir members in the docs
Also include docstrings pointing to the counterparts in Pytester.

Fix #7892
2020-10-13 12:01:11 -03:00
Bruno Oliveira
69419cb700 New pytester fixture (#7854) 2020-10-12 12:13:06 -03:00
Bruno Oliveira
cb578a918e Merge pull request #7883 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.1.2
build(deps): bump django from 3.1.1 to 3.1.2 in /testing/plugins_integration
2020-10-12 09:43:17 -03:00
dependabot[bot]
b53a8bb60f build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.1...3.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-12 12:39:31 +00:00
Bruno Oliveira
3434488af4 Merge pull request #7882 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--2.0.2
build(deps): bump anyio[curio,trio] from 2.0.0 to 2.0.2 in /testing/plugins_integration
2020-10-12 09:38:54 -03:00
Ronny Pfannschmidt
cdaa1b52be Merge pull request #7884 from bluetech/release-on-comment-fixes
release-on-comment: add "Closes <release issue number>" to release PR
2020-10-11 10:49:45 +02:00
Ran Benita
008863aeb9 release-on-comment: add "Closes <release issue number>" to release PR 2020-10-10 19:01:41 +03:00
dependabot[bot]
37cf4693cf build(deps): bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 2.0.0 to 2.0.2.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/2.0.0...2.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-10 15:52:11 +00:00
Hugo van Kemenade
3059caf1ee Put smoke test deps in requirements.txt for Dependabot (#7806) 2020-10-10 18:51:35 +03:00
Ran Benita
55127b2142 Merge pull request #7879 from charlesaracil-ulti/ask_for_commit_after_in_contributing
ask for commit after changelog and authors file edit in contributing
2020-10-09 22:34:06 +03:00
Charles Aracil
2e322f183c ask for commit after changelog and authors file edit (#7878) 2020-10-09 16:10:54 +02:00
Zac Hatfield-Dodds
dbd082af96 Merge pull request #7874 from tanvimehta/master 2020-10-08 17:36:54 +11:00
Tanvi Mehta
d093931464 Added name to authors list 2020-10-07 22:57:52 -07:00
Tanvi Mehta
779b511bfe Fixed formatting 2020-10-07 22:25:27 -07:00
Tanvi Mehta
43b1eb3c9e Use instead of a in Issue #7868
Use `collections.Counter` instead of a `dict` in `terminal.py` Issue #7868
2020-10-07 21:51:28 -07:00
Kyle Altendorf
5acc55e838 Merge pull request #7872 from altendky/addini_takes_string
Document that Parser.addini() can take, and defaults to, 'string'
2020-10-07 19:12:54 -04:00
Kyle Altendorf
1630c37266 Added changelog/7872.doc.rst 2020-10-07 18:06:13 -04:00
Kyle Altendorf
76acb44330 Update tests to cover explicit None and "string" as addini() types 2020-10-07 17:56:54 -04:00
Kyle Altendorf
af3759a503 Parser.addini() can take and defaults to 'string' 2020-10-07 17:21:55 -04:00
Anthony Sottile
95917f8833 Merge pull request #7863 from asottile/py36_order_preserving_dict
py36+: remove _pytest.compat.order_preserving_dict
2020-10-06 08:35:38 -07:00
Manuel Mariñez
13ddec9a00 Add alias clarification to deprecation warning (#7829)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-06 11:48:34 -03:00
Anthony Sottile
b6b75383ce py36+: remove _pytest.compat.order_preserving_dict 2020-10-06 00:22:09 -07:00
Anthony Sottile
f54ec30a6d Merge pull request #7862 from asottile/comm2ann
py36+: com2ann
2020-10-06 00:20:57 -07:00
Anthony Sottile
33d119f71a py36+: com2ann 2020-10-05 18:33:17 -07:00
William Jamir Silva
703e89134c Update reference.rst informing the default junit_family (#7860)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-05 14:04:37 -03:00
Anthony Sottile
f81c6c00a9 Merge pull request #7852 from asottile/py36_pyupgrade
py36+: pyupgrade: py36+
2020-10-04 08:25:32 -07:00
Ran Benita
1c08f1dd0f Merge pull request #7844 from bluetech/typing-fixtures
fixtures: some type annotations, remove cyclic dependency
2020-10-04 17:41:33 +03:00
Bruno Oliveira
7581f0b3a1 Merge pull request #7853 from albertvillanova/doc-patch-1 2020-10-04 09:15:46 -03:00
Albert Villanova del Moral
8593b57666 Update link to numpy 2020-10-04 08:54:43 +02:00
Ran Benita
d0a3f1dcbc nodes: remove cyclic dependency on _pytest.fixtures
- Change the fixtures plugin to store its one piece of data on the node's
  Store instead of directly.

- Import FixtureLookupError lazily.
2020-10-04 09:44:45 +03:00
Ran Benita
bf09e7792f fixtures: some type annotations 2020-10-04 09:43:58 +03:00
Ran Benita
7f794b7aff Merge pull request #7851 from bluetech/cherry-pick-release
Merge pull request #7849 from pytest-dev/release-6.1.1
2020-10-03 22:57:41 +03:00
Anthony Sottile
66bd44c13a py36+: pyupgrade: py36+ 2020-10-03 12:46:54 -07:00
Anthony Sottile
b1bcb9fba8 Merge pull request #7850 from asottile/py36_pathlib_export
py36+: remove rexport of Path and PurePath
2020-10-03 12:43:25 -07:00
Ran Benita
fd74dd3dcb Merge pull request #7849 from pytest-dev/release-6.1.1
Prepare release 6.1.1

(cherry picked from commit 69d903260d)
2020-10-03 22:38:33 +03:00
Anthony Sottile
fb1d550aac py36+: remove rexport of Path and PurePath 2020-10-03 12:16:52 -07:00
Anthony Sottile
022ac9b9e8 Merge pull request #7846 from asottile/py36_black
py36+: update the target version of black to py36
2020-10-03 11:45:45 -07:00
Anthony Sottile
3b957c2244 Merge pull request #7845 from pytest-dev/py36_overload
py36+: remove _pytest.compat.overload
2020-10-03 11:45:29 -07:00
Hugo van Kemenade
133e8af4ee Merge pull request #7805 from hugovk/pytest-rerunfailures
Smoke test pytest-rerunfailures
2020-10-03 20:17:06 +03:00
Anthony Sottile
f295b0267d py36+: update the target version of black to py36 2020-10-03 08:17:22 -07:00
Anthony Sottile
7f0d2beb50 py36+: remove _pytest.compat.overload 2020-10-03 08:01:22 -07:00
Anthony Sottile
6ed07a1c25 Merge pull request #7840 from asottile/py36_typing_Type
py36+: from typing import Type: no longer need guard
2020-10-03 07:44:06 -07:00
Anthony Sottile
aa077ab188 Merge pull request #7841 from asottile/py36_todo
py36+: resolve py36 TODOs
2020-10-03 07:43:15 -07:00
Anthony Sottile
c2a197f351 Merge pull request #7839 from asottile/py36_compat_fspath
py36+: remove _pytest.compat.fspath
2020-10-03 07:42:54 -07:00
Ran Benita
5efddd32db Merge pull request #7826 from bluetech/doc-final
doc: patch Sphinx to detect our `@final` for marking classes as `final`
2020-10-03 13:29:17 +03:00
Ran Benita
7705e5e624 doc: patch Sphinx to detect our @final for marking classes as final
Thanks to Dominic Davis-Foster for code & assistance.
2020-10-03 13:13:14 +03:00
Ran Benita
a6a7ba57e0 Merge pull request #7817 from bluetech/fix-testpaths-bestrelpath2
terminal: fix crash in header reporting when absolute testpaths is used
2020-10-03 12:59:18 +03:00
Anthony Sottile
53b5f64b4b py36+: resolve py36 TODOs 2020-10-02 19:57:55 -07:00
Anthony Sottile
bfadd4060e py36+: from typing import Type: no longer need guard 2020-10-02 19:50:10 -07:00
Anthony Sottile
be43c7c67b py36+: remove _pytest.compat.fspath 2020-10-02 19:49:32 -07:00
Anthony Sottile
a23666d554 Merge pull request #7838 from asottile/py36_requires_ordered_markup
py36+: remove requires_ordered_markup
2020-10-02 19:48:01 -07:00
Anthony Sottile
ced0a52a87 Merge pull request #7837 from asottile/py36_union_pattern_match
py36+: remove workaround for Union[Pattern/Match] bug
2020-10-02 19:47:50 -07:00
Anthony Sottile
2c7b7d8f66 Merge pull request #7836 from asottile/py36_typing_X
py36+: replace typing.X with X
2020-10-02 19:47:42 -07:00
Anthony Sottile
ac189885f6 Merge pull request #7835 from asottile/py36_misc
py36+: miscellaneous (3, 6) cleanup
2020-10-02 19:47:35 -07:00
Anthony Sottile
6ba13ed528 Merge pull request #7834 from asottile/py36_TYPE_CHECKING
py36+: remove TYPE_CHECKING from _pytest.compat
2020-10-02 19:47:27 -07:00
Anthony Sottile
a6ef0f8f67 Merge pull request #7833 from asottile/py36_ModuleNotFoundError
py36+: remove _pytest.compat.MODULE_NOT_FOUND_ERROR
2020-10-02 19:47:18 -07:00
Anthony Sottile
7836c2c371 Merge pull request #7832 from asottile/py36_pathlib2
py36+: remove pathlib2 compatibility shim
2020-10-02 19:47:10 -07:00
Bruno Oliveira
6ee1eadd1c Fake setuptools-scm into using version 6.2.0a1
Due to pytest-rerunfailures latest version requiring 6.1.0, which is not
tagged on master.
2020-10-02 23:40:50 -03:00
Anthony Sottile
daba7ceb71 py36+: remove requires_ordered_markup 2020-10-02 15:06:59 -07:00
Anthony Sottile
e622cb7c41 py36+: remove workaround for Union[Pattern/Match] bug 2020-10-02 15:06:02 -07:00
Anthony Sottile
cf220b92a2 py36+: replace typing.X with X 2020-10-02 15:05:13 -07:00
Anthony Sottile
284fd45a08 py36+: miscellaneous (3, 6) cleanup 2020-10-02 15:04:16 -07:00
Anthony Sottile
a238d1f37d py36+: remove TYPE_CHECKING from _pytest.compat
automated with:

```bash
git grep -l 'from .* import TYPE_CHECKING' |
    xargs reorder-python-imports \
        --application-directories .:src \
        --remove-import 'from _pytest.compat import TYPE_CHECKING' \
        --add-import 'from typing import TYPE_CHECKING'
```
2020-10-02 15:03:24 -07:00
Anthony Sottile
1f57fb079d py36+: remove _pytest.compat.MODULE_NOT_FOUND_ERROR 2020-10-02 15:02:45 -07:00
Anthony Sottile
3c93eb0f04 py36+: remove pathlib2 compatibility shim 2020-10-02 14:59:07 -07:00
Anthony Sottile
325b988ca8 Merge pull request #7831 from asottile/py36_drop_in_CI
py36+: drop python3.5 in CI and setup.cfg
2020-10-02 14:55:02 -07:00
Anthony Sottile
179f4326df py36+: drop python3.5 in CI and setup.cfg 2020-10-02 14:00:11 -07:00
Max Voitko
cb0a13a523 Fix minor typos in doctest.rst (#7828) 2020-10-02 15:39:15 +02:00
Ran Benita
b250c9d615 Merge pull request #7813 from bluetech/findpaths-confusion
findpaths: fix regression causing incorrect rootdir to be determined
2020-09-30 13:21:18 +03:00
Ran Benita
3ecdad67b7 terminal: improve condition on whether to display testpaths in header
Make it match better the condition on whether testpaths is used (found
in config/__init__.py).
2020-09-29 15:23:47 +03:00
Ran Benita
61f80a783a terminal: fix crash in header reporting when absolute testpaths is used
Regressed in 6.1.0 in 62e249a1f9.
The `x` is an `str` but is expected to be a `pathlib.Path`. Not caught
by mypy because `config.getini()` returns `Any`.

Fix by just removing the `bestrelpath` call:

- testpaths are always relative to the rootdir, it thus would be very
  unusual to specify an absolute path there.

- The code was wrong even before the regression: `py.path.local`'s
  `bestrelpath` function expects a `py.path.local`, not an `str`. But it
  had some weird `try ... except AttributeError` fallback which just
  returns the argument, i.e. it was a no-op. So there is no behavior
  change.

- It seems reasonable to me to just print the full path if that's what
  the ini specifies.
2020-09-29 15:23:47 +03:00
Ran Benita
db08c7fbb0 pathlib: improve comments on commonpath and bestrelpath 2020-09-29 13:11:47 +03:00
Hugo van Kemenade
875f226d3b Smoke test pytest-rerunfailures 2020-09-29 12:47:46 +03:00
Ran Benita
cd67c2a8cf Merge pull request #7802 from bluetech/bump-attrs
Bump attrs requirement from >=17.4.0 to >=19.2.0
2020-09-28 19:30:58 +03:00
Ran Benita
4a9192f727 findpaths: fix regression causing incorrect rootdir to be determined
When switching from py.path.local to pathlib (70f3ad1c1f),
`local.parts(reverse=True)` was translated incorrectly, leading to the
wrong rootdir being determined in some non-trivial cases where parent
directories have config files as well.
2020-09-28 19:13:01 +03:00
Jakob van Santen
91fa11bed0 python_api: let approx() take nonnumeric values (#7710)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-28 12:17:23 -03:00
Ran Benita
f324b27d02 Merge pull request #7748 from nicoddemus/fix-plugin-order-docs
Improve docs about plugin discovery/loading at startup
2020-09-27 13:19:58 +03:00
Ran Benita
32bb8f3a63 Bump attrs requirement from >=17.4.0 to >=19.2.0
This allows us to remove the `ATTRS_EQ_FIELD` thing which is causing
some annoyance.
2020-09-27 13:17:59 +03:00
Anthony Sottile
28ba9ab737 Merge pull request #7801 from pytest-dev/fix-bot-typo
Fix typos in pytestbot
2020-09-26 15:53:14 -07:00
Hugo van Kemenade
14de6781d8 Fix typos in pytestbot 2020-09-26 23:46:58 +03:00
Ran Benita
e0ea00a70d Merge pull request #7798 from bluetech/cherry-pick-release
Cherry-pick 6.1.0 release notes
2020-09-26 21:24:11 +03:00
Ran Benita
19c78ab574 Merge pull request #7797 from pytest-dev/release-6.1.0
Prepare release 6.1.0

(cherry picked from commit 08a1ab3a8a)
2020-09-26 21:11:48 +03:00
Ran Benita
0b327cc75b Merge pull request #7796 from bluetech/changelog-cleanups
changelog: some consistency cleanups
2020-09-26 20:13:45 +03:00
Ran Benita
d3c746eb8e changelog: some consistency cleanups 2020-09-26 20:04:17 +03:00
Kamran Ahmad
d3f47bf346 Improved 'Declaring new hooks' section in docs. (#7782)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-23 11:15:55 -03:00
Bruno Oliveira
3db24893b4 Merge pull request #7784 from nicoddemus/use-new-pip-solver-7783
Use new pip resolver in plugins tox env
2020-09-23 09:32:02 -03:00
Bruno Oliveira
8215625135 Use new pip resolver in plugins tox env
Fix #7783
2020-09-23 09:16:48 -03:00
Ran Benita
5cfd7c0ddd Merge pull request #7780 from bluetech/final
Mark some public and to-be-public classes as `@final`
2020-09-23 13:42:11 +03:00
Ran Benita
a99ca879e7 Mark some public and to-be-public classes as @final
This indicates at least for people using type checkers that these
classes are not designed for inheritance and we make no stability
guarantees regarding inheritance of them.

Currently this doesn't show up in the docs. Sphinx does actually support
`@final`, however it only works when imported directly from `typing`,
while we import from `_pytest.compat`.

In the future there might also be a `@sealed` decorator which would
cover some more cases.
2020-09-22 12:40:40 +03:00
Bruno Oliveira
050c2df737 Use multiple issue template types and mention Discussions (#7739) 2020-09-21 20:22:25 +02:00
Bruno Oliveira
7324e90199 Update doc/en/writing_plugins.rst
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-09-19 16:14:28 -03:00
Bruno Oliveira
cdfdb3a25d Add docs about reusing fixtures from other projects (#7772)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-09-19 16:10:22 -03:00
Ran Benita
8eefe4eaf5 Merge pull request #7741 from bluetech/releasing-order
RELEASING: ~~first merge PR, then tag~~ clarify where to push the tag
2020-09-19 22:01:00 +03:00
Sorin Sbarnea
b031a7cecf Smoke tests for assorted plugins (#7721)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2020-09-19 15:56:52 -03:00
Ran Benita
027415502a RELEASING: clarify where to push the tag 2020-09-19 21:35:17 +03:00
Ran Benita
9f164b7227 Merge pull request #7766 from nicoddemus/backporting-docs
Add guidelines section about backporting
2020-09-19 21:18:41 +03:00
Ran Benita
4e460cdd9e Merge pull request #7773 from nicoddemus/xml-properties-xdist-docs
Warning about record_testsuite_property not working with xdist
2020-09-19 21:06:40 +03:00
Florian Bruhin
89305e7b09 Improve output for missing config keys (#7572)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-19 12:57:29 -03:00
Bruno Oliveira
c4ce5f2c98 Warning about record_testsuite_property not working with xdist
Related to #7767
2020-09-19 12:36:08 -03:00
Bruno Oliveira
9bfd14a443 Merge pull request #7749 from bluetech/fix-get_source-crash 2020-09-19 10:38:32 -03:00
Bruno Oliveira
895a8cf296 Add guidelines section about backporting
From https://github.com/pytest-dev/pytest/pull/7723#issuecomment-693310439
2020-09-17 10:06:04 -03:00
Bruno Oliveira
98608c439f Merge pull request #7760 from finn0/docs/punctuation-mark
[Docs] remove semi-colon punctuation mark
2020-09-16 12:42:20 -03:00
Faris A Chugthai
9ceb4e6efc Mistyped was mistyped (#7762) 2020-09-16 12:18:03 +02:00
Sorin Sbarnea
da21fc5883 Improve output for missing required plugins/unknown config keys (#7723)
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2020-09-16 12:13:17 +02:00
Vipul Kumar
7470270f20 [Docs] remove semi-colon punctuation mark
Usually, we use semi-colon punctuation mark to connect closely related
ideas. Sentences which are after semicolon, begins with small letter,
and last sentence always ends with a period mark, see "Garner's Modern
American Usage" book for more information about usage of punctuation
mark. So removing punctuation mark altogether is a good idea, as
@gnikonorov suggested [1].

[1]: https://github.com/pytest-dev/pytest/pull/7760#pullrequestreview-489232607
2020-09-16 06:17:17 +00:00
Faris A Chugthai
cdf2024070 Update writing_plugins.rst (#7757)
Capitalize the first word in a sentence and add a period at the end.
2020-09-15 16:41:27 +02:00
Bruno Oliveira
f42c0cd1ec Merge pull request #7747 from nicoddemus/cmdline-flags-docs
Add full command-line flags to the reference docs
2020-09-14 13:47:43 -03:00
Bruno Oliveira
4b46db8ae5 Add full command-line flags to the reference docs
Fix #7728
2020-09-14 13:42:06 -03:00
Anthony Sottile
7f7e383daf Merge pull request #7753 from pytest-dev/asottile-patch-1
Update to deadsnakes/action@v2.0.0
2020-09-14 08:55:25 -07:00
Anthony Sottile
a5fd2895b6 Update to deadsnakes/action@v2.0.0
should be a noop (despite the major version bump) -- I rewrote the action to be more stable and need fewer security updates
2020-09-13 12:55:56 -07:00
Anthony Sottile
bc0020ad96 Merge pull request #7750 from pytest-dev/graingert-patch-1
permit tox config in non-tox.ini files for pytest-dev member projects
2020-09-13 09:37:35 -07:00
Anthony Sottile
e04bc05e7e Merge pull request #7751 from pytest-dev/graingert-patch-2
remove unused bitbucket link
2020-09-12 20:16:38 -07:00
Thomas Grainger
51752108b8 remove unused bitbucket link 2020-09-13 03:02:10 +01:00
Thomas Grainger
24c26a046e permit tox config in non-tox.ini files for pytest-dev member projects 2020-09-13 00:41:00 +01:00
Ran Benita
d18cb961cf assertion/rewrite: fix internal error on collection error due to decorated function
For decorated functions, the lineno of the FunctionDef AST node points
to the `def` line, not to the first decorator line. On the other hand,
in code objects, the `co_firstlineno` points to the first decorator
line.

Assertion rewriting inserts some imports to code it rewrites. The
imports are inserted at the lineno of the first statement in the AST. In
turn, the code object compiled from the rewritten AST uses the lineno of
the first statement (which is the first inserted import).

This means that given a module like this,

```py
@foo
@bar
def baz(): pass
```

the lineno of the code object without assertion rewriting
(`--assertion=plain`) is 1, but with assertion rewriting it is 3.

And *this* causes some issues for the exception repr when e.g. the
decorator line is invalid and raises during collection. The code becomes
confused and crashes with

INTERNALERROR>   File "_pytest/_code/code.py", line 638, in get_source
INTERNALERROR>     lines.append(space_prefix + source.lines[line_index].strip())
INTERNALERROR> IndexError: list index out of range

Fix it by special casing decorators. Maybe there are other cases like
this but off hand I can't think of another Python construct where the
lineno of the item would be after its first line, and this is the only
such issue we have had reported.
2020-09-12 23:05:08 +03:00
Ran Benita
35350e11cd assertion/rewrite: rewrite condition to be easier to follow 2020-09-12 22:57:50 +03:00
Bruno Oliveira
541b30a044 Improve docs about plugin discovery/loading at startup
Fix #7691
2020-09-12 14:11:43 -03:00
Bruno Oliveira
634cde9506 Merge pull request #7745 from asottile/exec_globals_type_problem
Fix INTERNALERROR when accessing locals / globals with faulty `exec`
2020-09-12 08:09:48 -03:00
Bruno Oliveira
ec58ae5bae Merge pull request #7736 from nicoddemus/extend-fixture-parametrize-1953 2020-09-12 08:08:31 -03:00
Anthony Sottile
96a17b1683 Fix INTERNALERROR when accessing locals / globals with faulty exec 2020-09-11 18:13:48 -07:00
Ran Benita
389e30283c Merge pull request #7744 from bluetech/cherry-pick-release
Merge pull request #7720 from pytest-dev/release-6.0.2
2020-09-12 02:21:41 +03:00
Ran Benita
e0dd2111a0 Merge pull request #7720 from pytest-dev/release-6.0.2
Prepare release 6.0.2

(cherry picked from commit fe69bd5baf)
2020-09-12 02:05:47 +03:00
Bruno Oliveira
e36adbaadc Use ParameterSet to extract argnames from parametrize mark 2020-09-11 16:53:34 -03:00
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
Ran Benita
78ed3e48db Merge pull request #7729 from bluetech/doc-fix-crossrefs
doc: fix a few broken cross references
2020-09-11 12:44:29 +03:00
Bruno Oliveira
9c0e0c756a Merge pull request #7734 from pytest-dev/asottile-patch-1
Update pytest-dev requirements
2020-09-09 10:37:03 -03:00
Joseph Lucas
6ae0f741ef Add example for __test__ (#7733)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-09-09 10:33:39 -03:00
Anthony Sottile
7da6ebede0 Update pytest-dev requirements
- be more vague about "packaging metadata" over explicitly mentioning `setup.py`
  (such that `pyproject.toml`-based distributions are allowed)
- drop extensions on `README.txt` / `LICENSE.txt` (it's more common to have `.md`
  / `.rst` / no extension)
- remove duplicate mention of license packaging metadata
2020-09-08 09:52:59 -07:00
Ran Benita
e503c9a9f8 doc: fix broken cross references 2020-09-06 19:06:43 +03:00
Anthony Sottile
4df39e3a1d Merge pull request #7722 from The-Compiler/update-trainings
doc: Remove Workshoptage training
2020-09-05 18:00:34 -07:00
Florian Bruhin
5bdfd719e6 doc: Remove Workshoptage training
The sign-up is closed.
2020-09-05 18:11:23 +02: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
Bruno Oliveira
54f7a87ea8 Merge pull request #7714 from bluetech/doc-prefer-public
doc: prefer to reference by public name when possible
2020-09-04 20:39:03 -03:00
Bruno Oliveira
db12d79c2a Merge pull request #7713 from bluetech/doc-one-pm
doc/reference: include PluginManager in PytestPluginManager and remove it
2020-09-04 20:38:20 -03:00
Bruno Oliveira
44fc0192bc Merge pull request #7719 from nicoddemus/fix-release-script
Use tox to execute release script
2020-09-04 18:45:29 -03:00
Bruno Oliveira
5371be4cf6 Use tox to execute release script
The release-on-comment script is always executed on *master*, so we should
execute the `release.py` script using tox to ensure we create the
right environment.

Also fixed errors in the error handling code.
2020-09-04 18:35:54 -03:00
Ran Benita
0ca2327069 doc: prefer to reference by public name when possible
When a name is exported from `pytest`, prefer to refer to it by that
rather than its `_pytest` import path. It is shorter and more
appropriate in user-facing documentation (although that's not really
visible).

Our plan is to expose more names for typing purposes, in which can this
could be more comprehensive.
2020-09-04 20:46:15 +03:00
Ran Benita
48a8c373a0 doc/reference: include PluginManager in PytestPluginManager and remove it
Before, `PluginManager` was a copy of the pluggy doc, and
`PytestPluginManager` was documented separately.

pytest users only really need to know about `PytestPluginManager`, so
instead of splitting have the `PytestPluginManager` documentation
include all of `PluginManager` members and remove `PluginManager` from
the reference (it is still shown as the base class).
2020-09-04 20:14:39 +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
62e249a1f9 Replace some usages of config.{rootdir,inifile} with config.{rootpath,inipath} 2020-09-04 18:05:42 +03:00
Ran Benita
a346028006 config: add Config.{rootpath,inipath}, turn Config.{rootdir,inifile} to properties 2020-09-04 18:04:25 +03:00
Ran Benita
3085c99e47 config: small doc improvements 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
Anthony Sottile
91dbdb6093 Merge pull request #7698 from bluetech/rm-scopedproperty
fixture: remove `@scopeproperty`
2020-08-28 17:26:10 -07:00
Bruno Oliveira
877c62166a Merge pull request #7699 from bluetech/optimize-makeitem
python: small optimization in PyCollector.collect()
2020-08-28 09:53:00 -03:00
Bruno Oliveira
21aa6c42b7 Merge pull request #7697 from nicoddemus/file-docs 2020-08-28 09:52:02 -03:00
Bruno Oliveira
ceea6000ba Add missing File reference to the docs
As related in #7696
2020-08-28 08:49:22 -03:00
Ran Benita
12de92cd2b fixture: remove @scopeproperty
I think the straight code is easier to understand.
2020-08-28 10:02:02 +03:00
Ran Benita
daca174c98 python: small optimization in PyCollector.collect()
Inline `_makeitem()` so that `self.ihook` (which is moderately
expensive) can be called only once.

Note: the removed test "test_makeitem_non_underscore" comes from an old
behavior of skipping names that start with `_` which has since been
generalized, making the test no longer relevant.
2020-08-27 10:18:37 +03:00
Ran Benita
2fcf763d7e Merge pull request #7671 from bluetech/ignored-names
RFC: python: skip work pytest_pycollect_makeitem work on certain names
2020-08-27 10:03:09 +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
Bruno Oliveira
8730a7bb14 Merge pull request #7687 from bluetech/idval-notset
python: fix empty parametrize() leading to "NotSetType.token" id
2020-08-25 19:48:26 -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
Florian Bruhin
00996adeb8 Update talks/trainings page (#7661)
* Update talks/trainings page

- Remove past webinar
- Add new open training
- Add some talks/webinars by Oliver Bestwalter and by me
- Remove some stale link targets

* Move sidebar to index
2020-08-25 17:02:33 +02:00
Ran Benita
ff41e7ad5d Merge pull request #7670 from bluetech/session-inline
Start simplifying collection code in Session
2020-08-25 10:28:07 +03:00
Ran Benita
c1f975668e main: couple of code simplifications 2020-08-24 18:15:11 +03:00
Ran Benita
023f0510af main: move collection cache attributes to local variables in collect()
They are only used for the duration of this function.
2020-08-24 18:15:11 +03:00
Ran Benita
c867452488 main: inline matchnodes() into collect()
Now all of the logic is in one place and may be simplified and
refactored in more sensible way.
2020-08-24 18:15:11 +03:00
Ran Benita
d0e8b71404 main: inline _collect() into collect()
This removes an unhelpful level of indirection and enables some upcoming
upcoming simplifications.
2020-08-24 18:15:11 +03:00
Ran Benita
eec13ba57e main: get rid of NoMatch
Things are easier to understand without the weird exception.
2020-08-24 18:15:11 +03:00
Ran Benita
c4fd461617 main: better name for _collection_node_cache3
The weird name was due to f3967333a1, now
that I understand it a bit better can give it a more descriptive name.
2020-08-24 18:15:11 +03:00
Ran Benita
c2256189ae main: make matchnodes non-recursive
It's a little more sane this way.
2020-08-24 18:15:11 +03:00
Ran Benita
841521fedb main: only perform one recursive matchnodes call per node 2020-08-24 18:15:11 +03:00
Ran Benita
0c6b2f39b2 main: move NoMatch raising to _collect()
This is a more sensible interface for matchnodes.

This also fixes a sort-of bug where a recursive call to matchnodes
raises NoMatch which would terminate the entire tree, even if other
branches may find a match. Though I don't think it's actually possible.
2020-08-24 18:15:11 +03:00
Ran Benita
a2c919d350 main: refactor a bit to reduce indentation 2020-08-24 18:15:11 +03:00
Ran Benita
adaec2da90 main: remove impossible condition in matchnodes
Already covered in a condition above.
2020-08-24 18:15:11 +03:00
Ran Benita
1b2de81404 main: remove unneeded condition in matchnodes
The end result in the `else` branch is the same, but flows naturally.
2020-08-24 18:15:11 +03:00
Ran Benita
5356a0979a main: small code simplification in matchnodes 2020-08-24 18:15:11 +03:00
Ran Benita
0b41b79dcb main: better solution to a type ignore 2020-08-24 18:15:11 +03:00
Ran Benita
57aca11d4a hookspec: type annotate parent argument to pytest_collect_file 2020-08-24 18:15:11 +03:00
Ran Benita
4b8e1a1771 Revert "Move common code between Session and Package to FSCollector"
This reverts commit f10ab021e2.

The commit was good in that it removed a non-trivial amount of code
duplication. However it was done in the wrong layer (nodes.py) and split
up a major part of the collection (the filesystem traversal) to a
separate class making it harder to understand.

We should try to reduce the duplication, but in a more appropriate
manner.
2020-08-24 18:15:11 +03:00
Ran Benita
32edc4655c main: inline Session._matchnodes() into Session.matchnodes()
Similar to the previous commit, this makes things more straightforward.
2020-08-24 18:15:11 +03:00
Ran Benita
d121d7c917 main: inline Session._perform_collect() into perform_collect()
It doesn't add much, mostly just an eye sore, particularly with the
overloads.
2020-08-24 18:15:10 +03:00
Ran Benita
1dad5c6433 Merge pull request #7669 from bluetech/collection-doc
hookspec: improve collection phase documentation a bit
2020-08-24 14:57:37 +03:00
Ran Benita
172b6e15c5 hookspec: improve collection phase documentation a bit
Make it a bit more accurate and use the same format that
pytest_runtest_protocol uses.
2020-08-24 13:00:09 +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
Bruno Oliveira
6cf89338d3 Merge pull request #7677 from bluetech/flaky-no-tests-ran
testing: fix flaky test when executed slowly
2020-08-23 09:25:26 -03:00
Ran Benita
b47b488e3d testing: fix flaky test when executed slowly
The 0-1 was a bit too optimistic: CI got "no tests ran in 3.98s".
2020-08-23 12:32:30 +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
837687c21a Merge pull request #7668 from bluetech/dir-match-msg
main: improve message on `pytest path/to/a/directory::mytest`
2020-08-23 12:05:22 +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
Ran Benita
5e39cd5e71 main: improve message on pytest path/to/a/directory::mytest
The path part of a `<path>::part1::part2` style collection argument must
be a file, not a directory.

Previously this crashed with an uncool assert "invalid arg".
2020-08-22 11:52:54 +03:00
Bruno Oliveira
d69abff2c7 Merge pull request #7660 from nicoddemus/deprecated-features 2020-08-19 09:04:10 -03:00
Bruno Oliveira
372a094005 PytestDeprecationWarning no longer a hard error 2020-08-19 08:14:28 -03:00
Bruno Oliveira
7605150eaa Move --no-print-logs removal notice to 'Removed Features' 2020-08-19 08:14:28 -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
52b0cc4f19 Remove broken pytest_collect_directory hook 2020-08-19 08:14:25 -03:00
Bruno Oliveira
457d351941 Remove deprecated TerminalReporter.writer property 2020-08-19 08:13:34 -03:00
Bruno Oliveira
345a59dd53 Add note about pytest.collect deprecation 2020-08-19 08:13:06 -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
b426bb3443 Refactor Session._parsearg into a separate function for testing 2020-08-15 13:23:55 -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
Bruno Oliveira
f76b162263 Add ref to Python bug 2020-08-14 11:36:07 -03:00
Ran Benita
d426a79a90 Merge pull request #7645 from bluetech/pylint-abc
Don't use NotImplementedError in `@overload`s
2020-08-14 15:33:35 +03:00
Ran Benita
f28af14457 Don't use NotImplementedError in @overloads
We used it as a shortcut for avoiding coverage, but pylint has a special
interpretation of it as an abstract method which we don't want.
2020-08-14 13:54:46 +03:00
Ran Benita
2c5403b951 Merge pull request #7644 from bluetech/changelog-7631
Add changelog for PR #7631
2020-08-14 11:54:31 +03:00
Ran Benita
8056a677b4 Add changelog for PR #7631 2020-08-14 11:02:44 +03:00
Thomas Grainger
02c6e4455c document toml use of filterwarnings (#7611)
and include a demo of toml 'literal strings'

Update doc/en/warnings.rst
Apply suggestion by Ran
Fix linting

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-08-14 10:08:17 +03:00
Bruno Oliveira
10f98e1d2f Merge pull request #7641 from hynek/patch-1
Replace inactive Azure Pipelines badge with GHA
2020-08-13 11:49:45 -03:00
Hynek Schlawack
82181fde3e Replace inactive Azure Pipelines badge with GHA
Currently the badge encourages you to set it up now. :)
2020-08-13 14:18:36 +02: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
Ran Benita
4c92584364 Merge pull request #7631 from bluetech/capture-1
capture: add type annotations to CaptureFixture
2020-08-10 18:38:05 +03:00
Ran Benita
acc9310c17 capture: add type annotations to CaptureFixture
It now has a str/bytes type parameter.
2020-08-10 18:14:47 +03:00
Ran Benita
8a66f0a96d capture: overcome a mypy limitation by making CaptureResult a regular class
See the code comment for the rationale.
2020-08-10 18:14:47 +03:00
Bruno Oliveira
bee72e1925 Merge pull request #7629 from samestep/patch-1
Fix typos in Ali Afshar's name
2020-08-07 20:02:26 -03:00
Sam Estep
a27c539a85 Fix typos in Ali Afshar's name
The correct name is visible in the Bitbucket link.
2020-08-07 15:22:10 -07:00
Ran Benita
384b6f6866 Merge pull request #7619 from bluetech/py-to-pathlib
Some py.path -> pathlib conversions
2020-08-07 11:33:21 +03:00
Ran Benita
f8c4e038fd Replace some usages of py.path.local 2020-08-06 18:46:17 +03:00
Ran Benita
70f3ad1c1f config/findpaths: convert from py.path.local to pathlib 2020-08-06 18:46:17 +03:00
Ran Benita
9e55288ba4 pathlib: add absolutepath() as alternative to Path.resolve()
Didn't call it absolute or absolute_path to avoid conflicts with
possible variable names.

Didn't call it abspath to avoid confusion with os.path.abspath.
2020-08-06 18:16:04 +03:00
Ran Benita
e0d0951945 pathlib: add analogues to py.path.local's bestrelpath and common
An equivalent for these py.path.local functions is needed for some
upcoming py.path -> pathlib conversions.
2020-08-06 18:16:04 +03:00
Ran Benita
aa9905d72e Merge pull request #7625 from nicoddemus/pypy3-async-unittest-7624
Fix test_plain_unittest_does_not_support_async on pypy3
2020-08-06 08:31:46 +03:00
Bruno Oliveira
67cb7ef673 Fix test_plain_unittest_does_not_support_async on pypy3
Fix #7624
2020-08-05 15:24:08 -03:00
Rüdiger Busche
a64298ff5e Document registering markers in pyproject.toml (#7622)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-08-05 12:03:27 -03:00
Bruno Oliveira
44cd8a3a86 Demonstrate that plain unittest does not support async tests (#7607)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-08-04 19:37:41 -03:00
Ran Benita
2bd0d97fcc Merge pull request #7601 from bluetech/typing-longrepr
typing: resultlog, pytester, longrepr
2020-08-04 23:23:56 +03:00
Ran Benita
fbf251f11d Improve typing of reports' longrepr field 2020-08-04 22:52:24 +03:00
Ran Benita
f0eb82f7d4 pytester: improve type annotations 2020-08-04 22:46:30 +03:00
Ran Benita
62ddf7a0e5 resultlog: add missing type annotations 2020-08-04 22:45:46 +03:00
Ran Benita
303030c141 Merge pull request #7613 from bluetech/typing-warn-unreachable
typing: set warn_unreachable
2020-08-04 22:44:21 +03:00
Bruno Oliveira
0d65e4b454 Merge pull request #7606 from nicoddemus/pre-release-docs
Add docs for releasing major/release candidates
2020-08-04 15:37:19 -03:00
Yutaro Ikeda
84c4b64354 Better document -k partial matching (#7610) 2020-08-04 15:30:08 -03:00
Bruno Oliveira
d688fefecb Merge pull request #7614 from The-Compiler/log-print
Properly remove log_print
2020-08-04 13:39:21 -03:00
Ran Benita
9ab14c6d9c typing: set warn_unreachable
This makes mypy raise an error whenever it detects code which is
statically unreachable, e.g.

    x: int
    if isinstance(x, str):
        ... # Statement is unreachable  [unreachable]

This is really neat and finds quite a few logic and typing bugs.

Sometimes the code is intentionally unreachable in terms of types, e.g.
raising TypeError when a function is given an argument with a wrong
type. In these cases a `type: ignore[unreachable]` is needed, but I
think it's a nice code hint.
2020-08-04 09:59:46 +03:00
Florian Bruhin
1c9b84756f Properly remove log_print
This is a follow up to 3f8200676f which didn't
make it clear that log_print is also removed in the changelog and didn't remove
it from the reference docs.
2020-08-04 08:53:09 +02:00
Ran Benita
0dd5e169d0 Merge pull request #7603 from bluetech/flake8-docstrings
Enforce some pydocstyle lints with flake8-docstrings & docstring fixes in testing/
2020-08-04 08:15:55 +03:00
Ran Benita
9a18b57c7c Enforce some pydocstyle lints with flake8-docstrings
There are some ones we *would* like to enforce, like
    D401 First line should be in imperative mood
but have too many false positives, so I left them out.
2020-08-03 10:21:59 +03:00
Ran Benita
b8471aa527 testing: fix some docstring issues
In preparation for enforcing some docstring lints.
2020-08-03 10:10:43 +03:00
Anthony Sottile
701998bf2c Merge pull request #7598 from nicoddemus/setuptools-scm-pyproject
Configure setuptools_scm using pyproject.toml
2020-08-01 19:17:33 -07:00
Ran Benita
be354b36f3 Merge pull request #7604 from bluetech/typing-disallow-any-generics
typing: set disallow_any_generics
2020-08-01 20:55:45 +03:00
Ran Benita
be656dd4e4 typing: set disallow_any_generics
This prevents referring to a generic type without filling in its generic
type parameters.

The FixtureDef typing might need some more refining in the future.
2020-08-01 20:39:15 +03:00
Bruno Oliveira
d1fa749b83 Add readthedocs config file to use pip for installation 2020-08-01 14:21:36 -03:00
Bruno Oliveira
d7ad55bb2a Add docs for releasing major/release candidates
Fix #7447
2020-08-01 13:51:12 -03:00
Ran Benita
1e9c638468 Merge pull request #7602 from ctb/patch-1
Minor formatting fix in xunit_setup.rst
2020-08-01 18:08:03 +03:00
C. Titus Brown
a2d562d369 Minor formatting fix in xunit_setup.rst
Fixed location of double-backquote for verbatim text.
2020-08-01 07:33:03 -07:00
Ran Benita
49827adcb9 Merge pull request #7510 from bluetech/docstrings
Format docstrings in a consistent style
2020-08-01 17:32:01 +03:00
Ran Benita
cbec0f8c6a CONTRIBUTING: document the docstring style we use 2020-08-01 17:14:38 +03:00
Ran Benita
0242de4f56 Format docstrings in a consistent style 2020-08-01 17:14:37 +03:00
Bruno Oliveira
6882c0368b Merge pull request #7593 from bluetech/typing-no-implicit-reexport
typing: set no_implicit_reexport
2020-08-01 11:03:47 -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
Anthony Sottile
d5a49100cf Try this maybe? 2020-07-31 21:44:44 -07:00
Bruno Oliveira
4f0793a462 Require setuptools >=42 2020-07-31 18:17:12 -03:00
Bruno Oliveira
09265eb7c7 Configure setuptools_scm using pyproject.toml 2020-07-31 15:46:02 -03:00
Ran Benita
a1ba8dfe2a Merge pull request #7587 from bluetech/rm-more-itertools
Stop using more-itertools
2020-07-31 13:08:34 +03:00
Ran Benita
8d98de8f8a typing: set no_implicit_reexport
In Python, if module A defines a name `name`, and module B does `import
name from A`, then another module C can `import name from B`.

Sometimes it is intentional -- module B is meant to "reexport" `name`.
But sometimes it is just confusion/inconsistency on where `name` should
be imported from.

mypy has a flag `--no-implicit-reexport` which puts some order into
this. A name can only be imported from a module if

1. The module defines the name
2. The module's `__all__` includes the name
3. The module imports the name as `from ... import .. as name`.

This flag is included in mypy's `--strict` flag.

I like this flag, but I realize it is a bit controversial, and in
particular item 3 above is a bit unfriendly to contributors who don't
know about it. So I didn't intend to add it to pytest.

But while investigating issue 7589 I came upon mypy issue 8754 which
causes `--no-implicit-reexport` to leak into installed libraries and
causes some unexpected typing differences *in pytest* if the user uses
this flag.

Since the diff mostly makes sense, let's just conform to it.
2020-07-31 10:09:11 +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 022bff27a7)
2020-07-30 09:46:53 -03:00
Ran Benita
645cbc91fc Merge pull request #7581 from bluetech/logging-setlevel-handler-restore
Add missing changelog for issue 7569
2020-07-30 13:41:02 +03:00
Ran Benita
924e466c98 Add missing changelog for issue 7569 2020-07-30 12:38:40 +03:00
Hugo van Kemenade
d756b4a543 Fix typo: remove stray indefinite article from release notes (#7552)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-29 12:19:33 -03:00
Mattreex
1e66ed0b1c Warn about --basetemp removing the entire directory (#7555)
Co-authored-by: mattreex <mattreex.9@gail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-07-29 11:58:18 -03:00
Bruno Oliveira
49628786f0 Merge pull request #7575 from nicoddemus/fix-changelog-entries-release-process 2020-07-29 11:56:11 -03:00
Bruno Oliveira
22acbaf393 Minor changes to the release process
As discussed in https://github.com/pytest-dev/pytest/pull/7556
2020-07-29 11:35:27 -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
e8761576cd Merge pull request #7574 from nicoddemus/backport-7561
[6.0.x] Merge pull request #7561 from nicoddemus/longreprtext-7559
2020-07-29 10:30:21 -03:00
Bruno Oliveira
3d2c114883 Merge pull request #7573 from nicoddemus/backport-7571
[6.0.x] logging: fix capture handler level not reset on teardown after caplog.set_level()
2020-07-29 10:30:00 -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
f9d5f6e60a Merge pull request #7571 from bluetech/logging-setlevel-handler-restore
logging: fix capture handler level not reset on teardown after caplog.set_level()
2020-07-29 09:38:33 -03:00
Bruno Oliveira
cefe064bb0 Merge pull request #7571 from bluetech/logging-setlevel-handler-restore
logging: fix capture handler level not reset on teardown after caplog.set_level()
2020-07-29 09:37:57 -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
0e0275d8d9 logging: fix capture handler level not reset on teardown after caplog.set_level()
This probably regressed in fcbaab8.
2020-07-29 14:59:29 +03:00
Ran Benita
d46fe88ec3 Merge pull request #7566 from bluetech/pylint-callable-2-6.0.x
[6.0.x] mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
2020-07-29 13:04:23 +03:00
Ran Benita
bec1bdaa2c mark: fix extraneous spaces in dummy type-checking marks
(cherry picked from commit 54e08b7230)
2020-07-29 12:41:02 +03:00
Ran Benita
422685d0bd Merge pull request #7567 from bluetech/pylint-callable-2-space
mark: fix extraneous spaces in dummy type-checking marks
2020-07-29 12:40:21 +03:00
Ran Benita
b473e515bc Merge pull request #7541 from bluetech/py-visit
pathlib: stop using py.path.local.visit(), use os.scandir
2020-07-29 12:04:06 +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
54e08b7230 mark: fix extraneous spaces in dummy type-checking marks 2020-07-29 11:58:54 +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
c755840793 pre-commit: extend list of rejected py modules
We now only use `py.path.local`.
2020-07-29 10:52:21 +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
Ran Benita
1653c49b1b junitxml: simplify bin_xml_escape
1. Remove sys.maxunicode check & comment. Nowadays it is always a
   constant 0x10ffff.
2. Pre-generate the pattern. Possible due to 1.
3. Compile the regex lazily. No reason to pay startup cost for it.
4. Add docstring in particular to explain a subtle point.
2020-07-29 10:52:21 +03:00
Ran Benita
6ea6f0dac8 junitxml: compile a regex lazily
Instead of slowing down startup, and making the code harder to follow,
compile it lazily (it is still cached internally).
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
Drew Devereux
88cc636c18 Update markers.rst (#7563)
Extra colon to make code block render correctly
2020-07-29 09:10:13 +02:00
Bruno Oliveira
c7216ae0f6 Merge pull request #7557 from nicoddemus/announce-templates 2020-07-28 21:20:26 -03:00
Bruno Oliveira
df09a31646 Merge pull request #7556 from nicoddemus/cherry-pick-release
Merge pull request #7550 from pytest-dev/release-6.0.0
2020-07-28 21:04:26 -03:00
Bruno Oliveira
109b6cb32c Update text and links in announce templates
The links were still pointing to the latest version (instead of stable)
and also took the opportunity to update the text a bit.
2020-07-28 17:29:09 -03:00
Bruno Oliveira
70764bef4f Merge pull request #7550 from pytest-dev/release-6.0.0 2020-07-28 17:01:27 -03:00
Bruno Oliveira
5d606e9c40 Merge pull request #7550 from pytest-dev/release-6.0.0 2020-07-28 16:59:46 -03:00
Bruno Oliveira
41a4539594 Add link to 6.0.0rc1 changelog 2020-07-28 14:15:45 -03:00
Bruno Oliveira
45ced1dc05 Update doc/en/announce/release-6.0.0.rst
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-07-28 10:46:03 -03:00
pytest bot
1e4b8d447c Prepare release version 6.0.0 2020-07-28 11:44:27 +00:00
Bruno Oliveira
38029828d1 Support generating major releases using issue comments (#7548) 2020-07-28 13:40:14 +02:00
Anthony Sottile
c2c0b7a542 Merge pull request #7545 from asottile/pylib_in_docs
remove usage of pylib in docs
2020-07-27 09:36:58 -07:00
Anthony Sottile
9818899df4 remove usage of pylib in docs 2020-07-26 17:57:25 -07:00
Ran Benita
3633b691d8 pathlib: make visit() independent of py.path.local, use os.scandir
`os.scandir()`, introduced in Python 3.5, is much faster than
`os.listdir()`. See https://www.python.org/dev/peps/pep-0471/.

It also has a `DirEntry` which can be used to further reduce syscalls in
some cases.
2020-07-25 00:47:29 +03:00
Ran Benita
c15bb5d3de pathlib: replace py.path.local.visit() with our own function
Part of reducing dependency on `py`. Also enables upcoming improvements.

In cases where there are simpler alternatives (in tests), I used those.

What's left are a couple of uses in `_pytest.main` and `_pytest.python`
and they only have modest requirements, so all of the featureful code
from py is not needed.
2020-07-25 00:26:49 +03: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
Bruno Oliveira
a9799f0b35 Merge pull request #7531 from bluetech/changelog-mypy-version
doc: mention mypy<0.750 doesn't work in typing changelog
2020-07-22 16:21:11 -03:00
Ran Benita
102360b490 Merge pull request #7519 from hroncok/pytest_warning_captured_deprecated
List pytest_warning_captured in deprecated things for 6.0.0rc1
2020-07-22 20:50:52 +03:00
Ran Benita
1a18dfd651 doc: mention mypy<0.750 doesn't work in typing changelog 2020-07-22 20:48:24 +03:00
Bruno Oliveira
2a8dcc9728 Merge pull request #7526 from bluetech/win-bash-2
testing: improve bash check
2020-07-21 23:02:05 -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
Ran Benita
0709305953 testing: improve bash check 2020-07-21 21:21:09 +03:00
Anthony Sottile
6ecb8f53d0 Merge pull request #7521 from asottile/newlines_unaffected
Preserve newlines when captured with capfd
2020-07-20 11:48:08 -07:00
Ran Benita
2294f109b6 Merge pull request #7522 from garrettthomaskth/patch-1
Fix "A xfail" typo
2020-07-20 21:43:35 +03:00
Anthony Sottile
8616a5f1d9 Preserve newlines when captured with capfd 2020-07-20 10:31:20 -07:00
Garrett Thomas
3ed05ee4d6 Fix typo
Change from "A xfail" to "An xfail"
2020-07-20 18:16:13 +02:00
Ran Benita
41d211c24a testing: use a tighter check if bash is available (#7520)
This fixes CI on Windows since GitHub Actions started installing WSL on
their images which apparently installs some wrapper `bash` which does
not run actual bash.
2020-07-20 16:24:39 +02:00
Kostis Anagnostopoulos
07ed197247 doc: note about mutation of parametrized values (#7516)
Fix #7514 by augmenting Note with behaviour when parametrized values are mutated
(changes are reflected in subsequent test-case calls).
2020-07-20 15:12:48 +03:00
Miro Hrončok
fbeb36226f List pytest_warning_captured in deprecated things for 6.0.0rc1 2020-07-20 13:41:28 +02:00
Ran Benita
efcba7759e Merge pull request #7515 from mdebi/issue_7441
docs: Add a note about -q option used in getting started guide
2020-07-20 10:09:16 +03:00
Debi Mishra
25b56e9c69 docs: Add a note about -q option used in getting started guide 2020-07-20 01:28:11 +05:30
Ran Benita
8783e65f8d Merge pull request #7509 from bluetech/sphinx3
docs: support Sphinx>=3.1 and require it
2020-07-18 12:38:26 +03:00
Ran Benita
65b014a117 docs: support Sphinx>=3.1 and require it
Previously was restricted to >=1.8.2,<2.1, but newer versions have some
nice improvements I'd like to be able to use in upcoming changes.

Changelog: https://www.sphinx-doc.org/en/master/changes.html#release-3-1-0-released-jun-08-2020

There are two issues that came up:

1. `highlightlang` is deprecated for `highlight`.

2. Doesn't like having two `automethod` generated for the same
   `Metafunc.parametrize` method. Gives this warning:

   `pytest/doc/en/reference.rst:846: WARNING: duplicate object description of _pytest.python.Metafunc.parametrize, other instance in reference, use :noindex: for one of them`

   To work around this I make `pytest.mark.parametrize` link to
   `Metafunc.parametrize` instead of repeating it.
2020-07-17 23:17:11 +03:00
Lewis Cowles
71ab6236a1 Clearer guidance on pytest.raise(match=...) failure (#7499) 2020-07-15 22:26:47 +03:00
Bruno Oliveira
9c2c5d9f05 Merge pull request #7501 from nicoddemus/doctest-fixtures
Clarify 'getfixture' needs to access fixtures by normal means
2020-07-15 09:30:13 -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
Ran Benita
41c40efe80 Merge pull request #7496 from bluetech/typing-idfn
Fix typing of params ids callable form
2020-07-15 10:25:46 +03:00
Ran Benita
fe1fcfd081 Merge pull request #7490 from bluetech/fix-dynamic-runtest-xfail
skipping: fix dynamic xfail mark added in runtest not respected
2020-07-15 10:25:29 +03:00
Bruno Oliveira
97f560d4d1 Clarify 'getfixture' needs to access fixtures by normal means
Related to #7497
2020-07-14 20:21:57 -03:00
Ran Benita
bc17034a67 Fix typing of params ids callable form
The previous typing had an object passed to the user, which they can't
do anything with without asserting, which is inconvenient. Change it to
Any instead.

Note that what comes *back* to pytest (the return value) should be an
`object`, because we want to handle arbitrary objects without assuming
anything about them.
2020-07-14 14:53:42 +03:00
Ran Benita
91f6892e6a testing: add a file for checking no mypy errors
We probably something a bit more elaborate in the future but for now
it's something to verify fixes and catch regressions.
2020-07-14 14:37:59 +03:00
Anthony Sottile
358150c30e Merge pull request #7492 from bluetech/xfail-mark-typing-fix
mark: fix typing for `@pytest.mark.xfail(raises=...)`
2020-07-13 16:46:35 -07:00
Ran Benita
1a73e78698 mark: fix typing for @pytest.mark.xfail(raises=...) 2020-07-14 01:39:04 +03:00
Ran Benita
ccad10a829 skipping: fix dynamic xfail mark added in runtest not respected
If a test runtest phase (not setup) dynamically adds a pytest.mark.xfail
mark to the item, it should be respected, but it wasn't. This regressed
in 3e6fe92b7e (not released).

Fix it by just always refreshing the mark if needed. This is mostly what
was done before but in a more roundabout way.
2020-07-14 01:02:06 +03:00
Ran Benita
78f2dc08fa skipping: slight simplification 2020-07-14 00:45:12 +03:00
Bruno Oliveira
7f7a36478a Merge pull request #7482 from nicoddemus/changelog-adjustments
Small fixes/updates to the 6.0.0rc1 CHANGELOG
2020-07-13 15:11:47 -03:00
Bruno Oliveira
07f5f6fd4a Merge pull request #7481 from bluetech/tw-unicode-escape
terminalwriter: bring back handling of printing characters not supported by stdout
2020-07-11 16:01:45 -03:00
Bruno Oliveira
789654dfe2 Small fixes/updates to the 6.0.0rc1 CHANGELOG
- Grammar fixes
- Moved a few sections from Features to Improvements
- Used internal doc links when appropriate
2020-07-11 15:41:10 -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
Ran Benita
113339b029 terminalwriter: bring back handling of printing characters not supported by stdout 2020-07-11 18:59:00 +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
0b58f73d44 Merge pull request #7476 from bluetech/pylint-callable
mark/structure: fix pylint complaining that builtin marks are not callable
2020-07-10 17:26:37 -03:00
Bruno Oliveira
cf648d9cad Merge pull request #7474 from nicoddemus/env-vars-docs 2020-07-10 17:20:06 -03:00
Ran Benita
c1ca42b5c2 mark/structure: fix pylint complaining that builtin marks are not callable 2020-07-10 23:10:17 +03:00
Bruno Oliveira
906d8496c9 New doc role: globalvar for special variables
This introduces a new role, `:globalvar:`, so we can mark/reference
variables like `pytest_plugins`, `pytestmark`, etc. This besides being useful
also makes the documentation look more consistent.
2020-07-10 09:50:03 -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
Ran Benita
c8676002a7 code/code: remove redundant __ne__ implementation
This implementation is the default when __eq__ is implemented.
2020-07-10 13:08:56 +03:00
Ran Benita
85ef2bf698 code/code: remove Frame.exec_() method
Not used.
2020-07-10 13:08:56 +03:00
Ran Benita
c3864bc12b code/code: remove Frame.is_true() method
Really odd one, let's just inline it.
2020-07-10 13:08:56 +03:00
Ran Benita
77f3cb4baa code/code: type annotations & doc cleanups 2020-07-10 13:08:56 +03:00
Ran Benita
087b047426 cacheprovider: type annotations 2020-07-10 13:08:56 +03:00
Ran Benita
a2f021b6f3 Remove no longer needed noqa: F821 uses
Not needed since pyflakes 2.2.0.
2020-07-10 13:08:56 +03:00
Ran Benita
fc702ab7e4 fixtures: some type annotations 2020-07-10 13:08:56 +03:00
Ran Benita
168d9adefc hookspec: change Node -> Union[Item, Collector] to avoid exposing Node
We don't really want `Node` itself as a public API, only its two
subclasses.
2020-07-10 13:08:56 +03:00
Ran Benita
8e8d639276 tmpdir: type annotations 2020-07-10 13:08:56 +03:00
Ran Benita
bcff02c4c6 pytester: some type annotations 2020-07-10 13:08:56 +03:00
Ran Benita
c7a1db5d01 junitxml: few typing fixes & additions 2020-07-10 13:08:56 +03:00
Ran Benita
5da4a1d84f capture: type annotate return value of fixtures 2020-07-10 13:08:56 +03:00
Ran Benita
e079ebbd57 python: more type annotations 2020-07-10 13:08:56 +03:00
Ran Benita
fb2640b82f Stop using ExceptionInfo.errisinstance internally
It does the same as a simple isinstance check, but adds a little layer
of obscurity on top, which the type checker can't penetrate.
2020-07-10 13:08:48 +03:00
Ran Benita
2ae721cda5 Merge pull request #7470 from nicoddemus/fix-required-plugins-test
Make test_missing_required_plugins xdist-independent
2020-07-10 12:47:52 +03:00
Bruno Oliveira
be7b02c3b8 Make test_missing_required_plugins xdist-independent
Also cleaned up the parametrized list using `pytest.param` to assign ids
and removed some redundant cases.

Follow up to #7459
2020-07-09 22:09:28 -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
b22d466345 Remove duplicated users from release announcement 2020-07-08 17:51:57 -04:00
Bruno Oliveira
7d033a8950 Prepare release version 6.0.0rc1 2020-07-08 17:51:01 -04:00
Bruno Oliveira
64b19595a5 Set correct version during regen 2020-07-08 17:49:09 -04:00
Bruno Oliveira
d812690569 Adjust regendoc for getting-started 2020-07-08 17:49:09 -04:00
Bruno Oliveira
9db9f04432 Use builtin compile in doc example
Follow up to #7438
2020-07-08 17:49:09 -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
Bruno Oliveira
9caca5c434 Merge pull request #7454 from nicoddemus/remove-warning-banner 2020-07-08 10:11:08 -03:00
Bruno Oliveira
93d2ccbfb7 Point to stable docs instead of latest
Now that our master might contain new features, it is best to point
users to the stable docs rather than the latest
2020-07-07 07:45:27 -03:00
Bruno Oliveira
b6a31b9c4d Remove warning about development/outdated docs
Unfortunately couldn't figure out how to fix the generated link, so at least
for now remove it to avoid confusion.

Fix #7331
2020-07-06 20:28:30 -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
11efe057ea testing: skip some unreachable code in coverage 2020-07-04 12:12:52 +03:00
Ran Benita
40301effb8 Add changelog entry for code/source changes 2020-07-04 11:45:28 +03:00
Ran Benita
64dd7000e5 Merge pull request #7436 from bluetech/cleanup-lsof
pytester: slightly clean up LsofFdLeakChecker
2020-07-04 10:55:11 +03:00
Ran Benita
f76ac4c570 Merge pull request #7437 from bluetech/flaky-coroutine-never-awaited
testing: fix flaky tests due to "coroutine never awaited" warnings
2020-07-04 10:54:38 +03:00
Ran Benita
eced536eaf Merge pull request #7435 from bluetech/python-cleanups
python: a few cleanups
2020-07-04 10:54:07 +03:00
Ran Benita
bd4977eba8 Merge pull request #7442 from gnikonorov/issue_7439
fix mypy issue by using typing Match instead of re.Match
2020-07-03 10:23:52 +03:00
Gleb Nikonorov
e596b26f1a Don't quote the Match type since it's imported from Typing 2020-07-02 18:22:54 -04:00
Gleb Nikonorov
04d052e306 fix mypy issue by using typing Match instead of re.Match 2020-07-02 15:32:23 -04:00
Ran Benita
74f20f9fba Merge pull request #7434 from bluetech/distinct_log_handlers-rebased
logging: use unique handlers for caplog and reports
2020-07-01 20:54:55 +03:00
Ran Benita
c8cfff6de5 testing: fix flaky tests due to "coroutine never awaited" warnings
They sometime leak into other test's warnings and cause them to fail.
2020-07-01 20:29:04 +03:00
Ran Benita
f5c69f3eb2 code/source: inline getsource()
The recursive way in which Source and getsource interact is a bit
confusing, just inline it.
2020-07-01 20:20:13 +03:00
Ran Benita
ef39115001 code/source: remove compiling functions
A lot of complex code that isn't used anymore outside of tests after
the previous commit.
2020-07-01 20:20:12 +03:00
Ran Benita
9640c9c9eb skipping: use plain compile() instead of _pytest._code.compile()
eval() is used for evaluating string conditions in skipif/xfail e.g.

    @pytest.mark.skipif("1 == 0")

This is the only code that uses `_pytest._code.compile()`, so removing
its last use enables us to remove it entirely.

In this case it doesn't add much. Plain compile() gives a good enough
error message.

For regular exceptions, the message is the same.

For SyntaxError exceptions, e.g. "1 ==", the previous code adds a little
bit of useful context:

```
invalid syntax (skipping.py:108>, line 1)

The above exception was the direct cause of the following exception:
1 ==
     ^
(code was compiled probably from here: <0-codegen /pytest/src/_pytest/skipping.py:108>) (line 1)

During handling of the above exception, another exception occurred:
Error evaluating 'skipif' condition
    1 ==
         ^
SyntaxError: invalid syntax
```

The new code loses it:

```
unexpected EOF while parsing (<skipif condition>, line 1)

During handling of the above exception, another exception occurred:
Error evaluating 'skipif' condition
    1 ==
        ^
SyntaxError: invalid syntax
```

Since the old message is a minor improvement to an unlikely error
condition in a deprecated feature, I think it is not worth all the code
that it requires.
2020-07-01 20:20:12 +03:00
Ran Benita
4a27d7d973 code/source: remove unused method Source.putaround() 2020-07-01 20:20:11 +03:00
Ran Benita
a7303b52db code/source: remove unused method Source.isparseable() 2020-07-01 20:20:11 +03:00
Ran Benita
a127a22d13 code/source: remove support for comparing Source with str
Cross-type comparisons like this are a bad idea. This isn't used.
2020-07-01 20:20:10 +03:00
Ran Benita
2b99bfbc60 code/source: remove support for passing multiple parts to Source
It isn't used, so keep it simple.
2020-07-01 20:20:09 +03:00
Ran Benita
c83e16ab2e code/source: remove unneeded assert
inspect.getsource() definitely returns str.
2020-07-01 20:20:09 +03:00
Ran Benita
c6083ab970 code/source: remove old IndentationError workaround in getsource()
This has been there since as far as the git history goes (2007), is not
covered by any test, and says "Buggy python version consider upgrading".
Hopefully everyone have upgraded...
2020-07-01 20:20:08 +03:00
Ran Benita
4108174777 code/source: remove Source(deindent: bool) parameter
Not used, except in tests.
2020-07-01 20:20:07 +03:00
Ran Benita
2fe178488a code/source: expose deindent kwarg in signature
Probably was done to avoid the shadowing issue, but work around it
instead.
2020-07-01 20:20:06 +03:00
Ran Benita
7b1ba7c0db pytester: slightly clean up LsofFdLeakChecker 2020-07-01 19:39:48 +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
Ran Benita
ae83dbd4cf python: remove ancient Function.repr_failure(outerr) parameter
This has been asserted like this since 04e9197fd6
(i.e. 11 years, pytest 1.0), seems safe to simply remove at this point.
2020-06-30 13:14:03 +03:00
Ran Benita
40c355f8c3 python: pytest_pycollect_makeitem doesn't need to be a hookwrapper
A trylast is more appropriate for this usecase.

hookwrappers are more complicated and more expensive than regular
hookimpls, so better avoided.
2020-06-30 13:14:03 +03:00
Ran Benita
e492b1d567 python: don't pass entire Item for generating ID
Just the nodeid is enough for the error messages.
This removes an import cycle.
2020-06-30 13:13:45 +03:00
Ran Benita
e6e300e729 Merge pull request #7396 from gnikonorov/issue_7295
Refactor src/_pytest/config/__init__.py to use the warnings module instead of stderr for warnings
2020-06-28 18:02:07 +03:00
Gleb Nikonorov
49ec2aed0f change stacklevel in warnings from 2 to 3 2020-06-28 10:48:33 -04:00
Ran Benita
992a7a8d38 Merge pull request #7397 from lgeiger/reduce-ihook-calls
Reduce calls to item.ihook
2020-06-28 15:01:43 +03:00
Gleb Nikonorov
c39655725a change if else structure of _warn_bout_missing_assertion 2020-06-27 19:49:19 -04: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
Anthony Sottile
61014c5f94 Merge pull request #6934 from gdhameeja/Fix-6906
Fix-6906: Added code-highlight option to disable highlighting optionally
2020-06-26 13:41:40 -07: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
Bruno Oliveira
d9546ff18f Merge pull request #7421 from The-Compiler/webinar
Add webinar to open trainings
2020-06-26 12:30:14 -03:00
Florian Bruhin
103bfd20d4 Add webinar 2020-06-26 17:08:14 +02:00
Ran Benita
1ae4182e18 testing: fix flaky tests on pypy3 due to resource warnings in stderr (#7405) 2020-06-26 09:50:19 -03:00
Lukas Geiger
97d2c711e6 Reduce calls of Node.ihook 2020-06-26 14:46:37 +02:00
Bruno Oliveira
e377c88495 Merge pull request #7419 from The-Compiler/workshoptage 2020-06-25 14:52:01 -03:00
Florian Bruhin
ba50ef33d3 Add open training at Workshoptage 2020 2020-06-25 17:32:34 +02: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
Ran Benita
256a5d8b14 hookspec: improve typing of some remaining hooks 2020-06-25 17:33:21 +03:00
Ran Benita
97a11726e2 freeze_support: type annotate 2020-06-25 15:28:34 +03:00
Ran Benita
8f8f472379 python_api: type annotate some parts of pytest.approx() 2020-06-25 15:15:24 +03:00
Ran Benita
142d8963e6 recwarn: type annotate pytest.deprecated_call
Also improve its documentation.
2020-06-25 14:40:26 +03:00
Ran Benita
653c83e127 recwarn: type annotate recwarn fixture 2020-06-25 14:30:42 +03:00
Ran Benita
4d813fdf5e recwarn: improve return type annotation of non-contextmanager pytest.warns
It returns the return value of the function.
2020-06-25 14:30:42 +03:00
Ran Benita
f00bec2a12 Replace yield_fixture -> fixture in internal code
`yield_fixture` is a deprecated alias to `fixture`.
2020-06-25 14:05:46 +03:00
Ran Benita
d69e9e60d6 Merge pull request #7411 from bluetech/contributing-changelog
CONTRIBUTING: sync changelog types
2020-06-24 16:33:41 +03:00
Ran Benita
474973afa4 CONTRIBUTING: sync changelog types
The got out of date with the actual ones we use.
2020-06-24 16:11:27 +03:00
Ronny Pfannschmidt
37929030c9 Merge pull request #7406 from ffe4/patch-1
Fix typo in examples/markers.rst
2020-06-24 08:02:21 +02:00
Gleb Nikonorov
0dd77b3e39 Merge remote-tracking branch 'origin/master' into issue_7295 2020-06-23 23:21:36 -04:00
Daniel
6cbbd2d90b Fix typo in examples/markers.rst 2020-06-23 22:38:11 +02: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
Ran Benita
3624acb665 Merge pull request #7401 from bluetech/typing-config
config: improve typing
2020-06-23 18:58:21 +03:00
Ran Benita
c6f4c2e5c6 Merge pull request #7402 from bluetech/fix-nodes-keywords-typo
nodes: fix string possibly stored in Node.keywords instead of MarkDecorator
2020-06-23 18:57:25 +03:00
Ran Benita
8994e1e3a1 config: make _get_plugin_specs_as_list a little clearer and more general 2020-06-23 11:47:52 +03:00
Ran Benita
04a6d37823 nodes: fix string possibly stored in Node.keywords instead of MarkDecorator
This mistake was introduced in 7259c453d6.
2020-06-22 16:51:11 +03:00
Ran Benita
4655b79985 config: improve typing 2020-06-22 16:39:14 +03:00
Ran Benita
83891d9022 Merge pull request #7387 from cool-RR/2020-06-11-raise-from
Fix exception causes all over the codebase
2020-06-21 22:42:18 +03:00
Ran Benita
99d34ba029 Merge pull request #7388 from bluetech/mark-evaluate
skipping: refactor mark evaluation
2020-06-21 21:47:56 +03:00
Ran Benita
27492cf7a0 Merge pull request #7379 from bluetech/typing-builtin-marks
Type annotate pytest.mark.{skip,skipif,xfail,parametrize,usefixtures,filterwarnings}
2020-06-21 20:44:27 +03:00
Ran Benita
b3fb5a2d47 Type annotate pytest.mark.* builtin marks 2020-06-21 20:18:52 +03:00
Ran Benita
7d8d1b4440 skipping: better links in --markers output
Suggested by Bruno.
2020-06-21 20:15:10 +03:00
Ran Benita
c9737ae914 skipping: simplify xfail handling during call phase
There is no need to do the XPASS check here, pytest_runtest_makereport
already handled that (the current handling there is dead code).

All the hook needs to do is refresh the xfail evaluation if needed, and
check the NOTRUN condition again.
2020-06-21 19:54:29 +03:00
Gleb Nikonorov
33de350619 parametrize test_warn_missing for a cleaner test 2020-06-21 10:26:36 -04:00
Gleb Nikonorov
fe68c58698 add test_warn_missing case for --assert=plain 2020-06-20 13:06:41 -04:00
Gleb Nikonorov
a9d50aeab6 remove extra whitespace 2020-06-20 12:18:55 -04:00
Gleb Nikonorov
ac89d6532a replace stderr warnings with the warnings module 2020-06-20 12:15:58 -04:00
Ran Benita
3e6fe92b7e skipping: refactor skipif/xfail mark evaluation
Previously, skipif/xfail marks were evaluated using a `MarkEvaluator`
class. I found this class very difficult to understand.

Instead of `MarkEvaluator`, rewrite using straight functions which are
hopefully easier to follow.

I tried to keep the semantics exactly as before, except improving a few
error messages.
2020-06-20 16:15:28 +03:00
Ram Rachum
dd446bee5e Fix exception causes all over the codebase 2020-06-19 22:02:24 +03:00
Ran Benita
6072c9950d skipping: move MarkEvaluator from _pytest.mark.evaluate to _pytest.skipping
This type was actually in `_pytest.skipping` previously, but was moved to
`_pytest.mark.evaluate` in cf40c0743c.

I think the previous location was more appropriate, because the
`MarkEvaluator` is not a generic mark facility, it is explicitly and
exclusively used by the `skipif` and `xfail` marks to evaluate their
particular set of arguments. So it is better to put it in the plugin
code.

Putting `skipping` related functionality into the core `_pytest.mark`
module also causes some import cycles which we can avoid.
2020-06-19 13:33:54 +03:00
Ran Benita
a1f841d5d2 skipping: use pytest_runtest_call instead of pytest_pyfunc_call
`@pytest.mark.xfail` is meant to work with arbitrary items, and there is
a test `test_mark_xfail_item` which verifies this.

However, the code for some reason uses `pytest_pyfunc_call` for the
call phase check, which only works for Function items. The test
mentioned above only passed "accidentally" because the
`pytest_runtest_makereport` hook also runs a `evalxfail.istrue()` which
triggers and evaluation, but conceptually it shouldn't do that.

Change to `pytest_runtest_call` to make the xfail checking properly
generic.
2020-06-19 13:33:53 +03:00
Gleb Nikonorov
4cc4ebf3c9 Don't treat ini keys defined in conftest.py as invalid (#7384) 2020-06-18 12:58:41 -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
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
Bruno Oliveira
c229d6f46f Fix mypy checks 2020-06-09 14:48:49 -03:00
Bruno Oliveira
5a78df4bd0 Update CHANGELOG 2020-06-09 14:43:04 -03:00
Ran Benita
09988f3ed1 Update testing/test_assertion.py 2020-06-09 14:39:40 -03:00
ibriquem
e2e7f15b71 Make dataclasses/attrs comparison recursive, fixes #4675 2020-06-09 14:39:40 -03:00
Bruno Oliveira
3de85a9ac9 Merge pull request #6944 from piotrhm/issue_1120 2020-06-09 11:31:58 -03:00
piotrhm
e862643b3f Update 1120.bugfix.rst 2020-06-09 11:17:31 -03:00
piotrhm
f0e47c1ed6 Fix typo 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
c871d8b2b6 Merge pull request #7304 from asottile/cache_pre_commit
cache the pre-commit environment
2020-06-09 10:56:42 -03:00
Bruno Oliveira
3100f8ec29 Merge pull request #7341 from gnikonorov/issue_7334
Add documentation on closing issues
2020-06-09 09:11:47 -03:00
Anthony Sottile
aabf03350a Merge pull request #7326 from xinbinhuang/improve_marker_doc
Remove start_doc_server.sh script
2020-06-09 01:55:30 -07:00
Xinbin Huang
c471b382f5 Remove start_doc_server.sh script 2020-06-08 21:01:11 -07:00
Gleb Nikonorov
96d4e2f571 Add documentation on closing issues 2020-06-08 23:58:44 -04:00
Bruno Oliveira
357f9b6e83 Add type annotations 2020-06-08 22:26:14 -03:00
Bruno Oliveira
d5a8bf7c6c Improve CHANGELOG 2020-06-08 22:26:14 -03:00
piotrhm
df562533ff Fixed test 2020-06-08 22:26:14 -03:00
piotrhm
2be1c61eb3 Fixed linting 2 2020-06-08 22:26:14 -03:00
piotrhm
5e0e12d69b Fixed linting 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
Bruno Oliveira
a76855912b Introduce guidelines for closing stale issues/PRs (#7332)
* Introduce guidelines for closing stale issues/PRs

Close #7282

Co-authored-by: Anthony Sottile <asottile@umich.edu>
Co-authored-by: Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
Co-authored-by: Anthony Sottile <asottile@umich.edu>
Co-authored-by: Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
2020-06-08 21:15:53 -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
d2bb67bfda validate plugins before keys in config files 2020-06-07 14:10:20 -04:00
Gleb Nikonorov
42deba59e7 Update documentation as suggested 2020-06-06 22:34:15 -04:00
Bruno Oliveira
ceac6736d7 Fix mention using --rootdir mention inside pytest.ini (not supported) (#6825)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-06 19:17:40 -03:00
Gleb Nikonorov
f1746c50ea Merge remote-tracking branch 'origin/master' into issue_7305 2020-06-06 12:37:56 -04:00
Gleb Nikonorov
3f6b3e7faa update help for --strict-config 2020-06-06 11:33:28 -04:00
Gleb Nikonorov
f760b105ef Touchup pre-PR 2020-06-06 11:06:08 -04:00
Ran Benita
10bfcf5904 Merge pull request #7324 from bluetech/ast-name-consts
mark/expression: prevent creation of illegal Python identifiers
2020-06-06 10:28:46 +03:00
Gleb Nikonorov
2a3c21645e Commit solution thus far, needs to be polished up pre PR 2020-06-06 02:38:18 -04:00
Ran Benita
1deaa74345 mark/expression: prevent creation of illegal Python identifiers
This is rejected by Python DEBUG builds, as well as regular builds in
future versions.
2020-06-05 15:57:48 +03:00
Xinbin Huang
19ad588935 Add reference to builtin markers to doc (#7321)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-06-05 08:10:16 -03:00
Ran Benita
cc283cfe79 Merge pull request #7142 from bluetech/typing
Add more type annotations
2020-06-05 11:55:28 +03:00
Ran Benita
2b05faff0a Improve types around repr_failure() 2020-06-05 11:34:20 +03:00
Ran Benita
54ad048be7 Enable check_untyped_defs mypy option for testing/ too 2020-06-05 11:34:20 +03:00
Ran Benita
71dfdca4df Enable check_untyped_defs mypy option for src/
This option checks even functions which are not annotated. It's a good
step to ensure that existing type annotation are correct.

In a Pareto fashion, the last few holdouts are always the ugliest,
beware.
2020-06-05 11:34:20 +03:00
Ran Benita
848ab00663 Type annotate @pytest.mark.foo 2020-06-05 11:34:20 +03:00
Ran Benita
c0af19d8ad Type annotate more of _pytest.terminal 2020-06-05 11:34:20 +03:00
Ran Benita
2833884688 Type annotate pytest.fixture and more improvements to _pytest.fixtures 2020-06-05 11:34:20 +03:00
Ran Benita
8bcf1d6de1 Remove duplicated conversion of pytest.fixture() params argument
The FixtureFunctionMarker attrs class already converts the params
itself.

When adding types, the previous converter composition causes some type
error, but extracting it to a standalone function fixes the issue (a
lambda is not supported by the mypy plugin, currently).
2020-06-05 11:34:20 +03:00
Ran Benita
1bd7d025d9 Type annotate more of _pytest.fixtures 2020-06-05 11:34:20 +03:00
Ran Benita
f8bb61ae5b Type annotate _pytest.warnings 2020-06-05 11:34:20 +03:00
Ran Benita
01797e6370 Type annotate _pytest.debugging (a bit) 2020-06-05 11:34:20 +03:00
Ran Benita
216a010ab7 Type annotate _pytest.junitxml 2020-06-05 11:34:20 +03:00
Ran Benita
3e351afeb3 Type annotate _pytest.capture 2020-06-05 11:34:20 +03:00
Ran Benita
b51ea4f1a5 Type annotate _pytest.unittest 2020-06-05 11:34:20 +03:00
Ran Benita
db52928684 Type annotate _pytest.logging 2020-06-05 11:34:20 +03:00
Ran Benita
90e58f8961 Type annotate some parts related to runner & reports 2020-06-05 11:34:20 +03:00
Ran Benita
709bcbf3c4 Type annotate _pytest.mark.evaluate 2020-06-05 11:34:20 +03:00
Ran Benita
fc325bc0c3 Type annotate more of _pytest.nodes 2020-06-05 11:34:19 +03:00
Ran Benita
32dd0e87cb Type annotate _pytest.doctest 2020-06-05 11:34:19 +03:00
Ran Benita
387d9d04f7 Type annotate tricky reorder_items() function in fixtures.py 2020-06-05 11:34:19 +03:00
Ran Benita
e68a26199c Type annotate misc functions 2020-06-05 11:34:19 +03:00
Ran Benita
d95132178c Type annotate _pytest.assertion 2020-06-05 11:34:19 +03:00
Ran Benita
30e3d473c4 Type annotate _pytest._io.saferepr 2020-06-05 11:34:19 +03:00
Ran Benita
247c4c0482 Type annotate some more hooks & impls 2020-06-05 11:34:19 +03:00
Ran Benita
ef34729541 Type annotate fixtures.py & related 2020-06-05 11:34:19 +03:00
Ran Benita
be00e12d47 Type annotate main.py and some parts related to collection 2020-06-05 11:34:19 +03:00
Ran Benita
f8de424241 Type annotate CallSpec2 2020-06-05 11:34:19 +03:00
Ran Benita
0fb081aec6 Type annotate some hookspecs & impls
Annotate some "easy" arguments of hooks that repeat in a lot of internal
plugins.

Not all of the arguments are annotated fully for now.
2020-06-05 11:34:19 +03:00
Ran Benita
ff8b7884e8 Type annotate ParameterSet 2020-06-05 11:34:19 +03:00
Ran Benita
43fa1ee8f9 Type annotate some misc places with no particular connection 2020-06-05 11:34:19 +03: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
Anthony Sottile
4c2703bccb Merge pull request #7317 from asottile/setup_cfg_fmt
Run setup-py-upgrade and setup-cfg-fmt
2020-06-04 10:23:24 -07:00
Anthony Sottile
789eea2464 Run setup-py-upgrade and setup-cfg-fmt
- also ran `pre-commit autoupdate`
- https://github.com/asottile/setup-py-upgrade
- https://github.com/asottile/setup-cfg-fmt
2020-06-04 09:58:58 -07:00
Bruno Oliveira
cf640a9b67 Merge pull request #7292 from kerizane/7259_iniconfig 2020-06-03 19:00:48 -03:00
Anthony Sottile
e75531791d Merge pull request #7315 from bluetech/rm-__multicall__
testing: change a test to not use deprecated pluggy __multicall__ protocol
2020-06-03 12:31:35 -07:00
Ran Benita
2e219ad4f3 testing: change a test to not use deprecated pluggy __multicall__ protocol
It is slated to be removed in pluggy 1.0.
2020-06-03 21:51:55 +03:00
Bruno Oliveira
61a6ac9705 Merge pull request #7242 from nicoddemus/fix-flaky-test
Introduce _pytest.timing as a way to control timing during internal tests
2020-06-02 20:25:02 -03:00
Anthony Sottile
5814f77455 Merge pull request #7303 from nicoddemus/flaky-ini-keys
Show invalid ini keys sorted
2020-06-02 12:30:33 -07:00
Anthony Sottile
8cca023840 cache the pre-commit environment 2020-06-02 12:30:10 -07:00
Bruno Oliveira
8ac18bbecb Show invalid ini keys sorted
Otherwise this relies on the dictionary order of `config.inicfg`, which
is insertion order in py36+ but "random" order in py35.
2020-06-02 16:01:47 -03:00
Bruno Oliveira
69d2ddcf1d Merge pull request #7302 from nicoddemus/cherry-pick-release
Merge pull request #7301 from pytest-dev/release-5.4.3
2020-06-02 14:36:01 -03:00
Bruno Oliveira
be1a2e440e Merge pull request #7301 from pytest-dev/release-5.4.3
Prepare release 5.4.3
2020-06-02 14:19:18 -03:00
Ran Benita
85b5a289f0 warnings: fix missing None in existing hook & add some docs (#7288) 2020-06-02 19:59:25 +03:00
Bruno Oliveira
7a8b8a5c9f Merge branch 'master' into fix-flaky-test 2020-06-02 11:33:15 -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
xuiqzy
5517f7264f Remove doc line that is no longer relevant for Python3-only (#7263)
* Fix typo in capture.rst documentation

Rename ``capfsysbinary`` to ``capsysbinary`` as the former does not exist as far as i can see.

* Make Python uppercase in doc/en/capture.rst

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Remove the sentence entirely

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-02 15:56:39 +03:00
Gleb Nikonorov
a5d13d4ced Add changelog entry 2020-06-02 08:21:57 -04:00
Bruno Oliveira
589c6c6acc Merge pull request #7294 from nicoddemus/codecov-adjustments 2020-06-02 09:02:05 -03: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
Bruno Oliveira
eaf46f5354 Adjust codecov: only patch statuses
Fix #6994
2020-06-02 08:17:43 -03:00
Ran Benita
9214e63af3 ci: use fetch-depth: 0 instead of fetching manually (#7297) 2020-06-02 10:29:36 +03:00
Keri Volans
2748feed38 7291: Replace py.iniconfig with iniconfig 2020-06-01 18:09:57 +01:00
Bruno Oliveira
2f406bb9cb Replace custom flask theme by the official one (#6453)
Ref: #6402
2020-06-01 14:21:08 +02: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
Gleb Nikonorov
92d15c6af1 review feedback 2020-05-31 11:33:31 -04:00
Simon K
9da1d0687e adding towncrier wrapper script so 'tox -e docs' works natively on windows (#7266)
* enable tox -e docs natively on windows using a wrapper

* rename the towncrier script; run the towncrier command in a safer manner

* use subprocess.call; call exit() around main on towncrier wrapper

* change to sys.exit() instead of builtin exit()
2020-05-31 12:11:11 -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
Gleb Nikonorov
db203afba3 Add in --strict-config flag to force warnings to errors 2020-05-31 02:45:40 -04:00
Maximilian Cosmo Sitter
b32f4de891 Issue 7202 - Point development guide to contributing section (#7280) 2020-05-31 09:37:26 +03:00
Gleb Nikonorov
8f2c2a5dd9 Add test case for invalid ini key in different section header 2020-05-31 00:49:21 -04:00
Gleb Nikonorov
eef4f87e7b Output a warning to stderr when an invalid key is read from an INI config file 2020-05-30 20:36:02 -04:00
Bruno Oliveira
a146559008 Merge pull request #7220 from nicoddemus/issue-6428 2020-05-30 20:14:26 -03:00
Bruno Oliveira
757bded135 Use Path() instead of str for path comparison
On Windows specifically is common to have drives diverging just by
casing ("C:" vs "c:"), depending on the cwd provided by the user.
2020-05-30 20:05:21 -03:00
Bruno Oliveira
b98aa195e0 Add test and changelog for #6428 2020-05-30 20:02:47 -03:00
Daniel Hahler
fb9f277a99 Node._repr_failure_py: use abspath with changed cwd
Fixes https://github.com/pytest-dev/pytest/issues/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
Ran Benita
e3190604ef Merge pull request #7274 from bluetech/rm-py-error
code: remove last usage of py.error
2020-05-28 13:10:46 +03:00
Ran Benita
2ee90887b7 code: remove last usage of py.error
`str(self.path)` can't raise at all, so it can just be removed.
2020-05-28 12:12:10 +03:00
Gleb Nikonorov
2af0d1e221 remove a stray comma in a test tuple 2020-05-28 00:02:28 -04: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
Anthony Sottile
b3db440d4c Merge pull request #7257 from DahlitzFlorian/fix-issue-6956
Prevent pytest from printing ConftestImportFailure traceback
2020-05-27 13:49:43 -07:00
Ran Benita
54b6fe2ece Merge pull request #7261 from bluetech/capture-cleanup-1
capture: some initial cleanups
2020-05-27 18:14:01 +03:00
Ran Benita
f93e021bc8 capture: remove some unclear parametrization from a test
The two cases end up doing the same (the tmpfile fixture isn't used
except being truthy).
2020-05-27 15:27:16 +03:00
Ran Benita
7a704288df capture: remove unneeded getattr
This attribute is set in __init__ and not deleted. Other methods do it
already but this one wasn't updated.
2020-05-27 15:27:16 +03:00
Ran Benita
a35800c2e1 capture: formalize and check allowed state transition in capture classes
There are state transitions start/done/suspend/resume and two additional
operations snap/writeorg.

Previously it was not well defined in what order they can be called, and
which operations are idempotent.

Formalize this and enforce using assert checks with informative error
messages if they fail (rather than random AttributeErrors).
2020-05-27 15:27:15 +03:00
Ran Benita
fd3ba053cf capture: don't assume that the tmpfile is backed by a BytesIO
Since tmpfile is a parameter to SysCapture, it shouldn't assume things
unnecessarily, when there is an alternative.
2020-05-27 15:19:30 +03:00
Ran Benita
97bcf5a3a2 capture: reorder file into sections and avoid forward references
Make it easier to read the file in progression, and avoid forward
references for upcoming type annotations.

There is one cycle, CaptureManager <-> CaptureFixture, which is hard to
untangle.

(This commit should be added to `.gitblameignore`).
2020-05-27 15:19:28 +03:00
Florian Dahlitz
5b9924e144 Fix py35 CI run 2020-05-27 09:27:13 +02:00
Gleb Nikonorov
d742b386c3 provide missing location parameter, and add type annotations to the hookspec 2020-05-27 00:53:31 -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
95bd232e57 Apply suggestions from @bluetech 2020-05-26 10:31:53 +02:00
Ran Benita
ea3f44894f capture: replace TeeSysCapture with SysCapture(tee=True)
This is more straightforward and does not require duplicating the
initialization logic.
2020-05-26 00:25:49 +03:00
Ran Benita
02c95ea624 capture: remove unused FDCapture tmpfile argument 2020-05-26 00:25:49 +03:00
Ran Benita
2695b41df3 capture: inline _capturing_for_request to simplify the control flow
With straight code, it is a little easier to understand, and simplify
further.
2020-05-26 00:25:49 +03:00
Ran Benita
491239d9b2 capture: remove some indirection in MultiCapture
Removing this indirection enables some further clean ups.
2020-05-26 00:25:49 +03:00
Florian Dahlitz
5ebcb34fb5 Move ConftestImportFailure check to correct position and add typing 2020-05-25 20:19:28 +02:00
Ronny Pfannschmidt
54ae27f081 Merge pull request #7252 from symonk/6900-class-per-instance-of-test-docs
document class instantiation for tests inside classes
2020-05-25 19:58:23 +02:00
Gleb Nikonorov
125b663f20 Address all feedback, minus the empty sring v None nodeid which is being discussed 2020-05-25 11:18:24 -04:00
Florian Dahlitz
6546d1f725 Prevent pytest from printing ConftestImportFailure traceback 2020-05-25 13:57:03 +02:00
Gleb Nikonorov
088d400b2d rename pytest_warning_record -> pytest_warning_recorded 2020-05-24 20:43:23 -04:00
Gleb Nikonorov
b02d087dbd cleanup code pre pr 2020-05-24 20:26:14 -04:00
Gleb Nikonorov
9ee6550181 Add in a new hook pytest_warning_recorded for warning capture
communication
2020-05-24 19:05:24 -04:00
symonk
5061a47de8 add missing test text to docs 2020-05-24 16:33:17 +01:00
symonk
4f93bc01af update terminology of class individuality as per PR feedback 2020-05-24 16:31:51 +01:00
symonk
568e00af15 fixing up formatting inline with a smaller shell and typos 2020-05-24 11:43:29 +01:00
symonk
bad7a0207f document new class instance per test 2020-05-24 11:34:54 +01:00
Anthony Sottile
981b096940 Merge pull request #7249 from asottile/deadsnakes_github_action
Use deadsnakes/action@v1.0.0 to install python3.9 nightly
2020-05-23 20:09:52 -07:00
Anthony Sottile
c9abdaf381 Use deadsnakes/action@v1.0.0 to install python3.9 nightly 2020-05-23 19:51:51 -07: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
Florian Dahlitz
35e6dd0117 Add test for exposure of underlying exception 2020-05-23 18:19:33 +02:00
Bruno Oliveira
1780924b27 Introduce _pytest.timing as a way to control timing during tests
_pytest.timing is an indirection to 'time' functions, which pytest production
code should use instead of 'time' directly.

'mock_timing' is a new fixture which then mocks those functions, allowing us
to write time-reliable tests which run instantly and are not flaky.

This was triggered by recent flaky junitxml tests on Windows related to timing
issues.
2020-05-23 11:50:33 -03:00
Claire Cecil
79701c65ed Added support for less verbose version information (#7169) 2020-05-23 11:27:58 -03:00
Simon K
05c22ff823 7154-Improve-testdir-documentation-on-makefiles (#7239) 2020-05-23 11:27:06 -03:00
Ran Benita
b38edec60f Merge pull request #7238 from bluetech/micro-optimizations-1
A few tiny micro-optimizations/simplifications
2020-05-23 12:14:24 +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
f1f9c7792b Import packaging package lazily 2020-05-22 14:33:29 +03:00
Ran Benita
796fba6788 terminal: remove redundant write_fspath_result call
This is already done in pytest_runtest_logstart, so the fspath is
already guaranteed to have been printed (for xdist, it is disabled
anyway).

write_fspath_result is mildly expensive so it is worth avoiding calling
it twice.
2020-05-22 14:33:29 +03:00
Ran Benita
139a029b5e terminal: remove a redundant line
`write_fspath_result` already does this split.
2020-05-22 14:33:29 +03:00
Ran Benita
8d841ab0b8 nodes: remove unused argument from FSHookProxy 2020-05-22 14:33:28 +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
Bruno Oliveira
c98bc4cd3d Merge pull request #7234 from mcsitter/master 2020-05-20 17:51:06 -03:00
mcsitter
fa6a13a7cc Updated compatible python versions
As indicated on pypi and in the README pytest supports python version 3.8 and 3.9. The documentation should match.
2020-05-20 22:41:52 +02:00
Ran Benita
1af3c115a6 Merge pull request #7200 from bluetech/contributing-backporting
CONTRIBUTING: add section about backporting fixes to patch releases
2020-05-20 20:21:23 +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
Ran Benita
b337a9a66d CONTRIBUTING: add section about backporting fixes to patch releases 2020-05-20 19:29:13 +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
88214310af Merge pull request #6817 from blueyed/argparsing-_split_lines-upstream 2020-05-19 20:06:51 -03:00
Bruno Oliveira
5a2c69f150 Add CHANGELOG for #6817 2020-05-19 19:35:18 -03:00
Daniel Hahler
35d136161a add test
Fixes the test to not match e.g. hypothesis (ref: bdde2ac28).

Conflicts:
	testing/test_helpconfig.py
2020-05-19 19:34:08 -03:00
Daniel Hahler
691a7fceea Revisit some help texts with regard to newlines 2020-05-19 19:34:08 -03:00
Daniel Hahler
87423d3cc8 Keep explicit newlines with help texts
This makes a difference for e.g. pytest-xdist:

Before:
```
  --dist=distmode       set mode for distributing tests to exec environments. each: …
                        available environment. loadscope: …
                        grouped by file to any available environment. (default) no: …
```

After:
```
  --dist=distmode       set mode for distributing tests to exec environments.
                        each: send each test to all available environments.
                        load: load balance by sending any pending test to any available environment.
                        …
                        (default) no: run tests inprocess, don't distribute.
```

This might also result in unexpected changes (hard wrapping), when line
endings where used unintentionally, e.g. with:

```
help="""
    some long
    help text
    """
```

But the benefits from that are worth it, and it is easy to fix, as will
be done for the internal `assertmode` option.
2020-05-19 19:34:08 -03:00
Bruno Oliveira
d05ef61e95 Merge pull request #6840 from blueyed/test_source_with_decorator 2020-05-19 19:30:23 -03:00
Bruno Oliveira
55099e57c3 Add requested comment as per review 2020-05-19 19:20:41 -03:00
Daniel Hahler
b98a182aa1 (no) coverage 2020-05-19 19:20:41 -03:00
Daniel Hahler
61180eec93 Test behavior of Source with regard to decorators
Unlinke `inspect.getsource` it does not unwrap functions.
2020-05-19 19:20:41 -03:00
Bruno Oliveira
5a6296a2d7 Merge pull request #7226 from nicoddemus/remove-function-args 2020-05-19 18:53:23 -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
Ran Benita
85a06cfafb Merge pull request #7227 from bluetech/logging-reuse-handler
logging: reuse LoggingCaptureHandler instance since it's expensive to create
2020-05-18 23:16:51 +03:00
Ran Benita
fe2febfff2 Merge pull request #7019 from bluetech/rm-pyobj_property
Remove pyobj_property helper, inline it instead
2020-05-18 23:13:52 +03:00
Ran Benita
694fdc6554 Remove pyobj_property helper, inline it instead
It doesn't save much code but adds indirection which makes it a bit
harder to follow and to type.
2020-05-18 20:54:11 +03:00
Katrin Leinweber
9bf28853bf doc: highlight difference between progress percentage & code coverage (#6686) 2020-05-18 20:51:22 +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
d2d11a8bdc logging: reuse LoggingCaptureHandler instance since it's expensive to create
Previously, a LoggingCaptureHandler was instantiated for each test's
setup/call/teardown which turns out to be expensive.

Instead, only keep one instance and reset it between runs.
2020-05-18 11:27:50 +03:00
Anthony Sottile
9310d67773 Merge pull request #7003 from blueyed/tests-reload-upstream
tests: revisit tests for removed load_module
2020-05-17 14:36:13 -07:00
Daniel Hahler
18bc706fdc tests: revisit tests for removed load_module
The tests came via c629f6b18 and c61ff31ffa.
The fixes from there are kind of obsoleted by 4cd08f9 (moving to importlib),
but it makes sense to keep them as integration tests in general.
2020-05-17 14:16:43 -07:00
Ran Benita
e27228a4e4 Merge pull request #7224 from bluetech/logging-simplifications
logging: some simplifications/cleanups
2020-05-18 00:15:59 +03:00
Ran Benita
f71ec8cc90 logging: order hookimpl's in chronological order
Makes it easier to understand what's going on.
2020-05-17 21:41:38 +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
bd5e3f042d logging: move log_file_handler cleanup from sessionend to unconfigure
It is set-up in configure, so match it.
2020-05-17 21:41:38 +03:00
Ran Benita
43c465c9bf logging: use dummy handler when CLI logging is disabled instead of None
This makes the code cleaner by removing conditionals and making the CLI
and file logging completely analogous.

Doesn't affect performance.
2020-05-17 21:41:38 +03:00
Ran Benita
bd657bab3f logging: don't use _runtest_for for the pytest_log* hooks
The logstart/logreport/logfinish hooks don't need the stuff in
_runtest_for. The test capturing catching_logs call is irrelevant for
them, and the item-conditional sections are gone.
2020-05-17 21:41:38 +03:00
Ran Benita
b13af52bbe logging: call set_when() in a consistent manner 2020-05-17 21:41:38 +03:00
Ran Benita
075903dafa logging: simplify log-file handling
- Instead of making it optional, always set up a handler, but possibly
  going to /dev/null. This simplifies the code by removing a lot of
  conditionals. It also can replace the NullHandler() we already add.

- Change `set_log_path` to just change the stream, instead of recreating
  one. Besides plugging a resource leak, it enables the next item.

- Remove the capturing_logs from _runtest_for, since it sufficiently
  covered by the one in pytest_runtestloop now, which wraps all other
  _runtest_for calls.

The first item alone would have had an adverse performance impact, but
the last item removes it.
2020-05-17 21:41:37 +03:00
Ran Benita
e48ac692de logging: optimize catching_logs slightly
Remove usage of `@contextmanager` as it is a bit slower than
hand-rolling, and also disallows re-entry which we want to use.

Removing protections around addHandler()/removeHandler(), because
logging already checks that internally.
2020-05-17 20:42:06 +03:00
Ran Benita
eceb28e4be logging: set formatter on handler creation, not in catching_logs
Conceptually it doesn't check per catching_logs (and catching_logs
doesn't restore the older one either). It is just something that is
defined for each handler once.
2020-05-17 20:42:06 +03:00
Ran Benita
ce0f218793 logging: yield from _runtest_for instead of contextmanager
Avoid the slight overhead of contextmanager.
2020-05-17 20:42:06 +03:00
Ran Benita
9effbe7425 logging: inline _runtest_for_main into _runtest_for
This avoids a little bit of overhead, and makes the code a bit clearer
too.
2020-05-17 20:42:06 +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
abbd97f917 Merge pull request #7222 from nicoddemus/remove-key-error-conftest-exception 2020-05-17 11:43:43 -03:00
Bruno Oliveira
c26f389c09 Refactor handling of non-top-level pytest_plugins handling
Decided to move the 'if' logic together with the error message, as this leaves
the _importconftest method cleaner.
2020-05-17 11:26:30 -03:00
Bruno Oliveira
9e1e7fcabe Use a nice string repr for ConftestImportFailure
The default message is often hard to read:

    E   _pytest.config.ConftestImportFailure: (local('D:\\projects\\pytest\\.tmp\\root\\foo\\conftest.py'), (<class 'RuntimeError'>, RuntimeError('some error',), <traceback object at 0x000001CCC3E39348>))

Using a shorter message is better:

    E   _pytest.config.ConftestImportFailure: RuntimeError: some error (from D:\projects\pytest\.tmp\root\foo\conftest.py)

And we don't really lose any information due to exception chaining.
2020-05-17 11:26:30 -03:00
Bruno Oliveira
5eaebc1900 Remove one of the tracebacks from conftest import failures
This removes the KeyError from the traceback chain when an
conftest fails to import:

    return self._conftestpath2mod[key]
    E   KeyError: WindowsPath('D:/projects/pytest/.tmp/root/foo/conftest.py')

    During handling of the above exception, another exception occurred:
    ...
        raise RuntimeError("some error")
    E   RuntimeError: some error

    During handling of the above exception, another exception occurred:
    ...
    E   _pytest.config.ConftestImportFailure: (...)

By slightly changing the code, we can remove the first chain, which is often
very confusing to users and doesn't help with anything.

Fix #7223
2020-05-17 11:26:02 -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
d4dfe863c9 Merge pull request #7221 from nicoddemus/fix-release-on-comment 2020-05-16 13:46:46 -03:00
Bruno Oliveira
e1becae24c Fix errors introduced by #6911
Somehow I've missed the failures while merging, totally my fault.
2020-05-16 13:42:39 -03:00
Bruno Oliveira
f506682abe Merge pull request #6919 from nicoddemus/backport-6914 2020-05-16 12:42:15 -03:00
Bruno Oliveira
d9f24bca9c Merge pull request #6935 from gdhameeja/Fix-6911 2020-05-16 12:08:23 -03:00
Bruno Oliveira
68acd10349 Merge pull request #6991 from blueyed/fix-lf-cmdline-args-upstream 2020-05-15 18:49:25 -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
Zac Hatfield-Dodds
6df0b9c41a Merge pull request #7213 from hrichards/clarify_docs_on_nose_yield-based_tests 2020-05-13 12:38:45 +10:00
Ran Benita
07c8e0cc7f Merge pull request #7211 from bluetech/expr-jit
mark: compile -k/-m expression once, reuse for all matches
2020-05-12 13:21:41 +03:00
Ran Benita
c714f05ad7 mark: reuse compiled expression for all items in -k/-m
The previous commit made this possible, so utilize it.

Since legacy.py becomes pretty bare, I inlined it into __init__.py. I'm
not sure it's really "legacy" anyway!

Using a simple 50000 items benchmark with `--collect-only -k nomatch`:

Before (two commits ago):

   ======================== 50000 deselected in 10.31s =====================
         19129345 function calls (18275596 primitive calls) in 10.634 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.001    0.001    2.270    2.270 __init__.py:149(pytest_collection_modifyitems)
        1    0.036    0.036    2.270    2.270 __init__.py:104(deselect_by_keyword)
    50000    0.055    0.000    2.226    0.000 legacy.py:87(matchkeyword)

After:

   ======================== 50000 deselected in 9.37s =========================
         18029363 function calls (17175972 primitive calls) in 9.701 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    1.394    1.394 __init__.py:239(pytest_collection_modifyitems)
        1    0.057    0.057    1.393    1.393 __init__.py:162(deselect_by_keyword)

The matching itself can be optimized more but that's a different story.
2020-05-12 12:55:37 +03:00
Ran Benita
622c4ce02e mark/expression: support compiling once and reusing for multiple evaluations
In current pytest, the same expression is matched against all items. But
it is re-parsed for every match.

Add support for "compiling" an expression and reusing the result. Errors
may only occur during compilation.

This is done by parsing the expression into a Python `ast.Expression`,
then `compile()`ing it into a code object. Evaluation is then done using
`eval()`.

Note: historically we used to use `eval` directly on the user input --
this is not the case here, the expression is entirely under our control
according to our grammar, we just JIT-compile it to Python as a
(completely safe) optimization.
2020-05-12 12:53:12 +03:00
Ran Benita
952762207a Merge pull request #7121 from bluetech/update-flake8
pre-commit: update flake8 3.7.7 -> 3.8.1
2020-05-12 12:51:46 +03:00
Ran Benita
645aaa728d python_api: reduce scope of a except BaseException in ApproxNumpy
I'm not sure if it can even raise at all, but catching BaseException
would swallow ctrl-C and such and is definitely inappropriate here.
2020-05-12 12:07:56 +03:00
Ran Benita
23c9856857 Remove no longer needed noqa's 2020-05-12 09:29:47 +03:00
Ran Benita
59a12e9ab3 Replace bare excepts with except BaseException
Mostly I wanted to remove uses of `noqa`.

In Python 3 the two are the same.
2020-05-12 09:29:47 +03:00
Ran Benita
d1534181c0 pre-commit: upgrade flake8 3.7.7 -> 3.8.1
New errors:

    testing/test_setupplan.py:104:15: E741 ambiguous variable name 'l'
    testing/test_setupplan.py:107:15: E741 ambiguous variable name 'l'
    extra/get_issues.py:48:29: E741 ambiguous variable name 'l'
    testing/test_error_diffs.py:270:32: E741 ambiguous variable name 'l'

Not so sure about it but easier to just fix.

But more importantly, is a large amount of typing-related issues there
were fixed which necessitated noqa's which can now be removed.
2020-05-12 09:29:40 +03:00
Hunter Richards
06b6d5b1d5 Combine all mentions of yield into "Unsupported" section 2020-05-11 15:36:08 -05:00
Ran Benita
15d5e8cd97 Merge pull request #7210 from bluetech/minus-k-deprecations
mark: deprecate a couple undocumented -k syntaxes
2020-05-11 20:57:35 +03: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
Zac Hatfield-Dodds
0ba6e1f74e Merge pull request #7209 from pwilczynskiclearcode/master
#7138 Docs improvement: Apply indirect on particular arguments
2020-05-11 22:10:28 +10:00
Paweł Wilczyński
dbfc629698 #7138 Docs improvement: Apply indirect on particular arguments 2020-05-11 13:26:16 +02:00
Pavel Karateev
8bd3f1a72b Better test method name
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-10 16:59:20 +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
184528d0c2 Fix tests to expected repr output 2020-05-10 13:06:36 +03:00
Pavel Karateev
7b196747dd Use saferepr for all types 2020-05-10 12:47:26 +03:00
Pavel Karateev
6b26f0f890 Rename test method and reference issue 2020-05-10 12:19:52 +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
5e7f1ab4bf Merge pull request #7201 from nicoddemus/bruno-tidelift 2020-05-08 13:28:14 -03:00
Anthony Sottile
abb047f71b Add asottile as well
(went for alphabetical order, hope that's ok!)
2020-05-08 08:57:22 -07:00
Bruno Oliveira
97a0239aad Add myself to TIDELIFT 2020-05-08 12:36:40 -03:00
Bruno Oliveira
741a8b8023 Merge pull request #7195 from nicoddemus/cherry-pick-release 2020-05-08 09:09:48 -03:00
Bruno Oliveira
b02b0b610b Merge pull request #6989 from blueyed/fix-test 2020-05-08 09:04:59 -03:00
Bruno Oliveira
e6151cd8d0 Cherry-pick release 5.4.2 2020-05-08 09:03:21 -03:00
Bruno Oliveira
5dd987e10f Merge pull request #6999 from bluetech/simplify-fixture-compat 2020-05-08 08:06:35 -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
c66bf59fd5 ci: update github action versions, remove outdated comment (#7177) 2020-05-08 13:03:51 +03:00
Bruno Oliveira
a039fe3e92 Merge pull request #7187 from asottile/update-contributing 2020-05-08 06:58:37 -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
9d2eabb397 Merge pull request #7186 from asottile/is_setup_py_encoding_agnostic
Fix _is_setup_py for files encoded differently than locale
2020-05-07 14:01:28 -07:00
Anthony Sottile
9926fcf452 remove incorrect note about requiring admin install 2020-05-07 13:51:20 -07:00
Bruno Oliveira
63e94b986b Merge pull request #7179 from asottile/py39 2020-05-07 17:42:57 -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
de556f895f testing: clean up parametrization in test_mark.py (#7184) 2020-05-07 20:42:04 +03:00
Ran Benita
32c00db0bf Merge pull request #7176 from bluetech/warnings-optimize-parse
warnings: speed up work done in catch_warnings_for_item()
2020-05-07 19:34:28 +03:00
Anthony Sottile
dad328bc8a Fix tests for python3.9 2020-05-07 05:26:55 -07:00
Ran Benita
65963d2066 warnings: speed up work done in catch_warnings_for_item()
When setting up the warnings capture, filter strings (with the general
form `action:message:category:module:line`) are collected from the
cmdline, ini and item and applied. This happens for every test and other
cases.

To apply a string it needs to be parsed into a tuple, and it turns out
this is slow. Since we already vendor the parsing code from Python's
warnings.py, we can speed it up by caching the result. After splitting
the parsing part from the applying part, the parsing is pure and is
straightforward to cache.

An alternative is to parse ahead of time and reuse the result, however
the caching solution turns out cleaner and more general in this case.

On this benchmark:

    import pytest
    @pytest.mark.parametrize("x", range(5000))
    def test_foo(x): pass

Before:

============================ 5000 passed in 14.11s =============================
         14365646 function calls (13450775 primitive calls) in 14.536 seconds

After:

============================ 5000 passed in 13.61s =============================
         13290372 function calls (12375498 primitive calls) in 14.034 seconds
2020-05-07 12:19:13 +03: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
4d439760ad Merge pull request #7168 from nicoddemus/saferepr-getattr-fail-7145 2020-05-06 17:57:38 -03:00
Bruno Oliveira
199f45d0a9 Merge pull request #7027 from blueyed/doc-rm-rm 2020-05-06 12:43:51 -03:00
Ran Benita
d16ae0bbdc Merge pull request #7171 from bluetech/code-import-cycles
code: fix import cycles between code.py and source.py
2020-05-06 18:15:32 +03:00
Ran Benita
8c2c297e1e Merge pull request #7172 from bluetech/micro-optimizations-1
Some easy micro optimizations to collection
2020-05-06 18:13:44 +03:00
Ran Benita
89eee90b5f python: optimize PythonCollector.collect 2020-05-06 12:05:04 +03:00
Ran Benita
b90f34569f nodes: micro-optimize Node attribute access 2020-05-06 11:58:30 +03:00
Ran Benita
5702c86f4c nodes: micro-optimize hash(node)
Turns out it's called alot, and saving the function call makes it
faster.
2020-05-06 11:58:30 +03:00
Ran Benita
fcc473ab1c Use dict instead of OrderedDict on Python 3.7
OrderedDict is quite a bit heavier than just a dict.
2020-05-06 11:58:28 +03:00
Ran Benita
69143fe5b0 code: fix import cycles between code.py and source.py
These two files were really intertwined. Make it so code.py depends on
source.py without a reverse dependency.

No functional changes.
2020-05-06 11:01:32 +03:00
Bruno Oliveira
d0022b5a13 'saferepr' handles classes with broken __getattribute__
Fix #7145
2020-05-05 19:22:39 -03:00
Ran Benita
4787fd64a4 Merge pull request #7167 from bluetech/lint-merge-fix
testing: fix lint after merge of old branch
2020-05-05 23:34:05 +03:00
Ran Benita
94400a68b4 terminal: fix non-deterministic warning summary order in Python 3.5
In Python 3.5, collections.Counter() does not preserve insertion order.
2020-05-05 23:08:44 +03:00
Ran Benita
abf785666a testing: fix lint after merge of old branch 2020-05-05 22:00:55 +03:00
Ran Benita
4b91617002 Merge pull request #7020 from blueyed/fix-warnings-summary
Fix warnings summary
2020-05-05 21:58:57 +03:00
Ran Benita
a8dbb32a6b Merge pull request #6797 from blueyed/tests-simpler
tests: simplify test_pytest_plugins_in_non_top_level_conftest_…
2020-05-05 21:51:50 +03:00
Ran Benita
b4be6cd4b7 Merge pull request #6765 from blueyed/capture-refactor-1
Refactor Capture classes: move/rename CaptureIO classes
2020-05-05 21:46:18 +03:00
Daniel Hahler
8cae78a18b Fix warnings summary
- replace "tests with warnings" with just warnings: they a) might not
  come from a test in the first place, and b) a single test might have
  multiple warnings.
- fix usage of (unused) argument to `collapsed_location_report`

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-05 21:40:34 +03:00
Ran Benita
d7d627b1e8 Merge pull request #7064 from blueyed/fix-_printcollecteditems-doc-upstream
Fix/improve printing of docs for collected items
2020-05-05 21:31:21 +03:00
Daniel Hahler
7647d1c836 Move Capture classes from compat to capture and improve naming
Move {Passthrough,CaptureIO} to capture module, and rename Passthrough
-> Tee to match the existing terminology.

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-05 21:24:59 +03:00
Ran Benita
46d768503e Merge pull request #6839 from blueyed/typing-get_dirs_from_args-parseconfig
typing: get_dirs_from_args, parseconfig
2020-05-05 21:11:26 +03:00
Ran Benita
85732e2b08 Merge pull request #6993 from blueyed/doc-pytest_collection-upstream
[WIP] doc: pytest_collection: has to set `session.items`
2020-05-05 21:05:56 +03:00
Ran Benita
b4c46da278 Merge pull request #7029 from blueyed/fix-test_popen_default_stdin_stderr_and_stdin_None-upstream
Fix `test_popen_default_stdin_stderr_and_stdin_None` when run with `-s`
2020-05-05 21:03:04 +03:00
Bruno Oliveira
16a44823eb Use reportinfo() instead of location in skipping message 2020-05-04 19:50:40 -03:00
Katarzyna
9b423710aa Remove unnecessary file in test. 2020-05-04 00:34:19 +02:00
Katarzyna
a5bcd0655f Test relapth when rootdir != invocationdir. 2020-05-04 00:04:38 +02:00
Katarzyna
402ee6fb9d Relative path to invocationdir instead rootdir. 2020-05-03 22:56:38 +02:00
Bruno Oliveira
80e5098408 Merge pull request #7155 from kerizane/make_numbered_dir 2020-05-03 09:48:36 -03:00
Keri Volans
678440e46d 7018: Use internal version of make_numbered_dir 2020-05-03 10:45:06 +01:00
Bruno Oliveira
6dcfc93d45 Merge pull request #7157 from nicoddemus/remove-blueyed-tidelift 2020-05-02 22:05:55 -03:00
Bruno Oliveira
799dab5284 Remove blueyed from TIDELIFT
blueyed is no longer a member of the pytest-dev organization.
2020-05-02 21:56:52 -03:00
Bruno Oliveira
3312820051 Merge pull request #7151 from nicoddemus/unittest-cleanup-6947 2020-05-02 15:43:54 -03:00
Bruno Oliveira
82f584b5a9 Fix test_trial_error in test_unittest
This reverts the test to the state before 04f27d4, which introduced the breaking
change about addCleanup not being called properly for failed tests.
2020-05-02 15:26:55 -03: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
2b51ed46d5 Merge pull request #7153 from nicoddemus/xunit-warning-update 2020-05-02 13:31:34 -03:00
Bruno Oliveira
095a195d71 Improve docs about junit_family warning message
From discussion in #6178
2020-05-02 13:01:15 -03:00
Bruno Oliveira
0b78983197 Merge pull request #7141 from bluetech/rm-nonzero 2020-05-02 10:00:35 -03:00
Bruno Oliveira
5afa8717db Merge pull request #7147 from nicoddemus/doc-typos 2020-05-01 17:36:29 -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
5c37898949 Fix some typos in the CHANGELOG 2020-05-01 14:39:09 -03:00
Bruno Oliveira
d0fe6e01c8 Merge pull request #7143 from nicoddemus/file-from-parent 2020-05-01 13:07:40 -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
409ffcef17 Remove a couple Python 2 __nonzero__ definitions
It's called __bool__ in Python 3.
2020-05-01 11:41:21 +03:00
Ran Benita
e40bf1d1da Add a changelog for TerminalWriter changes 2020-04-30 16:44:03 +03:00
Ran Benita
d8558e87c5 terminalwriter: clean up markup function a bit 2020-04-30 16:44:03 +03:00
Ran Benita
414a87a53f config/argparsing: use our own get_terminal_width() 2020-04-30 16:44:03 +03:00
Ran Benita
bafc9bd58b testing: merge code/test_terminal_writer.py into io/test_terminalwriter.py 2020-04-30 16:44:03 +03:00
Ran Benita
0e36596268 testing/io: port TerminalWriter tests from py 2020-04-30 16:44:03 +03:00
Ran Benita
d5584c7207 terminalwriter: compute width_of_current_line lazily
Currently this property is computed eagerly, which means
get_line_width() is computed on everything written, but that is a slow
function.

Compute it lazily, so that get_line_width() only runs when needed.
2020-04-30 16:44:03 +03:00
Ran Benita
dd32c72ff0 terminalwriter: remove unused property chars_on_current_line 2020-04-30 16:44:03 +03:00
Ran Benita
1bc4170e63 terminalwriter: don't flush implicitly; add explicit flushes
Flushing on every write is somewhat expensive.

Rely on line buffering instead (if line buffering for stdout is
disabled, there must be some reason...), and add explicit flushes when
not outputting lines.

This is how regular `print()` e.g. work so should be familiar.
2020-04-30 16:44:03 +03:00
Ran Benita
d9b43647b7 terminalwriter: inline function _update_chars_on_current_line 2020-04-30 16:44:03 +03:00
Ran Benita
8e04d35a33 terminalwriter: remove unneeded hasattr use 2020-04-30 16:44:03 +03:00
Ran Benita
e8fc5f99fa terminalwriter: add type annotations 2020-04-30 16:44:03 +03:00
Ran Benita
f6564a548a terminalwriter: remove win32 specific code in favor of relying on colorama
On Windows we already depend on colorama, which takes care of all of
this custom code on its own.
2020-04-30 16:44:03 +03:00
Ran Benita
8d2d1c40f8 terminalwriter: inline function _escaped
Doesn't add much.
2020-04-30 16:44:03 +03:00
Ran Benita
66ee755649 terminalwriter: remove TerminalWriter's stringio argument
Had a mark indicating it should be removed, and I agree, it's better to
just use the `file` argument.
2020-04-30 16:44:02 +03:00
Ran Benita
94a57d2353 io: combine _io.TerminalWriter and _io.terminalwriter.TerminalWriter
Previously it extended an external type but now it come move to the type
itself.
2020-04-30 16:44:02 +03:00
Ran Benita
dac05ccd9a terminalwriter: remove support for passing callable as file in TerminalWriter
Not used.
2020-04-30 16:44:02 +03:00
Ran Benita
0528307ebf terminalwriter: remove unused function TerminalWriter.reline 2020-04-30 16:44:02 +03:00
Ran Benita
a6819726cd terminalwriter: remove unused function ansi_print 2020-04-30 16:44:02 +03:00
Ran Benita
b6cc90e0af terminalwriter: remove support for writing bytes directly
It is not used and slows things down.
2020-04-30 16:44:02 +03:00
Ran Benita
9a59970cad terminalwriter: optimize get_line_width() a bit
This function is called a lot when printing a lot of text, and is very
slow -- this speeds it up a bit.
2020-04-30 16:44:02 +03:00
Ran Benita
6c1b6a09b8 terminalwriter: simplify get_terminal_width()
The shutil.get_terminal_size() handles everything this did already.
2020-04-30 16:44:02 +03:00
Ran Benita
c749e44efc terminalwriter: remove custom win32 screen width code
Python 3 does this on its own so we can use the shared code:
bcf2b59fb5
2020-04-30 16:44:02 +03:00
Ran Benita
1d596b27a7 terminalwriter: move Win32ConsoleWriter definition under win32 conditional
This way non-Windows platforms skip it. It also uses things defined
inside the `if`.
2020-04-30 16:44:02 +03:00
Ran Benita
5e2d820308 terminalwriter: fix lints 2020-04-30 16:44:02 +03:00
Ran Benita
3014d9a3f7 terminalwriter: auto-format 2020-04-30 16:43:55 +03:00
Ran Benita
276405a039 terminalwriter: vendor TerminalWriter from py
Straight copy from py 1.8.1. Doesn't pass linting yet.
2020-04-30 16:43:54 +03:00
Ran Benita
be68496440 Merge pull request #7134 from bluetech/rm-dupfile
config: replace usage of py.io.dupfile
2020-04-30 14:07:52 +03:00
Ran Benita
c72a1b2933 config: replace usage of py.io.dupfile
As part of the effort to remove uses of `py`.
2020-04-29 18:04:37 +03:00
Ran Benita
e5d6e58625 Merge pull request #7130 from bluetech/cacheprovider-nf-set
cacheprovider: speed up NFPlugin when --nf is not enabled
2020-04-29 17:28:20 +03:00
Ran Benita
077d1c3502 Merge pull request #7129 from bluetech/testing-cache-writefail-warning
testing: fix warning issued by test_cache_writefail_cachfile_silent
2020-04-29 16:00:43 +03:00
Ran Benita
4a42afdc2f cacheprovider: speed up NFPlugin when --nf is not enabled
The code used an O(n^2) loop. Replace list with set to make it O(n).

For backward compatibility the filesystem cache still remains a list.

On this test:

    import pytest
    @pytest.mark.parametrize("x", range(5000))
    def test_foo(x): pass

run with `pytest --collect-only`:

Before: 0m1.251s
After:  0m0.921s
2020-04-29 13:02:38 +03:00
Anthony Sottile
dd49812dae Merge pull request #7131 from ArtyomKaltovich/patch-1
update doctests.rst regarding issue #7116
2020-04-28 13:59:25 -07:00
ArtyomKaltovich
bef263ee76 update doctests.rst regarding issue #7116
https://github.com/pytest-dev/pytest/issues/7116
2020-04-28 23:04:58 +03:00
Ran Benita
49e50d3106 testing: fix warning issued by test_cache_writefail_cachfile_silent
Remove this message which was shown in the warning summary of pytest's
own testsuite:

    testing/test_cacheprovider.py::TestNewAPI::test_cache_writefail_cachfile_silent
      testing/test_cacheprovider.py:40: PytestCacheWarning: could not create cache path /tmp/pytest-of-ran/pytest-2/test_cache_writefail_cachfile_silent0/.pytest_cache/v/test/broken
        cache.set("test/broken", [])
2020-04-28 22:49:00 +03:00
Ran Benita
9bf3efb8e9 Merge pull request #7120 from bluetech/update-dev
pre-commit: update some tool revisions
2020-04-25 23:07:15 +03:00
Ran Benita
9828cfa339 Merge pull request #7117 from bluetech/deprecate-fillfuncargs-v2
fixtures: deprecate pytest._fillfuncargs function
2020-04-24 22:59:06 +03:00
Ran Benita
3cd97d50f9 pre-commit: update pyupgrade 1.18.0 -> 2.2.1 2020-04-24 21:57:38 +03:00
Ran Benita
23881ad592 pre-commit: update pre-commit-hooks 2.2.3 -> 2.5.0 2020-04-24 21:53:40 +03:00
Ran Benita
38c9d59ddc pre-commit: update blacken-docs 1.0.0 -> 1.6.0 2020-04-24 21:53:37 +03:00
Ran Benita
289e6c1d36 Update src/_pytest/deprecated.py
Co-Authored-By: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
2020-04-24 21:37:08 +03:00
Ran Benita
cbca9f1def Merge pull request #7118 from bluetech/ignore-collect-directory-warning
testing: avoid pytest_collect_directory message in warning summary
2020-04-24 21:34:29 +03:00
Ran Benita
e269407e65 testing: avoid pytest_collect_directory message in warnings summary
Currently this test issues a warning which is displayed in the warning
summary (of pytest's own test suite):

  testing/acceptance_test.py::TestGeneralUsage::test_early_skip
    /tmp/pytest-of-ran/pytest-396/test_early_skip0/conftest.py:2: PytestDeprecationWarning: The pytest_collect_directory hook is not working.
    Please use collect_ignore in conftests or pytest_collection_modifyitems.
      def pytest_collect_directory():

I think the filter was meant to be `ignore` in the first place, and not
`always` which is not a valid action AFAIK.
2020-04-24 19:06:31 +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
Ran Benita
7d5f5a8785 Merge pull request #7050 from blueyed/fix-doc
doc: internal: remove references to old "newinterpret" module
2020-04-17 17:11:31 +03:00
Ran Benita
731c340be6 Merge pull request #7058 from blueyed/doc-store
doc: minor fixes for Store
2020-04-17 17:10:35 +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
Ran Benita
9f4e680403 Merge pull request #7089 from bluetech/rm-tox-pypy
Remove pypy (2) environment from tox.ini
2020-04-14 15:42:39 +03:00
Ran Benita
10080dc60d Remove pypy (2) environment from tox.ini
pypy refers to Pypy 2 which implements Python 2 which pytest does not
support. Keep only pypy3.
2020-04-14 14:49:12 +03:00
Ran Benita
9ddf38369d Merge pull request #7069 from bluetech/faulthandler-doc-windows
Remove note saying faulthandler_timeout is not available on Windows
2020-04-14 10:24:28 +03:00
Simon K
f479cbce10 Document pytester fixtures so --fixtures makes more sense (#7080) 2020-04-13 20:58:50 +03:00
Ran Benita
c08cff3770 Merge pull request #7082 from symonk/4583-better-ux-with-eval-fails
Gracefully handle eval() failure(s) for marker expressions
2020-04-13 17:03:37 +03:00
Ran Benita
798361ab9f Merge pull request #7078 from andy-maier/andy/add-docs-repr_failure
Fixes #7077: Added & improved docs for repr_failure() in Node & Collector
2020-04-13 16:38:14 +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
251e8f212e refactor mark tests, widen catching and make error msg more concise 2020-04-13 14:25:01 +01:00
symonk
87edc09dea Gracefully handle eval() failure(s) for marker expressions 2020-04-13 13:25:06 +01:00
Andreas Maier
c9386ada29 Squash: Resolved 2nd round of review comments 2020-04-12 13:19:45 +02:00
Andreas Maier
b2582b0314 Squash: Applied review comments 2020-04-12 12:12:00 +02:00
Andreas Maier
869c089887 Fixes #7077: Added & improved docs for repr_failure() in Node & Collector 2020-04-12 09:28:40 +02:00
gaurav dhameeja
5703fdbbdc Fix-6911(pytest-bot): Added error from commands that are run
Earlier pytest-bot would only print out the exception in cases of
failure but did not provide context on failing command and error from
command. This patch adds the errors from the command to the exception
message.
`Command` provides abstraction over the command to run and helps
in collecting errors from the first failing command only.
With this, we don't need to check `returncode` from each command that
we run, we can run all the commands and will have access to the error
from the first command that failed. This pattern was taken from Go.
Please refer: https://blog.golang.org/errors-are-values
2020-04-12 02:31:51 +05:30
Bruno Oliveira
f214a4be97 Merge pull request #7072 from pytest-dev/asottile-patch-1
Remove asottile from TIDELIFT.rst
2020-04-10 19:45:59 -03:00
Anthony Sottile
c8fc4c5edc Remove asottile from TIDELIFT.rst 2020-04-10 15:38:45 -07:00
Bruno Oliveira
6daf3614f0 Merge pull request #7070 from nicoddemus/remove-bruno
Remove myself from tidelift
2020-04-10 18:37:30 -03:00
Bruno Oliveira
4b634ac758 Remove myself from tidelift 2020-04-10 10:47:25 -03:00
Ran Benita
b553ce54c8 Remove note saying faulthandler_timeout is not available on Windows
I think it is available in all Python versions we support, but at least
since Python 3.7 the docs[0] say:

    Changed in version 3.7: This function is now always available.

so let's just remove the note.

[0] https://docs.python.org/3/library/faulthandler.html#faulthandler.dump_traceback_later
2020-04-10 14:46:15 +03:00
Ronny Pfannschmidt
244c8e4a13 Merge pull request #6680 from RonnyPfannschmidt/fix-6294-more-docs-for-fromparent
doc: more docs for from_parent
2020-04-10 13:10:40 +02:00
Ran Benita
df66a953a1 Merge pull request #7048 from bluetech/fix-test_assertrewrite-reprcompare
Remove broken _reprcompare disabling fixture in test_assertrewrite.py
2020-04-10 12:51:11 +03:00
Ran Benita
9ffccf5acc Merge pull request #7055 from bluetech/rm-test_juintxml-unichr
Remove Python 2 compat code in test_juintxml.py
2020-04-10 11:52:45 +03:00
Ran Benita
f0d1ccd32f Merge pull request #7056 from bluetech/rm-test_monkeypatch-oldstyleclass
Remove Python 2 compat check in test_monkeypatch.py
2020-04-10 11:52:01 +03:00
Ran Benita
41d1ecf521 Merge pull request #7057 from bluetech/skip-faulthandler-test_timeout
Skip flaky test test_faulthandler.py::test_timeout[True]
2020-04-10 11:51:31 +03: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
0b5d2ff526 Fix/improve printing of docs for collected items 2020-04-09 21:49:30 +02:00
Daniel Hahler
accea46fa1 doc: minor fixes for Store 2020-04-09 17:08:47 +02:00
Daniel Hahler
f136b79f1a Fix test_no_warnings to handle e.g. _pytest.async (#7044)
Before this patch it would result in a SyntaxError with e.g. `import _pytest.async`.
2020-04-09 16:56:01 +02:00
Ran Benita
2aa5436ee7 Remove Python 2 compat code in test_juintxml.py 2020-04-09 17:33:55 +03:00
Ran Benita
5a5fd01ebe Skip flaky test test_faulthandler.py::test_timeout[True]
It occasionally crashes on CI, the reason seems out of our control, or
at least we can't figure it out.
2020-04-09 17:23:54 +03:00
Ran Benita
08b3d37177 Remove Python 2 compat check in test_monkeypatch.py
Presumably it used to test old-style vs. new-style classes, but in
the Python 3 conversion SampleNew and SampleOld became the same.
2020-04-09 17:11:18 +03:00
Ran Benita
8fab3dd42f Remove broken _reprcompare disabling fixture in test_assertrewrite.py
The `_pytest._code._reprcompare` that was referred to previously doesn't
exist -- it was moved to other places but wasn't updated. This regressed
in f423ce9c01. Now we don't want it
anymore, so keep the status quo by explicitly removing them.
2020-04-09 10:47:45 +03:00
Daniel Hahler
413ca8a4d0 faulthandler: trylast=True (#7025)
It should happen as late as possible before the test runs.

Ref: https://github.com/pytest-dev/pytest/issues/7022
2020-04-09 08:53:35 +02:00
Daniel Hahler
a98a62723e revisit 2020-04-09 01:57:46 +02:00
Daniel Hahler
ad4c1071d9 doc: internal: remove references to old "newinterpret" module
This has been merged into the (only) assertrewrite mode.
2020-04-09 01:40:23 +02:00
Ran Benita
eb00182061 Merge pull request #7047 from bluetech/rm-test_assertion-abc
Remove some no-longer-needed compat code in test_assertion
2020-04-08 22:33:19 +03:00
Ran Benita
20956b2f4e Remove some no-longer-needed compat code in test_assertion 2020-04-08 21:35:42 +03:00
Ran Benita
272be7ef74 Merge pull request #7039 from bluetech/markdecorator-doc
Slightly improve Mark and MarkDecorator documentation
2020-04-08 20:36:42 +03:00
Daniel Hahler
33ff863430 rebuild 2020-04-08 19:24:20 +02:00
Daniel Hahler
e6da086101 Update testing/test_pytester.py
Co-Authored-By: Ran Benita <ran@unusedvar.com>
2020-04-08 18:16:03 +02:00
Daniel Hahler
7048d5be9c Fix FD leak in test__get_multicapture (#7037)
Instantiating `FDCapture` creates a file descriptor already.  Use "no"
to not leak a fd here.
2020-04-08 18:11:31 +02:00
Daniel Hahler
4fd2623c12 tests: fix TypeErrors (#7038)
* tests: fix TypeError with test_mark_closest

It fails when trying to run it actually:

> TypeError: test_has_inherited() takes 0 positional arguments but 1 was given

* Fix testing/test_collection.py::TestCollector::test_getparent
2020-04-08 18:11:04 +02:00
Ran Benita
4344c61731 Slightly improve Mark and MarkDecorator documentation
Mostly I wanted to get rid of mentions of "MarkItem" which is something
that no longer exists, but I improved a little beyond that and annotated
some simple types.
2020-04-07 22:14:47 +03:00
Ran Benita
6356583eab Merge pull request #7036 from pytest-dev/revert-7030-increase-test_timeout-timeout
Revert "Increase test_faulthandler.py::test_timeout sleep duration on CI"
2020-04-07 13:42:51 +03:00
Ran Benita
eab0a6e34d Revert "Increase test_faulthandler.py::test_timeout sleep duration on CI" 2020-04-07 13:20:35 +03:00
Daniel Hahler
ce806001b0 Fix doc for numbered arg with TempPathFactory.mktemp (#7014) 2020-04-07 11:44:54 +02:00
Ran Benita
259e5d0610 Merge pull request #7034 from bluetech/fix-testdurations-flaky
Fix flaky TestDurations test
2020-04-07 09:39:02 +03:00
Daniel Hahler
1fd14685c5 doc: document inversed lines with terminal report hooks (#7016)
It was surprising that `tryfirst=True` would not result in lines being
added to the beginning with `pytest_report_header`.
This is due to lines being reversed, and therefore the same applies to
`pytest_report_collectionfinish`.
2020-04-07 08:08:28 +02:00
Daniel Hahler
bf3e64d473 Remove TestExecutionForked - xdist.boxed has gone since long (#7021)
Tried to write a test using `--boxed`, but it fails due to
https://github.com/pytest-dev/pytest-forked/issues/30.
2020-04-07 08:07:20 +02:00
Daniel Hahler
3a4435fb59 doc: fix/remove leftovers from removing versionadded (#7028)
Ref: 9c5da9c (https://github.com/pytest-dev/pytest/pull/5184)
2020-04-07 08:01:50 +02:00
Ran Benita
c659a6b917 Merge pull request #7030 from bluetech/increase-test_timeout-timeout
Increase test_faulthandler.py::test_timeout sleep duration on CI
2020-04-07 00:06:16 +03:00
Ran Benita
c3e6e2e8c8 Fix flaky TestDurations test
TestDurations tests the `--durations=N` functionality which reports N
slowest tests, with durations <= 0.005s not shown by default.

The test relies on real time.sleep() (in addition to the code which uses
time.perf_counter()) which makes it flaky and inconsistent between
platforms.

Instead of trying to tweak it more, make it use fake time instead. The
way it is done is a little hacky but seems to work.
2020-04-06 23:49:46 +03:00
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
Ran Benita
03451c397f Simplify positional arguments compatibility code in pytest.fixture()
The dynamic scope feature added in 10bf6aac76
necessitated some wrangling of arguments in pytest.fixture(). In
particular, it deprecated positional arguments in favor of keyword-only
arguments, while keeping backward compatibility.

The way it did this avoided some code duplication but ended up being
quite hard to follow and to annotate with types.

Replace it with some straightforward code, which is not very DRY but is
simple and easy to remove when the time comes.
2020-04-02 14:52:58 +03: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
Daniel Hahler
ff0a091165 Fix/improve test_terminal_reporter_writer_attr
It did not actually test that the attribute gets set.
This also checks the stacklevel etc.
2020-03-31 09:31:38 +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
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
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
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
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
Ronny Pfannschmidt
2b6740672d Merge pull request #6897 from pytest-dev/release-5.4.0
Prepare release 5.4.0
2020-03-12 22:40:51 +01: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
Ronny Pfannschmidt
93aa988e01 Merge pull request #6901 from RonnyPfannschmidt/regendoc-fix-simple
run and fix tox -e regen to prepare 5.4
2020-03-12 15:09:10 +01:00
Ran Benita
7996724f23 Merge pull request #6902 from RoyalTS/filterwarnings-docfix
Minor docfix
2020-03-12 12:39:33 +02:00
Tobias Schmidt
90ee8a7599 docfix 2020-03-12 09:38:00 +01:00
Ronny Pfannschmidt
378a75ddf6 run and fix tox -e regen to prepare 5.4
* no longer trigger deprecation warnings when looking up fixtures
* fix missed imports in a test example
2020-03-11 22:25:51 +01:00
Bruno Oliveira
e1b3a68462 Merge pull request #6896 from nicoddemus/release-trigger
Fix bot trigger event
2020-03-11 10:04:41 -03:00
Ronny Pfannschmidt
fb7dbc9fa3 Merge pull request #6893 from RonnyPfannschmidt/url-fixes
fix urls that fail linkcheck
2020-03-11 14:02:46 +01:00
Bruno Oliveira
a0ea300e96 Fix bot trigger event
Issue events don't contain a 'comment' entry:
https://developer.github.com/v3/issues/events/#response-2

Issue comments also contain the original issue body:
https://developer.github.com/v3/activity/events/types/#issuecommentevent

That's why it was triggering even for comments on the issue.

Also changed to startsWith because there's no need to support
the command anywhere in the body IMO.

Fix #6895
2020-03-11 09:54:56 -03:00
Ronny Pfannschmidt
09b289e286 fix mozilla qa project link 2020-03-11 11:10:33 +01:00
Ronny Pfannschmidt
694dbe5bd4 fix pydanny.com url to the one with ssl set up 2020-03-11 10:52:16 +01:00
Ran Benita
4f8fff9cab Merge pull request #6868 from bluetech/simplify-exc
Simplify some exception handling code
2020-03-10 20:32:08 +02:00
Daniel Hahler
ac7ebfa22e doc: internal: fix MultiCapture.readouterr (#6878)
Remove wrong docstring: it might actually return bytes.
Replace it with a type annotation which is clear enough.
2020-03-08 12:38:21 +01:00
Daniel Hahler
db92cea14c black: --target-version py35 (#6872) 2020-03-08 01:24:31 +01:00
Daniel Hahler
bce1d40fb0 tests: harden test_reprcompare_notin, factor out callop (#6764)
* tests: assertion: factor out `callop`, typing

* tests: harden test_reprcompare_notin
2020-03-08 01:23:19 +01:00
Daniel Hahler
dc86fb6758 pre-commit run --all-files 2020-03-07 23:47:55 +01:00
Daniel Hahler
2df4f63149 Add config for black (target-version) 2020-03-07 23:47:55 +01:00
Daniel Hahler
e3cf4fc258 doc/en/Makefile: use Sphinx's make mode (#6873)
Syncs it from the output of current sphinx-quickstart.
2020-03-07 23:45:05 +01:00
gdhameeja
599bf075db Check invalid operations for -k
`KeywordMapping` returns a bool on lookup which when passed to eval
fail on certain operations such as index access and attribute access.
We catch all exceptions and raise a `UsageError`.
2020-03-07 20:17:01 +05:30
Ran Benita
978b315861 Simplify some exception handling code
Mostly avoid unnecessary usage of sys.exc_info(). Since Python3,
exception objects themselves have all that's needed. They are also
easier to type.
2020-03-07 13:18:54 +02:00
Ran Benita
580edc13e7 Merge pull request #6867 from bluetech/inline-pyobjmixin
Inline PyobjContext
2020-03-07 11:58:38 +02:00
Ran Benita
1df593f978 Merge pull request #6865 from bluetech/more-config-store
Convert a couple of places to use config store
2020-03-06 15:49:01 +02:00
Ran Benita
b7f2e3d4f5 Inline PyobjContext
When it was introduced in 8adac2878f it
seems to have had some use, but now it doesn't.
2020-03-06 14:55:20 +02:00
Ran Benita
f011bc642c Store mark's evalcache in config's store instead of attribute
Part of moving away from ad-hoc attributes to using the config's store.
2020-03-06 11:42:20 +02:00
Ran Benita
b1d7a187f2 Add setdefault() method to Store
Can be useful in some cases.
2020-03-06 11:42:20 +02:00
Ran Benita
678d65f051 Store AssertionState in config's store instead of attribute
Part of moving away from ad-hoc attributes to using the config's store.
2020-03-06 11:27:01 +02:00
Daniel Hahler
fcd3fad03d Minor internal improvements to logging's log_level (#6849) 2020-03-06 03:12:57 +01:00
Daniel Hahler
9e8540f25f docs: remove doc/en/links.inc (#6853) 2020-03-06 03:11:24 +01:00
Bruno Oliveira
19bb2c6235 Merge pull request #6859 from nicoddemus/kw-mapping-attr-typing
Use attrs in KeywordMapping
2020-03-05 08:47:22 -03:00
Bruno Oliveira
bc8e52c3c2 Use attrs in KeywordMapping
Also added type hinting.
2020-03-05 08:33:20 -03:00
Daniel Hahler
d9a4626944 fixup! Fix documentation for Config/InvocationParams 2020-03-05 06:38:44 +01:00
Daniel Hahler
3865f77de3 doc: TestReport: :show-inheritance: 2020-03-05 06:00:11 +01:00
Daniel Hahler
ffa2658971 doc: reports: count_towards_summary: is a property
And therefore does not really `return`.  It confused me that there was
no `source` link in the docs, which is only there for functions.
2020-03-05 05:57:43 +01:00
Daniel Hahler
a1ad6e3117 doc: fix/revisit _Result (hook wrappers)
- it should not document the deprecated `result`; used the same as
  pluggy documents itself
- add a "hookwrapper" label, that could be used by pluggy (currently it
  links to the section)
- use pluggy's `hookwrappers` label for linking to its documentation
2020-03-05 05:55:04 +01:00
Daniel Hahler
9b32794391 intersphinx_mapping: add pluggy 2020-03-05 05:53:42 +01:00
Daniel Hahler
c39a85e5f4 doc: revisit UnformattedWarning 2020-03-05 03:15:14 +01:00
Daniel Hahler
b90f57d25c Remove wrong/outdated doc with UnformattedWarning
It was introduced in da6830f19 (added to `_pytest.deprecated`, but then
moved to `_pytest.warning_types`).
2020-03-05 03:13:28 +01:00
Daniel Hahler
77adb33ec6 doc: use show-inheritance with warnings, revisit docstrings
Revisits the docstring for `PytestExperimentalApiWarning` and
`PytestUnhandledCoroutineWarning`.
2020-03-05 02:56:18 +01:00
Daniel Hahler
1a8d427e98 doc: src/_pytest/deprecated.py: links 2020-03-05 02:47:21 +01:00
Bruno Oliveira
333bb0883a Merge pull request #6860 from pytest-dev/pytest_twisted_in_async_warning
Add pytest-twisted to list of async def handling plugins
2020-03-04 21:48:20 -03:00
Kyle Altendorf
dce2621710 Add pytest-twisted to list of async def handling plugins
https://github.com/pytest-dev/pytest-twisted/tree/v1.12#ensuredeferred

[pytest-twisted](https://github.com/pytest-dev/pytest-twisted) supports `async def` test functions and fixtures as well as `async def`/`yield` fixtures.
2020-03-04 17:42:08 -05:00
Bruno Oliveira
d161bedcee Add an example of how to port the code 2020-03-04 09:23:31 -03: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
Daniel Hahler
197b7c3bce Add .gitblameignore (#6848) 2020-03-04 05:32:30 +01:00
Daniel Hahler
37d074efc8 Fix (internal) documentation for pytester's LineComp (#6850) 2020-03-04 05:25:32 +01:00
Ronny Pfannschmidt
a5a8d53dfe remove myself from the list of coc handlers (#6857) 2020-03-03 19:08:59 -03: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
Daniel Hahler
b11bfa106c Use attrs with all Repr classes (#6739)
Co-authored-by: Ran Benita <ran234@gmail.com>
2020-03-03 21:53:28 +01:00
Daniel Hahler
dc5219a9c0 Fix documentation for Config/InvocationParams 2020-03-03 21:15:06 +01:00
Daniel Hahler
a42e85ed54 Fix documentation for _pytest.pytester.RunResult
When using `(i)var` in the class docstring it would link `duration` to
`_pytest.runner.TestReport.duration`.

This moves the docstrings to the attributes properly.
2020-03-03 18:12:12 +01:00
Bruno Oliveira
aac11e5e75 Mention FixtureLookupError in getfixturevalue docs 2020-03-03 10:05:19 -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
b2d54fe6b1 Fix tox alpha order 2020-03-03 09:59:38 -03:00
earonesty
9b8ed8d9ad Update pytest.py 2020-03-03 09:59:38 -03:00
earonesty
615474329d Update AUTHORS 2020-03-03 09:59:38 -03:00
earonesty
7667ff51e7 Update fixtures.py 2020-03-03 09:59:38 -03:00
earonesty
74cdff86f8 Update conftest.py 2020-03-03 09:59:38 -03:00
earonesty
0f00495548 Create 6285.feature.rst 2020-03-03 09:59:38 -03:00
earonesty
b40a9f9add Export FixtureLookupError to top level 2020-03-03 09:59:38 -03:00
Daniel Hahler
bd7e33277b docs: remove tracking through Google Analytics (#6843)
This might not even be monitored by anyone, but if it is useful in
general should probably get replaced with a less controversial provider.
2020-03-03 01:35:14 +01:00
Daniel Hahler
620d457756 doc: add __tracebackhide__ label 2020-03-02 17:08:37 +01:00
Daniel Hahler
ddc8edffbc logging: minor typing, rename function
`get_log_level_for_setting` reflects better what the function does, and
it does not require a (trivial) docstring.
2020-03-01 22:02:46 +01:00
Daniel Hahler
bdd22fdd52 logging: improve help for log_level 2020-03-01 22:02:46 +01:00
Ronny Pfannschmidt
3637d9eb3f followup: add note on from_parent kwargs 2020-03-01 20:34:38 +01:00
Ronny Pfannschmidt
5c1e56d350 docs: from_parent - add minimal before/after example
fixup: fix from_parent version
2020-03-01 20:34:38 +01:00
Ronny Pfannschmidt
3d390940d1 refer the node-from-parent deprecation documentation in the warning
fixup: fix test for warning
2020-03-01 20:33:46 +01: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
Bruno Oliveira
15e1dd0f87 Automate release by comment notifications (#6823)
* Automate release by comment notifications

* Only run if @pytestbot is mentioned
2020-03-01 14:46:35 -03:00
Ronny Pfannschmidt
23c43a37e0 summarize warning summaries if the number of locations is high 2020-03-01 14:08:15 +01:00
Bruno Oliveira
92767fec51 Merge pull request #6836 from bluetech/store
Add a typing-compatible mechanism for ad-hoc attributes on various objects
2020-03-01 09:30:10 -03:00
Ran Benita
5fc80d8bc3 Merge pull request #6844 from bluetech/asserthook-abc-loader
Mark AssertionRewritingHook as implementing importlib.abc.Loader
2020-02-29 23:21:11 +02:00
Ran Benita
2f60548e08 Mark AssertionRewritingHook as implementing importlib.abc.Loader
It implements the required methods. This is useful for typing but also a
nice indicator.
2020-02-29 16:55:56 +02:00
Daniel Hahler
f10ab021e2 Move _collectfile to FSCollector (#6830)
Previously this was implemented both on `Session` and `Package`, where
the extra code in `Package._collectfile` was not covered/used.

Ref: https://github.com/pytest-dev/pytest/pull/6830#issuecomment-592663236
2020-02-29 11:40:11 +01:00
Daniel Hahler
d99bfc18b8 Update src/_pytest/config/findpaths.py
Co-Authored-By: Ran Benita <ran234@gmail.com>
2020-02-29 11:39:33 +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
769ffc32bf Add Read The Docs badge to README (#6841) 2020-02-29 00:29:56 +01:00
Daniel Hahler
8128f4b3b8 Fix test_write_pyc: passed list to parseconfig 2020-02-28 20:40:39 +01:00
Daniel Hahler
6092d3c6e1 typing: parseconfig 2020-02-28 20:40:39 +01:00
Daniel Hahler
6c236767e0 Adjust/fix test_config: use strs with determine_setup 2020-02-28 20:40:39 +01:00
Daniel Hahler
d2f9a73a29 typing: get_dirs_from_args 2020-02-28 19:58:15 +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
952cab2d85 Simplify test_rootdir_wrong_option_arg (#6812) 2020-02-28 18:38:07 +01:00
Ran Benita
d636fcd557 Add a typing-compatible mechanism for ad-hoc attributes on various objects
pytest has several instances where plugins set their own attributes on
objects they receive in hooks, like nodes and config. Since plugins are
detached from these object's definition by design, this causes a problem
for type checking because these attributes are not defined and mypy
complains.

Fix this by giving these objects a "store" which can be used by plugins
in a type-safe manner.

Currently this mechanism is private. We can consider exposing it at a
later point.
2020-02-28 14:34:44 +02:00
Daniel Hahler
f77d606d4e docs: generate index and add it to globaltoc sidebar (#6808) 2020-02-27 00:34:18 +01:00
Daniel Hahler
16c683dff9 Remove unused setns (#6804)
Last usage of it was removed in ba17363d7.
2020-02-26 15:35:14 +01:00
Daniel Hahler
2e48c32dea docs: fix reference to config.cache fixture (#6807) 2020-02-26 01:24:18 +01:00
Stefano Mazzucco
2451716746 Remove reference to old konira plugin from docs (#6819)
The pytest-konira plugin has not seen an update since 2011, moreover
the "project description" on PyPI points to a dubious website that
does not actually correspond to the project and instead redirects to
advertising content.
2020-02-26 01:19:40 +01:00
Daniel Hahler
eac933acde assertion: rewrite: only catch EnvironmentError
This was changed unintentionally in 45c4a8fb3 (pytest 5.3.0), but only
EnvironmentErrors might have `errno`.
Since that is not really guaranteed and it is good to have more
information this uses the string representation of the exc in the trace
message.
2020-02-25 17:29:30 +01:00
Daniel Hahler
6a7df7f031 test_assertion: harden/improve test_{text_diff,unicode} (#6806) 2020-02-24 15:19:08 +01:00
Daniel Hahler
ac3a42bafd doctest: strip newlines with unexpected exceptions (#6801) 2020-02-24 15:18:08 +01:00
Daniel Hahler
be23aeb989 Remove unused pytester.getdecoded (#6805)
Last usage was removed in 22dc47d9f.
2020-02-24 14:33:26 +01:00
Daniel Hahler
bfd0d18371 tests: test_config: move tests (#6796)
Originally added in a2891420d (with `TestRootdir`), but then
accidentally moved to `TestOverrideIniArgs` in 802755cee.
2020-02-23 17:12:55 +01:00
Daniel Hahler
9928c7794b minor: fix trace msg: s/loaded/loading (#6798) 2020-02-23 17:12:30 +01:00
Daniel Hahler
706ea86bba capture: factor out _get_multicapture (#6788)
Ref: https://github.com/pytest-dev/pytest/pull/6671#issuecomment-588408992
2020-02-22 23:39:20 +01:00
Daniel Hahler
1d5a0ef284 Fix pytest_ignore_collect hooks: do not return False (#6778)
It should only return `True` when something is to be ignored, not
`False` otherwise typically.

This caused e.g. bad interaction with the cacheprovider (before
https://github.com/pytest-dev/pytest/pull/6448).
2020-02-22 23:35:47 +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
077001fe5c tests: simplify test_pytest_plugins_in_non_top_level_conftest_unsupported_no_false_positives 2020-02-22 23:31:37 +01:00
Daniel Hahler
68fe0eb8f3 Minor cosmetic fixes (#6792) 2020-02-22 19:24:41 +01:00
Daniel Hahler
de854c6ee1 doc: pytest.raises: remove mention of removed message (#6793)
Follow-up to 13f7f27fd.
2020-02-22 19:24:00 +01:00
Daniel Hahler
04126feea7 doc: pytest.raises: link to python:try (#6794) 2020-02-22 19:23:35 +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
478a244f5e main: args must be a list, not tuple (#6791)
Passing in a tuple crashes in `_prepareconfig`:

        def test_invoke_with_tuple(self):
    >       pytest.main(("-h",))

    src/_pytest/config/__init__.py:82: in main
        config = _prepareconfig(args, plugins)
    src/_pytest/config/__init__.py:229: in _prepareconfig
        return pluginmanager.hook.pytest_cmdline_parse(
    …
    src/_pytest/helpconfig.py:98: in pytest_cmdline_parse
        config = outcome.get_result()  # type: Config
    src/_pytest/config/__init__.py:808: in pytest_cmdline_parse
        self.parse(args)
    src/_pytest/config/__init__.py:1017: in parse
        self._preparse(args, addopts=addopts)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

        def _preparse(self, args: List[str], addopts: bool = True) -> None:
            …
            if addopts:
                ini_addopts = self.getini("addopts")
                if ini_addopts:
    >               args[:] = self._validate_args(ini_addopts, "via addopts config") + args
    E               TypeError: can only concatenate list (not "tuple") to list

    addopts    = True
    args       = ('-h',)
    env_addopts = ''
    ini_addopts = ['-rfEX', …]

    src/_pytest/config/__init__.py:956: TypeError: can only concatenate list (not "tuple") to list

Might be worth handling (converting it to a list for example), but it
was documented to be a list to begin with when removing support for
strings (a7e401656).
2020-02-22 13:16:46 +01:00
Daniel Hahler
47ccd58fb4 Fix typo in doc with syspath_prepend 2020-02-22 13:15:17 +01:00
Daniel Hahler
2277817176 Fix grammar in changelog/6737.breaking.rst 2020-02-22 13:15:17 +01:00
Daniel Hahler
1baeefc2fd test_reprcompare_whitespaces: use callequal 2020-02-22 13:15:17 +01:00
Daniel Hahler
260f848c05 minor: remove outdated, superfluous comment 2020-02-22 13:15:17 +01:00
Bruno Oliveira
7c0d1cad40 Merge pull request #6790 from TWood67/master
Updated Dynamic Scopes Documentation
2020-02-21 16:47:22 -03:00
TWood67
b26e60c2da updated documentation
added a default value so a runtime exception does not occur
2020-02-21 11:45:24 -06:00
Daniel Hahler
2be06ba67e Improve doc/typing/message for ExceptionInfo.match (#6776) 2020-02-21 16:41:57 +01:00
Daniel Hahler
8e991a622c tests: harden/improve test_itemreport_subclasses_show_subclassed_file (#6467)
* tests: harden test_itemreport_subclasses_show_subclassed_file

* extend test_itemreport_subclasses_show_subclassed_file
2020-02-21 15:24:12 +01:00
Daniel Hahler
b099fcfa33 tests: runner: improve/ignore coverage (#6781) 2020-02-21 14:37:56 +01:00
Daniel Hahler
4c9b850e13 help: --deselect: mention that this uses node id prefixes (#6770)
Ref: https://github.com/pytest-dev/pytest/issues/6751
2020-02-21 12:53:27 +01:00
Daniel Hahler
81a9df6ed1 tests: fix flaky test_timeout (#6773)
Use a longer timeout on CI - seen a failure with it with GHA (Windows).

Ref: a4554e666a
2020-02-21 12:52:31 +01:00
Daniel Hahler
58ef95ed4d ci: fix Travis (#236) (#6786) 2020-02-21 12:50:54 +01:00
Bruno Oliveira
435ad221f9 Deprecate TerminalReporter.writer
Fix #6779
2020-02-20 21:04:49 -03:00
Bruno Oliveira
c91abe48ba Assorted improvements following up #6658 2020-02-20 18:51:41 -03:00
Daniel Hahler
d1b50526fa tests: harden some UsageError tests (matching the error msg) (#6775) 2020-02-20 13:29:59 +01:00
Daniel Hahler
4d633a29be cacheprovider: fix typing with Path(py.path.local) (#6774)
Fixes:

> Argument 1 to "Path" has incompatible type "Union[local, Any]";
> expected "Union[str, _PathLike[str]]"  [arg-type]

Ref: https://github.com/pytest-dev/py/pull/232#pullrequestreview-349549522
2020-02-20 13:23:41 +01:00
Daniel Hahler
8a1633c3b4 tmpdir: clean up indirection via config for factories (#6767)
Remove `_tmp_path_factory` and `_tmpdirhandler` from the config object.

- `_tmpdirhandler` has been deprecated since 2.8.0 (0f52856f9), when
  `tmpdir_factory` has been added.
- `_tmp_path_factory` should have probably never been added there in the
  first place, but maybe just used the same pattern (16e2737da).
2020-02-20 12:48:33 +01:00
Daniel Hahler
82f5986424 capture: re-order classes (#6768)
This better reflects the inheritance / smartness with regard to raw or
encoded.

- FDCaptureBinary
- FDCapture
- SysCaptureBinary
- SysCapture
- TeeSysCapture
2020-02-20 11:00:19 +01:00
Daniel Hahler
fb16d3e27a capture: revisit/fix __repr__, define _in_suspended (#6749) 2020-02-20 00:51:57 +01:00
Daniel Hahler
2b13a9b95d Use TYPE_CHECKING (#6771) 2020-02-19 22:07:54 +01: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
Ran Benita
af2b0e1174 Merge pull request #6758 from bluetech/outcome-exception-callable-2
Use a hack to make typing of pytest.fail.Exception & co work
2020-02-19 22:08:21 +02:00
Daniel Hahler
781a730bea terminal: remove confusing comment about _tw (#6763)
Ref: https://github.com/blueyed/pytest/commit/cf0cac3b7#r37373455
2020-02-19 20:35:50 +01:00
Nathaniel Compton
7c09d88b72 #6289: Add new example to XFAIL documentation (#6685)
Fix #6289

Co-authored-by: Ran Benita <ran234@gmail.com>
2020-02-19 15:04:37 -03:00
Daniel Hahler
4021770688 pytester: LineMatcher: use _fail with _match_lines_random (#6747) 2020-02-19 13:16:57 +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
Ran Benita
24dcc76495 Use a hack to make typing of pytest.fail.Exception & co work
Mypy currently is unable to handle assigning attributes on function:
https://github.com/python/mypy/issues/2087.
pytest uses this for the outcome exceptions -- `pytest.fail.Exception`,
`pytest.exit.Exception` etc, and this is the canonical name by which they
are referred.

Initially we started working around this with type: ignores, and later
by switching e.g. `pytest.fail.Exception` with the direct exception
`Failed`. But this causes a lot of churn and is not as nice. And I also
found that some code relies on it, in skipping.py:

    def pytest_configure(config):
        if config.option.runxfail:
            # yay a hack
            import pytest

            old = pytest.xfail
            config._cleanup.append(lambda: setattr(pytest, "xfail", old))

            def nop(*args, **kwargs):
                pass

            nop.Exception = xfail.Exception
            setattr(pytest, "xfail", nop)
        ...

So it seems better to support it. Use a hack to make it work. The rest
of the commit rolls back all of the workarounds we added up to now.

`pytest.raises.Exception` also exists, but it's not used much so I kept
it as-is for now.

Hopefully in the future mypy supports this and this ugliness can be
removed.
2020-02-18 23:17:27 +02:00
Daniel Hahler
442f7a7706 Do not use fixed line number with test_cache_failure_warns (#6748)
It was not previously checking for the line number also (02aa8ad), and this is
obviously wrong (affected by changes to the file).
2020-02-18 09:27:33 +01:00
Daniel Hahler
d18c75baa3 doc: fix test with link to python_files (#6741)
Follow-up to b09762d (#6705).

Ref: https://github.com/pytest-dev/pytest/pull/6705#discussion_r379819573
2020-02-16 10:30:25 +01:00
Daniel Hahler
bc976dca3b pytester: add __tracebackhide__ for matching randomly (#6746) 2020-02-16 10:29:59 +01:00
Ran Benita
7b8968ff80 Merge pull request #6735 from bluetech/metafunc-annotate
Type annotate Metafunc
2020-02-15 23:32:14 +02:00
Ran Benita
0c68e7a2c9 Merge pull request #6744 from bluetech/item-runtest-stub
Add Item.runtest stub implementation
2020-02-15 23:27:57 +02: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
959e6b4f44 Merge pull request #6743 from bluetech/runtest-getattr
Avoid getattr when dispatching pytest_runtest_* hooks
2020-02-15 17:22:00 +02:00
Ran Benita
5945c3fe88 Type annotate Metafunc 2020-02-15 17:13:18 +02:00
Ran Benita
7155b2277c Ignore "assert False" statements in coverage 2020-02-15 17:08:01 +02:00
Ran Benita
a7a1686433 Add Item.runtest stub implementation
Every Item must implement this method (called on all items collected in
a session). Add a stub for typing and clarity.
2020-02-15 16:58:55 +02:00
Ran Benita
371939fb86 Avoid getattr when dispatching pytest_runtest_* hooks
Using getattr doesn't work with typing, and also breaks grep. It took me
a while to find where these hooks are called.
2020-02-15 15:34:21 +02:00
Daniel Hahler
7fc9d4c976 Use warnings module directly with cacheprovider (#6740) 2020-02-15 05:31:18 +01:00
Daniel Hahler
2b5adc88a7 Move test_issue4445_cacheprovider_set into test_cache_failure_warns
Would need to be adjusted anyway non-trivially, and we can just harden
`test_cache_failure_warns` instead.
2020-02-15 02:01:22 +01:00
Daniel Hahler
02aa8adae1 cacheprovider: use warnings directly
Allows for filtering of PytestCacheWarning.

Using `_issue_warning_captured` is not necessary here, and was probably
only used because the cacheprovider misses warnings during
`pytest_sessionfinish`, which is also fixed here.

I think the usage of `_issue_warning_captured` can be removed/reduced
further, but also that this is good enough for now.

Ref: https://github.com/pytest-dev/pytest/issues/6681.
2020-02-15 01:36:57 +01:00
Daniel Hahler
67e69a7e49 tests: harden test_xdist_verbose (#6700) 2020-02-15 01:22:01 +01:00
Daniel Hahler
b09762df27 doc: link to python_files from "Assertion Rewriting" (#6705)
Ref: https://github.com/pytest-dev/pytest/issues/6377
Ref: https://github.com/blueyed/pytest/pull/145
2020-02-15 00:32:16 +01:00
Daniel Hahler
9631b3c166 reports: use attr.asdict with serialize_repr_{crash,traceback} (#6732)
* Turn ReprTraceback into attrs class

* Use attr.asdict with serialize_repr_{crash,traceback}

* Turn ReprFileLocation into attrs class, convert py.path.local
2020-02-14 19:39:34 +01:00
Daniel Hahler
4b70ba2c21 tests: harden test_better_reporting_on_conftest_load_failure (#6713) 2020-02-14 17:00:01 +01:00
Daniel Hahler
de3353aac1 test_load_initial_conftest_last_ordering: handle testing package (#6706) 2020-02-14 16:58:17 +01:00
Bruno Oliveira
ef73a56032 Merge pull request #6737 from bluetech/fixture-cached-result
Don't delete FixtureDef.cached_result, set it to None instead
2020-02-14 12:33:03 -03: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
Daniel Hahler
d89b5057ca assertrepr_compare: provide more info (location) with exceptions (#6728) 2020-02-14 02:17:05 +01:00
Daniel Hahler
83137c89e9 tests: test_unicode_plus_minus: use unicode sign directly (#6727)
Was globbed for Python 2 before (57c448991).
2020-02-14 02:16:25 +01:00
Daniel Hahler
dbae5a7ff8 Recognize -V as a short option for --version (#6721) 2020-02-13 12:30:22 +01:00
Daniel Hahler
07b7b6fa7d doc: add docstring for CaptureManager._capturing_for_request (#6698)
Based on the removed doc for `_install_capture_fixture_on_item`.

Follow-up to https://github.com/pytest-dev/pytest/pull/6663.

Co-authored-by: Ran Benita <ran234@gmail.com>
2020-02-13 12:09:32 +01:00
Ran Benita
56a5dbe252 Merge pull request #6722 from bluetech/rm-callspec2-global
Remove unused CallSpec2 fields _globalid, _globalparam
2020-02-13 12:49:41 +02:00
Ran Benita
8a4d5227e2 Remove unused CallSpec2 fields _globalid, _globalparam 2020-02-13 12:31:48 +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
Daniel Hahler
b7ad4c2bed _pformat_dispatch: pass through args (#6715) 2020-02-12 16:07:57 +01:00
Bruno Oliveira
d79179a239 Merge pull request #6716 from bluetech/features-to-master-for-real
Merge the features branch into master, before stopping to use it
2020-02-12 11:52:32 -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
aa4d80cad9 RFC: Streamlining pytest's git workflow (#6571)
RFC: Streamlining pytest's git workflow
2020-02-12 08:37:14 -03: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
Ran Benita
c3e53a072d Switch to new git workflow
Co-Authored-By: Daniel Hahler <git@thequod.de>
2020-02-12 09:49:21 +02:00
Daniel Hahler
fa877665ad _set_main_color: does not need to return 2020-02-12 03:11:54 +01:00
Bruno Oliveira
3b582858f3 Merge pull request #6712 from nicoddemus/mm
Merge master into features
2020-02-11 20:22:20 -03: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
Ran Benita
7484e346f9 Merge pull request #6711 from bluetech/mv-exitcode
Move ExitCode's definition from _pytest.main to _pytest.config
2020-02-11 09:49:38 +02:00
Ran Benita
d25123eb01 Merge pull request #6710 from bluetech/rm-nodemarkers
Remove unused NodeMarkers
2020-02-10 23:57:40 +02:00
Ran Benita
d33da078a8 Move ExitCode's definition from _pytest.main to _pytest.config
ExitCode is used in several internal modules and hooks and so with type
annotations added, needs to be imported a lot.

_pytest.main, being the entry point, generally sits at the top of the
import tree.

So, it's not great to have ExitCode defined in _pytest.main, because it
will cause a lot of import cycles once type annotations are added (in
fact there is already one, which this change removes).

Move it to _pytest.config instead.

_pytest.main still imports ExitCode, so importing from there still
works, although external users should really be importing from `pytest`.
2020-02-10 23:55:06 +02: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
Ran Benita
7cc513b2af Remove unused NodeMarkers
This class was both added and became unused during the development of a
PR:
https://github.com/pytest-dev/pytest/pull/3317
2020-02-10 22:05:25 +02:00
Daniel Hahler
0ee007ca33 Fix CI (Travis) (#6704) 2020-02-10 20:52:21 +01:00
Ran Benita
1ebca37689 Merge pull request #6708 from bluetech/redundant-commas-2
Remove some redundant commas
2020-02-10 21:26:55 +02:00
Ran Benita
b59d32a5c7 Merge pull request #6709 from bluetech/rm-arg2finish
Remove unused field FixtureManager._arg2finish
2020-02-10 21:26:30 +02:00
Ran Benita
3e4e6297ce Remove unused field FixtureManager._arg2finish
Not used since 4f0879ff9b.
2020-02-10 17:30:20 +02:00
Ran Benita
0b2b40e35d Remove some redundant commas
Fix mypy errors:

src/_pytest/runner.py:36: error: "addoption" of "OptionGroup" does not return a value  [func-returns-value]
src/_pytest/helpconfig.py:64: error: "addoption" of "OptionGroup" does not return a value  [func-returns-value]
src/_pytest/terminal.py:67: error: "_addoption" of "OptionGroup" does not return a value  [func-returns-value]
src/_pytest/terminal.py:75: error: "_addoption" of "OptionGroup" does not return a value  [func-returns-value]
2020-02-10 17:28:05 +02:00
Daniel Hahler
f9dd58000a Fix CaptureManager.__repr__ (#6697) 2020-02-10 13:03:05 +01:00
Daniel Hahler
449290406c test_argcomplete: remove usage of distutils.spawn (#6703)
Fixes collection error with Python 3.5.3 (Travis):

    testing/test_parseopt.py:2: in <module>
        import distutils.spawn
    .tox/py35-coverage/lib/python3.5/distutils/__init__.py:4: in <module>
        import imp
    .tox/py35-coverage/lib/python3.5/imp.py:33: in <module>
        PendingDeprecationWarning, stacklevel=2)
    E   PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

Build log: https://travis-ci.org/blueyed/pytest/builds/648305304
2020-02-10 11:52:19 +01:00
Daniel Hahler
12824e6279 ci: Travis: remove non-py35 jobs 2020-02-10 10:59:28 +01:00
Daniel Hahler
a62d9a40e7 ci: Travis: 3.5.1: upgrade pip, setuptools, virtualenv
Ref: https://github.com/jaraco/zipp/issues/40
2020-02-10 10:53:42 +01:00
Daniel Hahler
30cb598e9c Typing around/from types in docs (#6699) 2020-02-09 11:42:07 +01:00
Daniel Hahler
114de91ab7 factor out _determine_main_color
(cherry picked from commit f36b9f7fa4fa1af7130406166df5c2be668e50c9)
2020-02-09 00:26:38 +01:00
Daniel Hahler
7a7c634e33 factor out KNOWN_TYPES
(cherry picked from commit 1180aedee727f7e8468fdc5561a87e12865622c6)
2020-02-09 00:26:26 +01:00
Daniel Hahler
b4ace46c42 capture: cleanup item fixture handling (#6663)
This started by looking at how to get the current test item in general,
and then I noticed that it is not necessary for the capture plugin to
track it manually in the first place.
2020-02-07 19:23: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
Minuddin Ahmed Rana
ef437ea448 Remove incorrect choices comment (#6677) 2020-02-05 20:45:21 +01:00
Daniel Hahler
cdc7e13067 pytester: clarify _makefile signature (#6675) 2020-02-05 20:42:57 +01:00
Daniel Hahler
39d9f7cff5 pytester: LineMatcher: typing, docs, consecutive line matching (#6653) 2020-02-04 22:47:18 +01:00
Daniel Hahler
632800add5 internal: clean up getfslineno (#6656) 2020-02-04 22:46:00 +01:00
Daniel Hahler
bc494661ad Remove testing/test_modimport.py (#6666) 2020-02-04 08:26:40 +01:00
Daniel Hahler
5a4c1b628b Use inspect.getdoc to massage fixture docstrings (#6668)
Ref: https://github.com/pytest-dev/pytest/pull/2575
2020-02-04 03:07:53 +01:00
Daniel Hahler
4316fe8a92 testing/conftest.py: testdir: set PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 (#6655)
Fixes https://github.com/pytest-dev/pytest/pull/4518.
2020-02-04 02:59:20 +01:00
Daniel Hahler
aa0328782f assertion: save/restore hooks on item (#6646) 2020-02-04 02:56:23 +01:00
Daniel Hahler
9c7f1d9b32 Remove compat.getfslineno 2020-02-04 02:40:59 +01:00
Daniel Hahler
dab90ef726 typing: fix getfslineno
Closes https://github.com/pytest-dev/pytest/pull/6590.
2020-02-03 19:09:08 +01:00
Daniel Hahler
61f2a26675 Code/getfslineno: keep empty co_filename
Previously this would be turned via `py.path.local("")` into the current
working directory.

This appears to be what `fspath = fn and py.path.local(fn) or None`
tries to avoid in `getfslineno`'s `TypeError` handling already, if
`Code` would raise it.
2020-02-03 19:09:08 +01:00
Daniel Hahler
b0d45267c5 internal: clean up getfslineno
Everything was using `_pytest.compat.getfslineno` basically, which
wrapped `_pytest._code.source.getfslineno`.

This moves the extra code from there into it directly, and uses the
latter everywhere.

This helps to eventually remove the one in compat eventually, and also
causes less cyclic imports.
2020-02-03 19:09:08 +01:00
Bruno Oliveira
1480aa31a7 Explicitly state on the PR template that we can squash commits (#6662)
* Explicitly state on the PR template that we can squash commits

This way we don't need to ask every time, and users who for some reason
would not like us to squash their commits can explicitly state so.
2020-02-03 14:35:50 -03: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
abffd16ce6 Keep (revisited) comment from https://github.com/pytest-dev/pytest/commit/4d31ea831 2020-02-03 14:04:16 +01:00
Daniel Hahler
fb289667e3 Remove testing/test_modimport.py
testing/test_meta.py ensures this already as a side effect
(+ tests a few more (`__init__.py` files) and should have been
combined with it right away [1].

1: https://github.com/pytest-dev/pytest/pull/4510#discussion_r289123446

Ref: https://github.com/pytest-dev/pytest/commit/eaa05531e
Ref: https://github.com/pytest-dev/pytest/commit/4d31ea831
2020-02-03 13:58:32 +01:00
Daniel Hahler
8ec4d03c91 Inline FunctionMixin with Function (#6664)
`Generator` was removed in 7eb28f9eb, and this pleases mypy to correctly
complain that `FunctionMixin` has no `config` (within
`_prunetraceback`).

* typing: _prunetraceback

* minor: imports, typing
2020-02-03 10:25:32 +01:00
rebecca-palmer
c55bf23cbe doc: s/pytest_mark/pytestmark (#6661) 2020-02-03 08:56:37 +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
Ran Benita
8bd612b367 typing: wrap_session
Pulled out of https://github.com/pytest-dev/pytest/pull/6556.
2020-02-02 23:12:48 +01:00
Daniel Hahler
5256542ea4 pytester.LineMatcher: add support for matching lines consecutively 2020-02-01 23:48:58 +01:00
Daniel Hahler
50f81db817 revisit/improve docstrings 2020-02-01 23:48:58 +01:00
Daniel Hahler
2681b0aed7 typing: pytester: LineMatcher 2020-02-01 23:48:57 +01:00
Daniel Hahler
b10ab0211c Use TypeError instead of AssertionError for no sequence
Improve/extends tests.
2020-02-01 23:48:57 +01:00
Daniel Hahler
09a0e45492 testing/test_pytester.py: cosmetics 2020-02-01 23:48:57 +01:00
Daniel Hahler
a9c5d31806 PyCollector._genfunctions: use already created fixtureinfo (#6636)
`Function` creates a `_fixtureinfo` already:
https://github.com/pytest-dev/pytest/blob/fed535694/src/_pytest/python.py#L1392-L1395
2020-02-01 06:27:41 +01:00
Hugo van Kemenade
c9eeafade5 Fix favicon for Chrome and Opera (#6639)
* Fix favicon for Chrome and Opera

* Delete pytest1favi.ico

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-01-31 20:56:45 -03:00
Bruno Oliveira
39b25ddcf3 Remove deprecated 'pytest_itemstart' hook (#6637)
Remove deprecated 'pytest_itemstart' hook
2020-01-31 16:12:27 -03:00
Ran Benita
4038d6c773 Merge pull request #6640 from bluetech/master-to-features
Merge master to features - one last time
2020-01-31 12:11:14 +02:00
Ran Benita
a435faad5c Merge branch 'master' into master-to-features 2020-01-31 11:27:06 +02:00
Daniel Hahler
3645ba3072 Merge pull request #6638 from blueyed/rfEX
tests: use `-rfEX`
2020-01-31 01:06:32 +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
Daniel Hahler
8301993e5e tests: use -rfEX
`-fE` is the default in `features` now [1], but the idea is to add `X`
also to it in the long run, so let's dogfood it ourselves.

1: https://github.com/pytest-dev/pytest/pull/6524
2: https://github.com/pytest-dev/pytest/pull/6524#issuecomment-577650703
2020-01-31 00:18:51 +01:00
Daniel Hahler
1dc265e34a Merge pull request #6633 from blueyed/async_warn
python: factor out async_warn
2020-01-30 23:39:06 +01:00
Daniel Hahler
e7a833635d Merge pull request #6635 from blueyed/fix-todo
minor: doc: getfuncargnames: move TODO out of docstring
2020-01-30 23:37:41 +01:00
Daniel Hahler
fed5356941 Merge pull request #6634 from blueyed/fixtures-move-import
fixtures: move import of ParameterSet to top level
2020-01-30 23:22:39 +01:00
Daniel Hahler
5b81bd862c minor: doc: getfuncargnames: move TODO out of docstring 2020-01-30 23:22:10 +01:00
Daniel Hahler
2902c7263c fixtures: move import of ParameterSet to top level
This gets typically used always (via `getfixtureinfo`).
2020-01-30 23:03:02 +01:00
Daniel Hahler
442dccef65 python: factor out async_warn 2020-01-30 22:55:23 +01:00
Daniel Hahler
e830432592 Merge pull request #6601 from blueyed/typing-pytest_collection
typing: pytest_collection
2020-01-30 20:47:06 +01:00
Daniel Hahler
ae788997f2 Merge pull request #6630 from blueyed/revert-curl
Revert "ci: codecov: use `--retry-connrefused` with curl"
2020-01-30 20:46:46 +01:00
Daniel Hahler
88b800355a typing: pytest_collection 2020-01-30 19:58:43 +01:00
Daniel Hahler
864338de71 Revert "ci: codecov: use --retry-connrefused with curl"
Not known with `curl` on Travis at least.

Reverts https://github.com/pytest-dev/pytest/pull/6573.

This reverts commit df1f43ee28.
2020-01-30 19:56:25 +01:00
Bruno Oliveira
eb5e651d7e Fix typo (#6629)
Fix typo
2020-01-30 13:41:47 -03:00
Hugo van Kemenade
55bffb7c15 Fix typo 2020-01-30 18:30:51 +02:00
Bruno Oliveira
be18f85a6e Reword fixture docs for clarity (#6627)
Reword fixture docs for clarity
2020-01-30 12:56:45 -03:00
Daniel Hahler
28b8f3ca3a Merge pull request #6461 from blueyed/test-package-upstream
Package: typing, cleanup
2020-01-30 16:41:47 +01:00
Daniel Arndt
d91459fc75 Reword fixture docs for clarity 2020-01-30 09:32:54 -04:00
Daniel Hahler
4de8e680e3 Merge pull request #6625 from blueyed/merge-master-into-features
Merge master into features
2020-01-30 02:53:56 +01:00
Bruno Oliveira
ef283efc42 Merge pull request #6624 from nicoddemus/gh-notes-wrap
Use --wrap=preserve in release notes script
2020-01-29 22:36:42 -03:00
Daniel Hahler
b5b6e051ed Merge master into features 2020-01-30 02:29:02 +01:00
Daniel Hahler
10b1b79f4e Merge pull request #6623 from blueyed/move-back-test_getfslineno
tests: move test_getfslineno back
2020-01-30 02:17:25 +01:00
Bruno Oliveira
6d7e06e6be Use --wrap=preserve in release notes script
Follow up to #6621 after premature merge
2020-01-29 20:28:04 -03:00
Daniel Hahler
78eddcb5b1 tests: move test_getfslineno back
Reverts https://github.com/pytest-dev/pytest/pull/6610.

The tested `getfslineno` is `src/_pytest/_code/source.py` actually,
exported via `src/_pytest/_code/__init__.py`.
I've confused it with the one in `src/_pytest/compat.py` apparently.
2020-01-29 23:47:39 +01:00
Bruno Oliveira
757873edb3 Docs: Don't wrap the markdown for GitHub releases (#6621)
Docs: Don't wrap the markdown for GitHub releases
2020-01-29 19:38:17 -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
Daniel Hahler
66330444a3 Merge pull request #6611 from blueyed/test_code-imports
tests: test_code: improve/clarify imports
2020-01-29 21:23:37 +01:00
Hugo van Kemenade
97f1645993 Don't wrap the markdown for GitHub releases 2020-01-29 21:56:01 +02:00
Daniel Hahler
3dbc61dd80 tests: test_code: improve/clarify imports 2020-01-29 19:44:37 +01:00
Daniel Hahler
b42938421e Merge pull request #6610 from blueyed/tests-move-test_getfslineno
tests: move test_getfslineno
2020-01-29 19:43:28 +01:00
Daniel Hahler
87fecce77b Merge pull request #6600 from blueyed/harden-test_teardown_many_verbose
tests: harden test_teardown_many_verbose
2020-01-29 18:56:10 +01:00
Daniel Hahler
05d953d9e4 Merge pull request #6620 from blueyed/cp-release
doc: release-5.3.5
2020-01-29 18:42:27 +01:00
Daniel Hahler
d478e2bbca doc: release-5.3.4
(cherry picked from commit fd1a51a23f)
2020-01-29 18:28:11 +01: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
Bruno Oliveira
8c41236c66 doc: getting-started.rst: mention "Test" prefix for classes (#6583)
doc: getting-started.rst: mention "Test" prefix for classes
2020-01-29 12:49:49 -03:00
Bruno Oliveira
99b90f45d0 extend the incremental marker for parametrize (#6582)
extend the incremental marker for parametrize
2020-01-29 08:37:33 -03:00
sdementen
d848a20563 Extend the incremental marker for parametrize
The incremental marker is adapted to handle properly test classes with parametrize defined at class level.

Fix #3125
2020-01-29 08:25:17 -03:00
Daniel Hahler
06a7fef00f Merge pull request #6616 from blueyed/merge-master-into-features
Merge master into features
2020-01-29 06:57:45 +01:00
Daniel Hahler
55e5817570 Merge master into features 2020-01-29 03:07:35 +01:00
Daniel Hahler
3f4b8d3aec test_code: improve coverage 2020-01-29 02:54:12 +01:00
Daniel Hahler
a3f482ceba tests: move test_getfslineno
It should be in `test_code` when testing `_pytest._code.getfslineno`,
not to be confused with `_pytest._code.source.getfslineno`.

Adds an extra assert (via https://github.com/pytest-dev/pytest/pull/6590).
2020-01-29 01:26:10 +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
8e1d59a8dd Merge pull request #6579 from blueyed/pytester-makefile-joins-abspath
pytester: test for _makefile joining an absolute path
2020-01-29 00:58:43 +01:00
Daniel Hahler
7eaf98af4b Merge pull request #6589 from blueyed/ci-less-coverage
ci: GHA: run less jobs with coverage
2020-01-29 00:57:29 +01:00
Bruno Oliveira
d282424589 Fix unguarded == comparison in fixtures. (#6541)
Fix unguarded `==` comparison in fixtures.
2020-01-28 20:54:14 -03: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
Daniel Hahler
4ff90b1fcf Merge pull request #6606 from blueyed/typing-monkeypatch-context
typing: MonkeyPatch.context
2020-01-29 00:12:53 +01:00
Daniel Hahler
2d29c3e7d1 Merge pull request #6604 from blueyed/tests-_compute_fixture_value-cover-abs-source_path_str
tests: cover absolute path handling in _compute_fixture_value
2020-01-29 00:11:58 +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
Ran Benita
e440b43258 Merge pull request #6555 from bluetech/nodes-cache-split
Split Session._collection_node_cache to 3 mutually exclusive parts
2020-01-28 22:49:42 +02:00
Daniel Hahler
e25d46aae6 typing: MonkeyPatch.context 2020-01-28 21:44:30 +01:00
Daniel Hahler
7c87874277 source_path: py.path.local directly
Via bc7282576.
2020-01-28 19:02:41 +01:00
Daniel Hahler
1cf9e68dbc tests: cover absolute path handling in _compute_fixture_value 2020-01-28 18:53:28 +01:00
Daniel Hahler
b2e6f66438 ci: GHA: run less jobs with coverage
This often might be causing for jobs to take longer than 10 minutes,
which is a timeout Codecov uses to wait for successful CI.

Also it is good in general to have CI finish faster, of course.
2020-01-28 17:38:53 +01:00
Daniel Hahler
b01e379428 tests: harden test_teardown_many_verbose 2020-01-28 16:37:18 +01:00
Daniel Hahler
1586653102 Merge pull request #6594 from blueyed/merge-master-into-features
Merge master into features
2020-01-28 14:44:22 +01:00
Daniel Hahler
18ac7e0b79 Merge pull request #6593 from blueyed/typing-ignore-more-itertools
typing: ignore false positive with more-itertools
2020-01-28 14:24:24 +01:00
Ronny Pfannschmidt
c854daa234 Merge pull request #6595 from blueyed/fix-typing-code-path
typing: fix Code.path
2020-01-28 11:23:49 +01:00
Daniel Hahler
12c5a6af64 typing: fix Code.path
Fixes:

> src/_pytest/_code/code.py:83: error: Incompatible types in assignment
>   (expression has type "str", variable has type "local")  [assignment]
2020-01-28 01:49:45 +01:00
Daniel Hahler
30922ee694 Merge master into features 2020-01-28 01:40:14 +01:00
Daniel Hahler
35ba053f00 typing: ignore false positive with more-itertools
Fixed in https://github.com/erikrose/more-itertools/pull/374.
2020-01-28 01:23:44 +01:00
Daniel Hahler
d0cb16010b Merge pull request #6580 from blueyed/typing-testdir-init
typing: Testdir.__init__
2020-01-28 00:58:11 +01:00
Daniel Hahler
ad0f4f0ac0 tests: cover collect_by_name with non-existing 2020-01-28 00:41:46 +01:00
Daniel Hahler
9c716e4d74 typing: Testdir.plugins 2020-01-28 00:41:46 +01:00
Daniel Hahler
94ac0f7e6b typing: self._mod_collections, collect_by_name 2020-01-28 00:41:46 +01:00
Daniel Hahler
440881d63a typing: Testdir.__init__ 2020-01-28 00:41:46 +01:00
Daniel Hahler
aa318e9adf Merge pull request #6587 from blueyed/mypy-show_error_codes
mypy: show_error_codes=True
2020-01-27 22:58:48 +01:00
Daniel Hahler
20b66e60c0 Merge pull request #6566 from blueyed/rm-encodedfile-writelines
Fix `EncodedFile.writelines`
2020-01-27 22:58:31 +01:00
Daniel Hahler
d017b69f38 mypy: show_error_codes=True 2020-01-27 22:18:35 +01:00
Ran Benita
ae5d16be10 typing: FSHookProxy/gethookproxy
Taken out of https://github.com/pytest-dev/pytest/pull/6556.
2020-01-27 20:57:44 +01:00
ParetoLife
cbad319736 Update getting-started.rst
From the description it seemed to me as if just prefixing your methods with ``test_`` was enough, but you also need to prefix your class with ``Test``. Of course, in the reference material this is clearly stated, but I think it makes sense to mention it here as well, since you also mention the part about the methods' prefix.
2020-01-27 10:50:05 +01:00
Zac Hatfield-Dodds
a9eab07739 Merge pull request #6576 from blueyed/test_via_exec
tests: add test_via_exec
2020-01-27 17:57:28 +11:00
Daniel Hahler
c2980eb80f pytester: test for _makefile joining an absolute path
Ref: https://github.com/pytest-dev/pytest/pull/6578#discussion_r371035867
2020-01-27 01:00:55 +01:00
Daniel Hahler
bf5c76359c fixup! typing: tests: tmpfile 2020-01-26 23:14:32 +01:00
Daniel Hahler
40758e86ca tests: add test_via_exec
Via https://github.com/pytest-dev/pytest/issues/6574.
2020-01-26 23:04:18 +01:00
Daniel Hahler
d678d380cb typing: tests: tmpfile 2020-01-25 19:21:19 +01:00
Daniel Hahler
3f8f395210 typing: EncodedFile 2020-01-25 19:20:48 +01:00
Daniel Hahler
7c52a37d46 Merge pull request #6572 from blueyed/fix-test_collection_collect_only_live_logging
tests: test_collection_collect_only_live_logging: allow for 1+s
2020-01-25 19:05:37 +01:00
Daniel Hahler
198b1dcffd Merge pull request #6573 from blueyed/codecov-curl-retry-connrefused
ci: codecov: use `--retry-connrefused` with curl
2020-01-25 19:05:13 +01:00
Daniel Hahler
e2934c3f8c Move common code between Session and Package to FSCollector 2020-01-25 19:04:01 +01:00
Daniel Hahler
6b7e1a246c Sync {Session,Package}.gethookproxy
Only copy'n'paste error from c416b1d935.
2020-01-25 19:04:01 +01:00
Daniel Hahler
817c094ce6 Clean up Package.__init__
Makes `parent` a required arg, which would have failed before via
`parent.session` anyway.

Keeps calling/passing unused args for B/C.
2020-01-25 19:04:01 +01:00
Daniel Hahler
df1f43ee28 ci: codecov: use --retry-connrefused with curl
While it might not help with the following, it certainly might happen as
well.

```
+ curl -S -L --connect-timeout 5 --retry 6 -s https://codecov.io/bash -o codecov-upload.sh
curl: (16) Error in the HTTP2 framing layer
```
2020-01-25 18:22:03 +01:00
Daniel Hahler
778d4364fa tests: test_collection_collect_only_live_logging: allow for 1s
Might be slow on CI.

Ref: https://github.com/pytest-dev/pytest/pull/6570/checks?check_run_id=408752475#step:6:109
2020-01-25 18:14:49 +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
9b8039cf09 Sync {Session,Package}._recurse 2020-01-25 16:44:20 +01:00
Daniel Hahler
b687f20d25 Merge pull request #6375 from hugovk/rm-deprecated-license_file-metadata
Remove deprecated license_file from setup.cfg
2020-01-25 16:20:48 +01:00
Daniel Hahler
510be29db8 Merge pull request #6534 from blueyed/test_plugin_loading_order
tests: add test_plugin_loading_order
2020-01-25 16:20:06 +01:00
Hugo
fe343a79f8 Remove deprecated license_file from setup.cfg
Starting with wheel 0.32.0 (2018-09-29), the `license_file` option is deprecated.

* https://wheel.readthedocs.io/en/stable/news.html

The wheel will continue to include `LICENSE`, it is now included automatically:

* https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file

And `LICENSE` is still included in sdists thanks to setuptools-scm:

* https://github.com/pytest-dev/pytest/pull/6348#issuecomment-567836331
2020-01-25 17:08:00 +02:00
Daniel Hahler
1e3bc1814d typing for test_summary_stats 2020-01-25 15:09:02 +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
2e8f7ef31b Merge pull request #6569 from blueyed/merge-master-into-features
Merge master into features
2020-01-25 14:40:24 +01:00
Daniel Hahler
c51173d426 Merge master into features 2020-01-25 14:18:02 +01:00
Daniel Hahler
2da331ea9c Merge pull request #6568 from bluetech/redundant-commas
Remove a couple of redundant commas
2020-01-25 14:17:01 +01:00
Ran Benita
94d8c071b6 Remove a couple of redundant commas
Mypy complains about this once the function is typed:

src/_pytest/main.py:85: error: "_addoption" of "OptionGroup" does not return a value
src/_pytest/main.py:133: error: "addoption" of "OptionGroup" does not return a value
2020-01-25 14:12:47 +01:00
Daniel Hahler
0d55fb3797 Merge pull request #6567 from blueyed/codecov-config
ci: codecov: only use "comment: off"
2020-01-25 14:00:32 +01:00
Ran Benita
f3967333a1 Split Session._collection_node_cache to 3 mutually exclusive parts
Previously, this cache was used with 3 different and mutually exclusive
key-type -> value-type combinations. Mypy can't properly type this. It's
also quite confusing.

Split to 3 different dicts instead.
2020-01-25 14:31:12 +02:00
Ran Benita
a76bc64c54 Merge pull request #6547 from bluetech/session-initialparts
Refactor Session._initialparts to have a more explicit type
2020-01-25 14:30:26 +02:00
Ran Benita
dd5c2b22bd Refactor Session._initialparts to have a more explicit type
Previously, _initialparts was a list whose first item was a
`py.path.local` and the rest were `str`s. This is not something that
mypy is capable of modeling. The type `List[Union[str, py.path.local]]`
is too broad and would require asserts for every access.

Instead, make each item a `Tuple[py.path.local, List[str]]`. This way
the structure is clear and the types are accurate.

To make sure any users who might have been accessing this (private)
field will not break silently, change the name to _initial_parts.
2020-01-25 13:57:49 +02:00
Daniel Hahler
a29d6194f5 ci: codecov: only use "comment: off"
The changes status is quite buggy, remove it for now.
This just uses "comment: off" then.
2020-01-25 11:14:00 +01:00
Daniel Hahler
6f2943c7b3 Merge pull request #6558 from gavento/patch-1
Make EncodedFile.write() return the return value from inner write()
2020-01-25 11:04:12 +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
498884a2a0 Merge pull request #6563 from blueyed/merge-master-into-features
Merge master into features
2020-01-25 00:31:58 +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
09ab5fd7e9 Merge pull request #6529 from blueyed/fix-test_repr_traceback_with_invalid_cwd
tests: fix test_repr_traceback_with_invalid_cwd
2020-01-24 23:41:31 +01:00
Daniel Hahler
040a61e22c Merge pull request #6550 from blueyed/doc-cleandir-cd-back
doc/en/fixture.rst: chdir back to previous directory
2020-01-24 23:41:08 +01:00
Daniel Hahler
2c32dad343 Merge pull request #6554 from blueyed/test_fixture_arg_ordering
tests: add test_fixture_arg_ordering
2020-01-24 23:40:58 +01:00
Daniel Hahler
8a8f9bd751 Merge pull request #6562 from blueyed/ci-rm-azure
ci: remove Azure config/scripts
2020-01-24 23:39:57 +01:00
Daniel Hahler
192d3adda3 tests: add test_fixture_arg_ordering
This is a regression test for part of
https://github.com/pytest-dev/pytest/issues/6492, testing one of the
fixes in https://github.com/pytest-dev/pytest/pull/6551.
2020-01-24 17:48:08 -03:00
Daniel Hahler
5865520c51 Merge pull request #6561 from blueyed/ci-gha-name-flag
ci: GHA: codecov: set CODECOV_NAME, OS in flags
2020-01-24 20:04:12 +01:00
Daniel Hahler
e2fa78c99f ci: remove Azure config/scripts
This is covered by GitHub Actions now.
2020-01-24 19:49:57 +01:00
Daniel Hahler
fe895a40b6 Merge pull request #6559 from blueyed/ci-travis-remove-linting
ci: Travis: removing linting,docs,doctesting
2020-01-24 19:45:42 +01:00
Daniel Hahler
934f38995a ci: GHA: codecov: set CODECOV_NAME, OS in flags 2020-01-24 19:42:51 +01:00
Daniel Hahler
5dcd24fecb Merge pull request #6553 from blueyed/ci-gha-use-report-coverage.sh
ci: GHA: use scripts/report-coverage.sh
2020-01-24 19:20:23 +01:00
Daniel Hahler
e5a362d0f5 ci: GHA: use scripts/report-coverage.sh 2020-01-24 18:00:38 +01:00
Daniel Hahler
f8654e6656 ci: Travis: removing linting,docs,doctesting
This is handled by GHA already, and not affected/required for coverage.
2020-01-24 17:26:10 +01:00
Daniel Hahler
0d4f479aa8 Merge pull request #6552 from blueyed/ci-linting
ci: GHA: separate jobs for linting, docs, doctesting
2020-01-24 13:36:59 +01:00
Daniel Hahler
79d00ab35a Merge pull request #6549 from blueyed/fix-release-minor
doc: minor fixes for the release process
2020-01-24 13:36:48 +01:00
Daniel Hahler
79ae86cc3f tests: fix test_repr_traceback_with_invalid_cwd
This never worked as expected (since a912d3745), and only py38-windows
triggered the mocked `os.getcwd` unintentionally, via `inspect`.
2020-01-24 12:52:12 +01:00
Daniel Hahler
c051a9e7b9 ci: GHA: separate jobs for linting, docs, doctesting
It helps to know upfront that e.g. linting failed, and makes finding the
error easier.
2020-01-24 12:29:35 +01:00
Daniel Hahler
cdd6f86e43 bug-fix fixes 2020-01-23 20:34:21 +01:00
Daniel Hahler
83451b548f doc/en/fixture.rst: chdir back to previous directory
This is considered to be best practice, and should be used in docs
therefore.
2020-01-23 19:09:18 +01:00
Daniel Hahler
38538c6c6d Merge pull request #6548 from blueyed/ci-codecov-flag-gha
ci: codecov: add flag for GHA
2020-01-23 18:39:50 +01:00
Daniel Hahler
55ebd9f803 doc: minor fixes for the release process 2020-01-23 18:31:48 +01:00
Daniel Hahler
8ca8d25202 Merge pull request #6545 from blueyed/terminalwriter
config: typing for create_terminal_writer, re-export TerminalWriter
2020-01-23 15:42:18 +01:00
Daniel Hahler
a8d67f5e7b ci: codecov: add flags for GHA/Travis
This would help with debugging missing coverage when removing Travis
jobs.
2020-01-23 15:41:41 +01:00
Daniel Hahler
03bc8aba4e config: typing for create_terminal_writer, re-export TerminalWriter
This also imports `TerminalWriter` explicitly via `_pytest._io`,
allowing for easier extending / replacing it.
2020-01-23 14:09:37 +01:00
Daniel Hahler
6b13379f37 Merge pull request #6521 from blueyed/harden-nose-raises
tests: improve test for `nose.raises`
2020-01-23 13:42:14 +01:00
Ran Benita
9dcdea5de7 Rewrite Item.location to be clearer with regard to types 2020-01-23 13:25:15 +01:00
Daniel Hahler
863bab5326 Merge pull request #6544 from blueyed/doc-rm-costlysetup
doc: remove costlysetup example
2020-01-23 13:21:32 +01:00
Daniel Hahler
8521503246 Merge pull request #6527 from blueyed/typing-getfslineno
typing: fix/adjust _code.source.getfslineno
2020-01-23 13:17:47 +01:00
Ran Benita
0b6258ab5b PyCollector.collect: use explicit cast to str
Ref: https://github.com/pytest-dev/pytest/pull/6521#pullrequestreview-347234792
2020-01-23 12:54:52 +01:00
Daniel Hahler
b63cb18776 doc: remove costlysetup example
It is not included with docs, and
`example/costlysetup/sub_a/test_quick.py::test_quick` sleeps for 5s,
slowing down `doctesting` unnecessarily.
2020-01-23 12:23:30 +01:00
Daniel Hahler
00097df5cd tests: add test_plugin_loading_order
Ref: https://github.com/pytest-dev/pytest/pull/6443
2020-01-23 11:57:12 +01:00
Daniel Hahler
10e243d206 Merge pull request #6543 from blueyed/rm-rw
tests: remove unnecessary `-rw` option
2020-01-23 11:56:07 +01:00
Daniel Hahler
e7444bbd5e tests: remove unnecessary -rw option
Warnings are enabled by default, which is tested by `test_getreportopt`.
2020-01-23 11:37:19 +01:00
Daniel Hahler
eb7a57f965 Merge pull request #6542 from blueyed/fix-test_record_property
tests: fix/harden test_record_property
2020-01-23 11:14:37 +01:00
Daniel Hahler
252eae5bc8 tests: fix/harden test_record_property
`-rv` is not a recognized reportchar.  Probably `-v` was meant, but is
not necessary to check that there are no warnings.

Followup to 2018cf12b (https://github.com/pytest-dev/pytest/pull/3360).
2020-01-23 10:49:59 +01:00
Daniel Hahler
9c7b3c57d7 typing: PyobjMixin.reportinfo, getfslineno 2020-01-23 10:45:31 +01:00
Daniel Hahler
1350c601dc Node.location: handle str with _node_location_to_relpath 2020-01-23 10:45:31 +01:00
Daniel Hahler
ef112fd7dd Revert "Revert "Fix type errors after adding types to the py dependency""
Without changes to test_itemreport_reportinfo.

This reverts commit fb99b5c66e.

Conflicts:
	testing/test_nose.py
2020-01-23 10:45:27 +01:00
Daniel Hahler
8fa57c8384 tests: improve test for nose.raises
This should probably get transferred into a `pytest.fail` really, but
tests/documents the current behavior.
2020-01-23 10:45:26 +01:00
Daniel Hahler
ad02f6f879 Merge pull request #6525 from blueyed/typing-session
typing: Session.__init__
2020-01-23 00:16:08 +01:00
Daniel Hahler
bd6ba3f3e1 typing: Session.__init__
Pulled out of https://github.com/pytest-dev/pytest/pull/6491.
2020-01-23 00:07:59 +01:00
Bruno Oliveira
e17f5fad14 Clear node collection cache after collection is done (#6491)
Clear node collection cache after collection is done
2020-01-22 16:08:59 -03:00
Daniel Hahler
72d06e6dec Merge pull request #6539 from blueyed/merge-master-into-features
Merge master into features
2020-01-22 19:32:49 +01:00
Daniel Hahler
aca1723d45 Merge master into features 2020-01-22 19:18:13 +01:00
Daniel Hahler
85df6bbe26 Merge pull request #6536 from blueyed/fix-test_cwd_snapshot
tests: fix test_cwd_snapshot
2020-01-22 16:46:04 +01:00
Daniel Hahler
ba49581510 Merge pull request #6538 from blueyed/test-coverage
tests: use NotImplementedError with uncovered code
2020-01-22 16:45:20 +01:00
Bruno Oliveira
0bf9628e62 Merge master into features (#6537)
Merge master into features
2020-01-22 12:43:19 -03:00
Daniel Hahler
d878d9d4d5 tests: use NotImplementedError with uncovered code 2020-01-22 15:38:12 +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
Daniel Hahler
8c4dfca0c1 Merge pull request #6535 from blueyed/tox-doctesting
tox: move doctesting into main testenv
2020-01-22 14:38:34 +01:00
Daniel Hahler
b8787b8732 tests: fix test_cwd_snapshot
Without restoring the cwd, successive tests might fail to parse the
config (via `_pytest.config._prepareconfig()`, for when `--lsof` is
used).

And it is good practice to restore the cwd in any case anyway.
2020-01-22 14:34:11 +01:00
Daniel Hahler
ef294fc727 tox: move doctesting into main testenv
This allows for `tox -e doctesting-coverage`, which would otherwise not
use the "doctesting" testenv.
2020-01-22 13:32:30 +01:00
Daniel Hahler
0f78ef8e02 Merge pull request #6532 from blueyed/harden-test
--cache-clear: add test for keeping non-supporting files
2020-01-22 12:20:24 +01:00
Daniel Hahler
1cd4bafda7 Merge pull request #6531 from blueyed/ci-gha-success
ci: GHA: remove unnecessary check for `success()`
2020-01-21 22:38:50 +01:00
Daniel Hahler
8f5fd537d8 --cache-clear: add test for keeping non-supporting files
Ref: https://github.com/pytest-dev/pytest/pull/6296
2020-01-21 22:16:56 +01:00
Daniel Hahler
9869a3d9e1 ci: GHA: remove unnecessary check for success()
Following jobs get aborted on failure.

Ref: https://github.com/pytest-dev/pytest/pull/6530
2020-01-21 21:44:49 +01:00
Daniel Hahler
2f00b041e4 Merge pull request #6526 from blueyed/typing-code-path
doc: fix Code.path: might return str
2020-01-21 21:06:26 +01:00
Daniel Hahler
62db3f7abc typing: fix/adjust _code.source.getfslineno 2020-01-21 19:48:17 +01:00
Daniel Hahler
7ee27fedee doc: fix Code.path: might return str 2020-01-21 19:46:43 +01:00
Bruno Oliveira
7b1e3d1c9a Clear collection caches after collection is done
Also rename the involved variables to convey its intent better and
add type hints
2020-01-21 07:29:13 -03:00
Ran Benita
a52f791461 Merge pull request #6518 from bluetech/fix-py-typed-fixes-regression
Fix internal assert failure regression in 5.3.4
2020-01-21 00:01:07 +02:00
Ran Benita
fb99b5c66e Revert "Fix type errors after adding types to the py dependency"
This reverts commit 930a158a6a.

Regression test from Bruno Oliveira.
2020-01-20 23:44:56 +02:00
Bruno Oliveira
ddfa41b5a7 Preparing release version 5.3.4 (#6516)
Preparing release version 5.3.4
2020-01-20 14:26:52 -03:00
Bruno Oliveira
6a26ac4125 Preparing release version 5.3.4 2020-01-20 13:53:31 -03:00
Bruno Oliveira
cdaa9c06e1 Revert "fixtures register finalizers with all fixtures before t… (#6496)
Revert "fixtures register finalizers with all fixtures before them in the stack"
2020-01-20 13:49:00 -03:00
Bruno Oliveira
0dc82e8501 Add CHANGELOG entry for #6496 2020-01-20 13:32:27 -03:00
Daniel Hahler
f9bed82c4d Merge pull request #6515 from blueyed/tox-mypy-diff
tox: add mypy-diff testenv
2020-01-20 14:29:15 +01:00
Daniel Hahler
2406076611 tox: add mypy-diff testenv 2020-01-20 13:42:07 +01:00
Ran Benita
44eb1f580c Merge pull request #6311 from bluetech/type-annotations-10
Some type annotation & check_untyped_defs fixes
2020-01-19 20:17:32 +02:00
Ran Benita
3392be37e1 Fix check_untyped_defs in test_runner 2020-01-19 20:01:07 +02:00
Ran Benita
3d2680b31b Fix type of pytest.warns, and fix check_untyped_defs in test_recwarn
The expected_warning is optional.
2020-01-19 19:39:14 +02:00
Ran Benita
0b603156b9 Fix check_untyped_defs errors in test_pytester 2020-01-19 19:39:14 +02:00
Ran Benita
0c247be769 Add a few missing type annotations in _pytest._code
These are more "dirty" than the previous batch (that's why they were
left out). The trouble is that `compile` can return either a code object
or an AST depending on a flag, so we need to add an overload to make the
common case Union free. But it's still worthwhile.
2020-01-19 19:39:14 +02:00
Ran Benita
3e6f0f34ff Cleanup unhelpful alias _AST_FLAG
Also replace one direct call to `compile` with this flag with the
equivalent wrapper `ast.parse`. This function can have a more precise
type.
2020-01-19 19:19:34 +02:00
Ran Benita
4fb9cc3bf0 Merge pull request #6511 from bluetech/py-typed-fixes
Fix type errors after adding types to the `py` dependency
2020-01-19 15:23:14 +02:00
Ran Benita
930a158a6a Fix type errors after adding types to the py dependency 2020-01-19 14:48:24 +02:00
Daniel Hahler
d347a30656 Merge pull request #6510 from blueyed/typing-fixes
typing: fix some "incompatible types in assignment" with py
2020-01-19 13:01:35 +01:00
Daniel Hahler
32b62f770f Merge pull request #6509 from blueyed/typing-minor
typing: minor improvements
2020-01-19 11:33:41 +01:00
Daniel Hahler
aaae43e0ba typing: fix some "incompatible types in assignment" with py 2020-01-19 11:32:45 +01:00
Daniel Hahler
1a75a3c08e Merge pull request #6482 from blueyed/fix-_TracebackStyle
typing: fix _TracebackStyle
2020-01-19 11:24:05 +01:00
Daniel Hahler
09e9a01df3 typing: fix _TracebackStyle: add "line" 2020-01-19 11:22:47 +01:00
Daniel Hahler
4b974b051d Merge pull request #6507 from blueyed/fix-test_excinfo
tests: test_excinfo: remove unused pytest_version_info
2020-01-19 11:21:46 +01:00
Daniel Hahler
5c445b05e7 typing: py.io.TerminalWriter for tw arguments 2020-01-19 11:21:16 +01:00
Daniel Hahler
4e0dbe92dd Node.name: str 2020-01-19 11:21:16 +01:00
Daniel Hahler
956389fa8c Session._fixturemanager 2020-01-19 11:21:16 +01:00
Daniel Hahler
61f985f3c7 tests: test_excinfo: remove unused pytest_version_info
This might fail unnecessarily with a (wrong) determined version of e.g.
"4.7.dev307+ge98176cf5" (no patch version).
Ref: https://github.com/pytest-dev/pytest/pull/6506
2020-01-19 08:11:13 +01:00
Daniel Hahler
2f0d0fb349 Merge pull request #6503 from blueyed/ci-travis-features
[features] ci: Travis: drop deploy and non-coverage jobs
2020-01-18 22:22:21 +01:00
Daniel Hahler
e98176cf50 Merge pull request #6501 from blueyed/test_color_yes
tests: terminal: harden test_color_yes
2020-01-18 16:11:27 +01:00
Daniel Hahler
38fc208205 tests: terminal: harden/improve test_color_yes 2020-01-18 15:49:59 +01:00
Daniel Hahler
89f92a459a ci: Travis: remove non-coverage jobs
This helps with regard to slowness until
https://github.com/pytest-dev/pytest/pull/6470 is resolved.

(cherry picked from commit a7292a0544)
2020-01-18 15:12:44 +01:00
Bruno Oliveira
40d0031cce Drop deploy from Travis in favor of GitHub actions
GitHub actions already should deploy.

This is a stop gap while we figure out why coverage dropped
when removing Travis builds in #6470

(cherry picked from commit d1d7e5d41b)
2020-01-18 15:12:44 +01:00
Daniel Hahler
d0811c1f3d Merge pull request #6502 from blueyed/fix-ci-features
[features] fix CI
2020-01-18 15:12:13 +01:00
Daniel Hahler
ac41f36a02 Merge pull request #6500 from blueyed/ci-travis
ci: Travis: remove non-coverage jobs
2020-01-18 14:53:03 +01:00
Daniel Hahler
7a626921c0 [features] tests: fix test_crash_on_closing_tmpfile_py27
(cherry picked from commit 4f0eec2022)
2020-01-18 14:52:18 +01:00
Daniel Hahler
59bc6efbf2 Merge pull request #6498 from blueyed/test_terminal_colors
test_terminal: improve color handling
2020-01-18 13:36:42 +01:00
Daniel Hahler
a7292a0544 ci: Travis: remove non-coverage jobs
This helps with regard to slowness until
https://github.com/pytest-dev/pytest/pull/6470 is resolved.
2020-01-18 13:35:44 +01:00
Daniel Hahler
1971033051 Merge pull request #6499 from blueyed/fix-ci
tests: fix test_crash_on_closing_tmpfile_py27
2020-01-18 13:35:11 +01:00
Daniel Hahler
d4d04e7f25 test_terminal: improve color handling 2020-01-18 13:16:27 +01:00
Daniel Hahler
4f0eec2022 tests: fix test_crash_on_closing_tmpfile_py27 2020-01-18 13:15:40 +01:00
Bruno Oliveira
cc7f294cfe Revert "fixtures register finalizers with all fixtures before them in the stack"
This reverts commit 99180939fe.
2020-01-17 12:55:57 -03:00
Bruno Oliveira
e1298faef9 Merge pull request #6481 from nicoddemus/release-5.3.3
Release 5.3.3
2020-01-17 08:07:57 -03:00
Daniel Hahler
e211d6fe2a Merge pull request #6488 from blueyed/typing-fix-reportinfo
typing: Node.reportinfo: might return py.path.local via fspath
2020-01-17 11:52:01 +01:00
Bruno Oliveira
544b4a14d5 Fix Hugo van Kemenade name in release announcement
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-01-17 07:18:57 -03:00
Daniel Hahler
4a42deee7e typing: Node.reportinfo: might return py.path.local via fspath 2020-01-17 11:05:46 +01:00
Daniel Hahler
2cce026766 Merge pull request #6476 from blueyed/fix-test_config
Fix test_config: wrong assertions, lint, unused fixtures
2020-01-17 10:31:41 +01:00
Daniel Hahler
e16cb2fdd0 Merge pull request #6444 from blueyed/fix-test_xfail_handling
tests: test_xfail_handling: use sys.dont_write_bytecode
2020-01-17 10:28:23 +01:00
Daniel Hahler
dcb94d8f31 Merge pull request #6485 from blueyed/lint-fix-f999
scripts/release.py: lint: fix F999
2020-01-17 09:13:04 +01:00
Daniel Hahler
19f66cb824 Merge pull request #6434 from blueyed/pytester-typing-spawn
pytester: typing for `spawn`/`spawn_pytest`
2020-01-17 06:57:40 +01:00
Daniel Hahler
36944157f8 pytester: typing for spawn/spawn_pytest 2020-01-17 05:58:25 +01:00
Daniel Hahler
2cfee583db scripts/release.py: lint: fix F999 2020-01-17 05:54:17 +01:00
Bruno Oliveira
56dc301c50 Preparing release version 5.3.3 2020-01-16 18:55:41 -05:00
Bruno Oliveira
aa05334984 Remove broken link for user @jgsonesen 2020-01-16 18:51:33 -05:00
Bruno Oliveira
4806878a7f Drop deploy from Travis in favor of GitHub actions (#6480)
Drop deploy from Travis in favor of GitHub actions
2020-01-16 18:34:44 -03:00
Bruno Oliveira
d1d7e5d41b Drop deploy from Travis in favor of GitHub actions
GitHub actions already should deploy.

This is a stop gap while we figure out why coverage dropped
when removing Travis builds in #6470
2020-01-16 18:12:47 -03: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
5b0e255e85 Merge pull request #6465 from blueyed/doc-rootdir
doc: revisit section about rootdir
2020-01-16 21:55:12 +01:00
Daniel Hahler
f0fdafeddc Merge pull request #6477 from blueyed/tests-cleanup-unused-fixtures
tests: cleanup unused fixtures
2020-01-16 21:53:56 +01:00
Daniel Hahler
a4f5b8a4d6 Merge pull request #6478 from blueyed/merge-master-into-features
Merge master into features
2020-01-16 21:14:30 +01:00
Daniel Hahler
5049e25a6a tests: cleanup unused fixtures 2020-01-16 21:12:48 +01:00
Daniel Hahler
d36c712bb0 Merge pull request #6479 from blueyed/tests-fix-master
[master] Use a dummy RemoteTraceback for test in Python 3.5 Windows
2020-01-16 21:12:04 +01:00
Bruno Oliveira
7a0d1b387d Use a dummy RemoteTraceback for test in Python 3.5 Windows
Somehow in Python 3.5 on Windows this test fails with:
   File "c:\hostedtoolcache\windows\python\3.5.4\x64\Lib\multiprocessing\connection.py", line 302, in _recv_bytes
     overlapped=True)
OSError: [WinError 6] The handle is invalid

This only happens in this platform and Python version, decided to use
a dummy traceback as originally done in #6412.

(cherry picked from commit b9c136b809)
2020-01-16 20:03:16 +01:00
Daniel Hahler
5f4cd536f9 Use _pytest.compat.TYPE_CHECKING 2020-01-16 19:47:23 +01:00
Daniel Hahler
83813bf515 Merge master into features
Conflicts:
	.github/workflows/main.yml
2020-01-16 19:45:52 +01:00
Daniel Hahler
749752d440 Merge pull request #6435 from blueyed/type_checking
Use TYPE_CHECKING instead of False
2020-01-16 19:45:00 +01:00
Daniel Hahler
118cb3d3be Fix test_config: wrong assertions, lint, unused fixtures 2020-01-16 19:27:46 +01:00
Bruno Oliveira
b91c721262 ci: github actions: only deploy pytest-dev/pytest (#6474)
ci: github actions: only deploy pytest-dev/pytest
2020-01-16 12:48:29 -03:00
Daniel Hahler
4630e2725e Use TYPE_CHECKING instead of False
This allows for e.g. Jedi to infer types (it checks the name).

It was only used to support Python 3.5.0/3.5.1, where this is is not
available in the `typing` module.

Ref: https://github.com/davidhalter/jedi/issues/1472

Uses `TYPE_CHECKING = False` in `_pytest.outcomes` to avoid having to
work around circular import.
2020-01-16 16:11:39 +01:00
Daniel Hahler
ea31649062 ci: github actions: only deploy pytest-dev/pytest 2020-01-16 13:57:46 +01:00
Bruno Oliveira
3789bb53a7 junit_logging options (follow up to #6469) (#6473)
junit_logging options (follow up to #6469)
2020-01-16 08:13:48 -03:00
Bruno Oliveira
9298f7e4a9 Improve CHANGELOG and docs for junit_logging 2020-01-16 07:47:00 -03:00
Bruno Oliveira
715f56dfbc Fixtures now register finalizers with all fixtures before them… (#6438)
Fixtures now register finalizers with all fixtures before them in the stack
2020-01-16 07:33:55 -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
Bruno Oliveira
1ec5befdb7 Merge pull request #6468 from nicoddemus/deploy-release-notes-6369
Add deploy step: publish package and release notes
2020-01-15 09:05:23 -03:00
Ronny Pfannschmidt
8ba0b7bc2a fix #6341 - disallow session/config in Node.from_parent 2020-01-15 13:00:46 +01:00
Bruno Oliveira
1d3f27cef0 Add deploy step: publish package and release notes
Fix #6369
2020-01-15 08:11:35 -03:00
Daniel Hahler
29703a5f51 Merge pull request #6466 from blueyed/cover-safe_getattr
tests: cover safe_getattr
2020-01-15 11:20:42 +01:00
Daniel Hahler
6f7a95c32e tests: cover safe_getattr 2020-01-15 11:20:00 +01:00
Daniel Hahler
bebfd28da3 doc: revisit section about rootdir
Ref: https://github.com/pytest-dev/pytest/issues/6376
2020-01-15 09:43:35 +01:00
Daniel Hahler
f5844449a8 Merge pull request #6442 from blueyed/rP
terminal: summary_passes: handle teardown sections
2020-01-15 03:02:09 +01:00
Bruno Oliveira
f2659f77be Merge master into features (#6458)
Merge master into features
2020-01-14 20:06:51 -03:00
Bruno Oliveira
b9c136b809 Use a dummy RemoteTraceback for test in Python 3.5 Windows
Somehow in Python 3.5 on Windows this test fails with:
   File "c:\hostedtoolcache\windows\python\3.5.4\x64\Lib\multiprocessing\connection.py", line 302, in _recv_bytes
     overlapped=True)
OSError: [WinError 6] The handle is invalid

This only happens in this platform and Python version, decided to use
a dummy traceback as originally done in #6412.
2020-01-14 18:31:21 -03: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
4a265ba38b Merge pull request #6446 from blueyed/tox-mypy
tox: add mypy toxenv
2020-01-14 18:26:35 +01:00
Daniel Hahler
910d5df6a8 Merge pull request #6456 from blueyed/fix-doc-_splitnode
minor: fix doc/example for _pytest.nodes._splitnode
2020-01-14 15:22:01 +01:00
Bruno Oliveira
21d189eb52 Enable GitHub actions for 'features' 2020-01-14 09:18:34 -03:00
Bruno Oliveira
e9d9f71374 Merge remote-tracking branch 'upstream/master' into mm 2020-01-14 09:17:52 -03:00
Bruno Oliveira
00adb4e42f Implement code coverage in GitHub actions (#6441)
Implement code coverage in GitHub actions
2020-01-14 09:14:57 -03:00
Daniel Hahler
b2cb87fae6 Merge pull request #6440 from blueyed/py351
ci: Travis: Python 3.5.1 via Trusty
2020-01-14 12:41:16 +01:00
Daniel Hahler
189fe3ba1d minor: fix doc/example for _pytest.nodes._splitnode 2020-01-14 12:40:36 +01:00
Bruno Oliveira
d291905825 Append token to codecov.yml instead of duplicating the file 2020-01-14 07:47:21 -03:00
Daniel Hahler
f0c7f21312 Remove "pragma: no cover" comments 2020-01-14 09:15:36 +01:00
Daniel Hahler
4ff7453b48 ci: Travis: Python 3.5.1 via Trusty
Python 3.5.0 caused flaky failures before
(https://github.com/pytest-dev/pytest/issues/5795).

This is pulled out of https://github.com/pytest-dev/pytest/pull/6435,
which adds code specific for Python < 3.5.2.

It only runs a specific test, while collecting everything to get
coverage of the version specific code around typing.
2020-01-14 09:15:36 +01:00
Daniel Hahler
0e70acab79 tox: add mypy toxenv
This is different from what pre-commit (in "linting") runs in that it
uses stubs from (test) dependencies.

It would make sense to run this on CI additionally (since there is no
"pre-commit --skip mypy", and a separate config is not worth it).
But currently it triggers a false positive though anyway
(https://github.com/erikrose/more-itertools/pull/374).
2020-01-14 08:59:48 +01:00
Daniel Hahler
8eec42f040 Merge pull request #6455 from blueyed/mypy-master
master: update mypy 0.740 -> 0.761
2020-01-14 08:56:51 +01:00
Daniel Hahler
3adaa3d87b Merge pull request #6447 from blueyed/fix-determine_setup
typing: fix _pytest.config.findpaths.determine_setup
2020-01-14 08:56:28 +01:00
Ran Benita
090e260517 master: update mypy 0.740 -> 0.761
(cherry picked from commit 16ff9f591e)
(cherry picked from commit 4848bbdf9a)
2020-01-14 06:31:41 +01:00
Daniel Hahler
117072d64c typing: fix _pytest.config.findpaths.determine_setup 2020-01-13 11:45:20 +01:00
Daniel Hahler
90740007a8 Merge pull request #6445 from blueyed/tox-pre-commit-posargs
tox: linting: pass posargs
2020-01-12 21:17:14 +01:00
Daniel Hahler
5e1c6ce630 tox: linting: pass posargs 2020-01-12 20:09:51 +01:00
Daniel Hahler
a136111dcc tests: test_xfail_handling: use sys.dont_write_bytecode 2020-01-11 23:05:12 +01: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
Bruno Oliveira
a3bc6df950 Implement code coverage in GitHub actions
This overwrites the `codecov.yml` file in the root of the repository with
`codecov-upstream.yml` file (which contains the code-cov token)´, so PRs
and branches on the repository can upload coverage.

Suggestion from here:

https://github.com/pytest-dev/pytest/pull/6421#issuecomment-571934112

Security concerns: the token might be misused, but only to upload bogus coverage
to `codecov.io`, so the team believe this is harmless. If we decide to fallback
from this decision , we just need to revoke the token.

Related to #6369
2020-01-11 12:21:20 -03:00
Daniel Hahler
2d488f7615 Merge pull request #6432 from blueyed/merge-master-into-features
Merge master into features
2020-01-10 14:44:30 +01:00
Daniel Hahler
1356d20e90 Merge master into features 2020-01-10 05:20:41 +01:00
Bruno Oliveira
622995a501 Fix grammar in README (#6427)
Fix grammar in README
2020-01-09 20:22:05 -03:00
Daniel Hahler
1e28cb855d Merge pull request #6425 from blueyed/xfail-yellow
terminal: use "yellow" with any "xpassed" tests
2020-01-09 23:22:58 +01:00
Ryan Barner
36531599a4 Fix grammar in README
Corrects grammar error in "Support pytest" section.
2020-01-09 14:12:57 -08:00
Bruno Oliveira
29db2da9a7 tmpdir_factory.mktemp now fails given absolute and non-normaliz… (#6323)
tmpdir_factory.mktemp now fails given absolute and non-normalized paths.
2020-01-09 19:10:03 -03:00
Bruno Oliveira
24f8002de8 Fix wrong 'changelog' and 'reference' links in docs (#6424)
Fix wrong 'changelog' and 'reference' links in docs
2020-01-09 19:09:35 -03:00
Bruno Oliveira
5b295ec68e Merge remote-tracking branch 'upstream/features' into gftea/features 2020-01-09 18:41:47 -03:00
Bruno Oliveira
fa645a7003 Improve docstrings for mktemp 2020-01-09 18:20:46 -03:00
Daniel Hahler
13baab746d terminal: use "yellow" with any "xpassed" tests
Closes https://github.com/pytest-dev/pytest/issues/449.
2020-01-09 22:20:41 +01:00
Daniel Hahler
9f1ade9acf Merge pull request #6411 from blueyed/cacheprovider-copy-items
cacheprovider: pytest_collection_modifyitems: copy items
2020-01-09 22:07:20 +01:00
Bruno Oliveira
23475b6ab9 Fix wrong 'changelog' and 'reference' links in docs
Both references were referencing links from Python because of our intersphinx
mapping in `conf.py`:

    intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

Because Python's docs explicitly define both references, Sphinx fallbacks to
them instead of generating implicit references as was expected.

Fix #6397
2020-01-09 18:06:15 -03:00
Daniel Hahler
2d2c67d7c0 cacheprovider: pytest_collection_modifyitems: copy items 2020-01-09 21:48:54 +01:00
Anthony Sottile
cff7843f3b Merge pull request #6412 from nicoddemus/remote-tb-5971
Fix serialization of 'None' reprcrashes
2020-01-07 11:08:28 -05:00
Bruno Oliveira
356d865ad7 Use concurrent.futures for fidelity to the original report
As requested in review
2020-01-07 12:45:18 -03:00
Bruno Oliveira
f46ad8d114 Unifying black version in pre-commit config file (#6413)
Unifying black version in pre-commit config file
2020-01-07 09:07:47 -03:00
Marcelo Duarte Trevisani
8dbf6a4b2d Unifying black version 2020-01-07 11:07:05 +00:00
Bruno Oliveira
0e00069340 Fix serialization of 'None' reprcrashes
Tracebacks coming from remote processes crated by the multiprocess module
will contain "RemoteTracebacks" which don't have a 'reprcrash' attribute

Fix #5971
2020-01-06 22:04:38 -03:00
Bruno Oliveira
e8c8559efa Remove usage of parser module (deprecated in Python 3.9) (#6407)
Remove usage of parser module (deprecated in Python 3.9)
2020-01-06 13:07:56 -03:00
Bruno Oliveira
91a96ec3d6 Remove usage of parser module, deprecated in Python 3.9
Fix #6404
2020-01-06 08:57:07 -03:00
Bruno Oliveira
12f74a28fa Revert "Remove unused _pytest.code.Source.isparseable function"
This reverts commit c627ac4e59.
2020-01-05 14:12:40 -03:00
Bruno Oliveira
0fa35960ba Remove unused _pytest.code.Source.isparseable function (#6405)
Remove unused _pytest.code.Source.isparseable function
2020-01-05 12:52:23 -03:00
Bruno Oliveira
c627ac4e59 Remove unused _pytest.code.Source.isparseable function
Besides unused, it uses the (deprecated in Python 3.9) parser module

Fix #6404
2020-01-05 12:33:12 -03:00
Anthony Sottile
26a2e1aba7 Merge pull request #6401 from nicoddemus/4.6-maintenance-docs-onward
Update py27/py34 deprecation docs
2020-01-04 16:24:56 -05:00
Bruno Oliveira
7c80335c6b Merge pull request #6391 from asottile/release-4.6.9 (#6403)
Merge pull request #6391 from asottile/release-4.6.9
2020-01-04 18:13:56 -03:00
Anthony Sottile
75f964c08d Merge pull request #6391 from asottile/release-4.6.9
Preparing release version 4.6.9
2020-01-04 13:01:46 -08:00
Bruno Oliveira
4fa819e535 Update py27/py34 deprecation docs
I've updated the text and incorporated the topics from #5275, so this
can now be part of the official docs, and #5275 can be closed/unpinned.

Closes #5275
2020-01-04 17:52:02 -03:00
Bruno Oliveira
61061d2147 Update copyright year to 2020 (#6400)
Update copyright year to 2020
2020-01-04 09:41:53 -03:00
Bruno Oliveira
deb4287d1c Update copyright year to 2020
Merge pull request #6392 from hugovk/4.6-maintenance-2020
2020-01-04 08:46:58 -03:00
Daniel Hahler
7aac48c418 Merge pull request #6382 from blueyed/fix-parseoutcomes
Fix `RunResult.parseoutcomes` (follow-up to #6353)
2020-01-04 00:49:24 +01:00
Ran Benita
0375c1b728 Merge pull request #6388 from bluetech/mypy-761
Update mypy 0.750 -> 0.761
2020-01-01 16:07:55 +02:00
Ran Benita
4848bbdf9a Update mypy 0.750 -> 0.761
This fixes some type: ignores due to typeshed update.

Newer mypy seem to ignore unannotated functions better, so add a few
minor annotations so that existing correct type:ignores make sense.
2020-01-01 15:22:16 +02:00
Daniel Hahler
8656c1a61d Merge pull request #6381 from blueyed/fix-revert-formatting
Revert black formatting of essential_plugins
2020-01-01 14:16:35 +01:00
Daniel Hahler
3b60e36dbb Merge pull request #6380 from blueyed/doc
minor: split doc with _early_rewrite_bailout
2020-01-01 14:16:22 +01:00
Anthony Sottile
162d737f68 Merge pull request #6385 from betchern0t/master
Added how to reserve an issue to yourself when contributing
2019-12-31 11:53:50 -05:00
PaulC
d884164160 removed trailing whitespace to fix linting issue 2019-12-31 12:49:37 +11:00
PaulC
9811ebdc57 Added how to reserve an issue to yourself when contributing 2019-12-31 10:32:31 +11:00
Daniel Hahler
1c0242dec1 Fix RunResult.parseoutcomes (follow-up to #6353) 2019-12-30 17:08:52 +01:00
Daniel Hahler
a5224f7490 Revert black formatting of essential_plugins
Done in a02310a140 (likely automatic), but loses information of the
comment obviously.
2019-12-30 15:28:37 +01:00
Daniel Hahler
a5863ca760 minor: split doc with _early_rewrite_bailout 2019-12-30 09:41:36 +01:00
Bruno Oliveira
8077168387 pytester: quick fix error introduced in #5990 (#6353)
pytester: quick fix error introduced in #5990
2019-12-27 13:28:11 -03:00
Bruno Oliveira
afa899d5e1 Azure Pipelines: Test on Python 3.8 (#6159)
Azure Pipelines: Test on Python 3.8
2019-12-27 13:27:17 -03:00
Hugo
8de9b1be56 Test on Python 3.8 2019-12-27 13:10:43 -03:00
Bruno Oliveira
b532d15fe7 Improve warnings docs (#6366)
Improve warnings docs
2019-12-26 19:52:15 -03:00
Adam Johnson
73702ca88b Improve warnings docs
* Rearrange section about context manager to be in order
* Link to `pytest.warns` and `recwarn` since a reader going top to bottom won't have seen about those yet.
* Used only context manager form in the example; the call form is somewhat obsolete
  and is mentioned in the reference docs already.
* Reuse the 'myfunction' from first example on the second one

Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
2019-12-26 19:16:19 -03:00
Anthony Sottile
d7b0389d1a Merge pull request #6347 from noviluni/delete_deprecated_function
delete inspect.getargspect() as is deprecated since Python 3.0
2019-12-26 13:45:46 -05:00
Bruno Oliveira
06206bcf37 Merge pull request #6355 from nicoddemus/add-gh-actions
Add GitHub actions for CI
2019-12-26 13:32:17 -03:00
Bruno Oliveira
466bbbf8e8 invocation in last section 'pythonpath.rst' title swapped (#6357)
invocation in last section 'pythonpath.rst' title swapped
2019-12-26 08:55:55 -03:00
Bruno Oliveira
a9608d54e0 Switch the order of the commands back and update the text
As suggested during review
2019-12-26 08:19:11 -03:00
Bruno Oliveira
9924432a2e Improve docs so regen doesn't leak temp directories (#6364)
Improve docs so regen doesn't leak temp directories
2019-12-21 13:23:08 -03:00
Bruno Oliveira
c7ac3379e7 Update release notes script after CHANGELOG changed location (#6362)
Update release notes script after CHANGELOG changed location
2019-12-21 13:22:42 -03:00
Anthony Sottile
6cd61390c2 Improve docs so regen doesn't leak temp directories 2019-12-20 13:18:49 -08:00
Bruno Oliveira
994909270f Update release notes script after CHANGELOG changed location 2019-12-20 08:54:44 -03:00
Bruno Oliveira
e1df9dbf0d Merge pull request #6360 from asottile/release-4.6.8 (#6361)
Merge pull request #6360 from asottile/release-4.6.8
2019-12-19 22:46:55 -03:00
Anthony Sottile
ab44d3d733 Merge pull request #6360 from asottile/release-4.6.8
Preparing release version 4.6.8
2019-12-19 16:01:04 -08:00
Bruno Oliveira
d76aa8b428 Add GitHub actions for CI
This includes our current full matrix (windows, linux and macos), for evaluting
purposes.

We should disconsider failures when evaluating PRs.

TODO:

- deploy
- coverage
- github release notes

Even with the above missing, I still believe it would be nice to merge
this and have GitHub actions working in parallel so we can evaluate performance
and usability from now on.
2019-12-19 11:06:57 -03:00
Bruno Oliveira
4dfd2947bc fix typos in docs (#6356)
fix typos in docs
2019-12-19 09:31:08 -03:00
captainCapitalism
ed57b8e08a invocation in last section 'pythonpath.rst' title swapped
The order of invocations 'python -m pytest' and 'pytest' are different in the header and the explanation. Me being lazy reading about the behaviour of 'former' looked up quickly the title and rushed to implementation to discover it actually works the other way - as stated in the documentation. So I propose to switch the order in the title to achieve consistent ordering and not confusing somebody like me again! :)
2019-12-19 11:35:52 +01:00
marc
536177bb56 fix typos in docs 2019-12-19 10:35:15 +01:00
Alexandre Mulatinho
dc7bf518b3 pytester: quick fix error introduced in #5990
- added a test to check this condition

Signed-off-by: Alexandre Mulatinho <alex@mulatinho.net>
2019-12-18 16:36:24 -03:00
Bruno Oliveira
75493f78bf Merge master into features (#6346)
Merge master into features
2019-12-16 21:57:26 -03:00
Bruno Oliveira
c487cf9dd5 Deprecate no print logs (#6333)
Deprecate no print logs
2019-12-16 19:01:16 -03:00
Bruno Oliveira
8be9684ab2 Optimized renaming of test parameter ids (#6350)
Optimized renaming of test parameter ids
2019-12-16 18:54:35 -03:00
Seth Junot
d4879c7afb Optimized renaming of test parameter ids
While using pytest-repeat, I noticed the previous implementation is slow
for a large number of duplicate test ids. To optimize, this commit
reduces the amount of data copied and avoids using `in` with List
(unhashable type, and therefore is very slow for many elements).
2019-12-16 18:53:48 -03:00
Vinay Calastry
afbaee7649 Deprecate --no-print-logs option 2019-12-14 16:46:30 -08:00
marc
d42f5a41a5 delete inspect.getargspect() as is deprecated since Python 3.0 2019-12-14 19:52:17 +01:00
Bruno Oliveira
853889e5db Merge remote-tracking branch 'upstream/master' into mm 2019-12-14 10:45:44 -03:00
Bruno Oliveira
a176ff77bc Release 5.3.2 (#6342)
Release 5.3.2
2019-12-14 10:39:19 -03:00
Bruno Oliveira
7f24cc2feb Remove duplicated user from announcement 2019-12-14 10:06:59 -03:00
Bruno Oliveira
d0c663a628 Improve warning about incoming change to 'junitxml_family' defa… (#6343)
Improve warning about incoming change to 'junitxml_family' default
2019-12-13 12:57:21 -03:00
Bruno Oliveira
f7409f8685 Improve warning about incoming change to 'junitxml_family' default
Fix #6265
2019-12-13 09:17:12 -03:00
Bruno Oliveira
10fcac7f90 Preparing release version 5.3.2 2019-12-13 08:51:15 -03:00
Bruno Oliveira
8942a05cfe Change 4639 from feature to improvement
An improvement seems more adequate here.
2019-12-13 08:46:47 -03:00
Bruno Oliveira
ecd1e43afb Make 'S' and 'F' aliases to 's' and 'f' respectively (#6337)
Make 'S' and 'F' aliases to 's' and 'f' respectively
2019-12-13 07:47:48 -03:00
Bruno Oliveira
66c1a120ba Bugfix 5430 pass logs to junit report (#6274)
Bugfix 5430 pass logs to junit report
2019-12-12 09:35:25 -03:00
gftea
226f0c48bf fix #5686, mktemp now fails given absolute and non-normalized paths. 2019-12-12 13:00:23 +01:00
Bruno Oliveira
9b74bf1e0c Add CHANGELOG entry for #6334 2019-12-12 08:05:22 -03:00
Bruno Oliveira
fa51a26743 Make -r letters "s" and "S" aliases
Similar reasons as the previous commit
2019-12-12 07:48:07 -03:00
Bruno Oliveira
59067ad33d Make -r letters "f" and "F" aliases
As far as the output is concerned, they are both identical so it doesn't
make sense to have both.

setup, teardown, and collect failures are already reported as "errors", "E".
2019-12-12 07:43:37 -03:00
Bruno Oliveira
cbb2f9541b Merge pull request #6316 from cb109/make-keyword-expression-matching-case-insensitive
Make keyword expression matching case-insensitive
2019-12-12 06:47:59 -03:00
Anthony Sottile
b29ae03cb6 Merge pull request #6329 from nicoddemus/4639-improv
Change 4639 from feature to improvement
2019-12-11 13:13:31 -08:00
Bruno Oliveira
0711060422 Change 4639 from feature to improvement
An improvement seems more adequate here.
2019-12-09 15:57:19 -03:00
Bruno Oliveira
1ef29ab548 #4597: tee-stdio capture method (#6315)
#4597: tee-stdio capture method
2019-12-09 15:55:17 -03:00
cmachalo
e13ad22364 Include new --capture-mode=tee-sys option
Fix #4597
2019-12-09 13:05:23 -03:00
Zac Hatfield-Dodds
8cdf9d43a9 Fixes #6326: Typo in the Security section docs home page. (#6327)
Fixes #6326: Typo in the Security section docs home page.
2019-12-09 17:28:06 +11:00
Michael Rose
2ddc330b62 Fixes #6326: Typo in the Security section docs home page. 2019-12-08 22:26:53 -05:00
Ronny Pfannschmidt
30f2729684 Merge pull request #6298 from RonnyPfannschmidt/deprecation-breakage
Deprecation policy - insert considerations for breaking changes
2019-12-07 19:50:44 +01:00
Ronny Pfannschmidt
3812985ed4 update backward compatibility policy to allow for breakage
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
2019-12-07 18:59:21 +01:00
Bruno Oliveira
c6ed69a666 Replace 'removal' by 'breaking' changelog category
As discussed, sometimes we will need to introduce changes
which are not necessarily removals but might break existing
suites
2019-12-06 08:50:35 -03:00
Christoph Bülter
3a0f436c1a Iterate a generator expression instead of a temporary list
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2019-12-06 08:40:49 +01:00
Bruno Oliveira
1c0ab3c2a3 Add 4.6.7 changelog to master (Wait until #6318) (#6319)
Add 4.6.7 changelog to master (Wait until #6318)
2019-12-05 22:45:12 -03:00
Anthony Sottile
7ff91d8127 Merge pull request #6313 from nicoddemus/egg-rewrite-6301
Fix assertion rewriting module detection for egg dists
2019-12-05 16:24:13 -08:00
Bruno Oliveira
64c71daa21 Add 4.6.7 changelog to master 2019-12-05 17:32:45 -03:00
Christoph Buelter
a326fa22c6 Add a failing test to ensure not everything matches by accident 2019-12-05 17:02:48 +01:00
Christoph Bülter
623b3982b0 Update doc/en/example/markers.rst
Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2019-12-05 16:59:08 +01:00
Christoph Buelter
5a7de2c2cb Add changelog file for PR 6316 2019-12-05 14:28:21 +01:00
Christoph Buelter
24d4882d82 Update authors file and sort the list 2019-12-05 14:20:07 +01:00
Christoph Buelter
ac5929eef3 Update docs about case-insensitive expression matching 2019-12-05 14:13:22 +01:00
Christoph Buelter
e24b6b0388 Change -k EXPRESSION matching to be case-insensitive 2019-12-05 14:03:10 +01:00
Bruno Oliveira
c7f9fda42d Fix assertion rewriting module detection for egg dists
Fix #6301
2019-12-04 15:30:45 -03:00
Bruno Oliveira
985ac09048 Merge master into features (#6312)
Merge master into features
2019-12-03 13:36:58 -03:00
Bruno Oliveira
1c4a672a52 unittest: do not use TestCase.debug() with --pdb (#5996)
unittest: do not use TestCase.debug() with `--pdb`
2019-12-03 11:15:06 -03:00
Bruno Oliveira
59f95b7f59 Merge remote-tracking branch 'upstream/master' into mm 2019-12-03 11:07:34 -03:00
Bruno Oliveira
41b7b109e9 Merge branch 'features' into unittest-debug 2019-12-03 10:52:53 -03:00
Ran Benita
42fb1f7ede Merge pull request #6309 from jaredvasquez/fix-cafd-docs
Fix typo in documentation of capfd fixture
2019-12-03 12:15:40 +02:00
Ran Benita
c9ec724886 Merge pull request #6307 from bluetech/mypy-750
Update mypy 0.740 -> 0.750
2019-12-03 12:14:19 +02:00
Jared Vasquez
c00a43a17d fix typo 2019-12-02 22:29:22 -08:00
Bruno Oliveira
1dc612f7d4 Merge pull request #6304 from nicoddemus/pytest-as-pkg
Convert pytest.py into a package
2019-12-02 21:10:15 -03:00
Bruno Oliveira
e5bd7fb053 Convert pytest.py into a package
As discussed in https://github.com/pytest-dev/pytest/issues/3342, this
is the first step to make pytest support static typing fully
2019-12-02 19:27:11 -03:00
Bruno Oliveira
256a9e0027 Remove outdated py2py3 example (#6306)
Remove outdated py2py3 example
2019-12-02 16:54:12 -03:00
Ran Benita
16ff9f591e Update mypy 0.740 -> 0.750
Release notes:
https://mypy-lang.blogspot.com/2019/11/mypy-0.html
2019-12-02 21:52:11 +02:00
Ran Benita
d2d7b97a70 Remove outdated py2py3 example 2019-12-02 21:16:15 +02:00
Bruno Oliveira
23f6adc760 Ensure cache supporting files still exist after --cache-clear (#6296)
Ensure cache supporting files still exist after --cache-clear
2019-12-01 10:37:22 -03:00
Bruno Oliveira
172b82875a Ensure cache supporting files still exist after --cache-clear
Fix #6290
2019-12-01 10:36:47 -03:00
Bruno Oliveira
277857b026 docs: move changelog to docs/en and allow sphinx directives (#6287)
docs: move changelog to docs/en and allow sphinx directives
2019-11-29 10:51:01 -03:00
Daniel Hahler
d3ab56f531 docs: move changelog to docs/en and allow sphinx directives
Now `tox -e docs` will also include the draft changelog for the
next version (locally only).

`CHANGELOG.rst` now only points to the changelog on READTHEDOCS so
sphinx diretives can be used.

Followup to https://github.com/pytest-dev/pytest/pull/6272
2019-11-28 21:23:58 -03:00
Bruno Oliveira
da091b832d rename test_pdb to test_debugging (#6282)
rename test_pdb to test_debugging
2019-11-27 09:08:02 -03:00
Ronny Pfannschmidt
8feeb09398 fixes #5065 2019-11-27 11:25:23 +01:00
Anthony Sottile
209d99102d Merge pull request #6234 from asottile/remove_none_warning
Revert "A warning is now issued when assertions are made for `None`"
2019-11-26 13:04:42 -08:00
Ronny Pfannschmidt
6d31684da5 Merge pull request #6279 from nicoddemus/fix-changelog
Remove duplicated changelog entry for 5.3.1
2019-11-26 19:22:07 +01:00
Bruno Oliveira
4ee280ae1f Remove duplicated changelog entry for 5.3.1 2019-11-26 12:01:12 -03:00
Bruno Oliveira
8b8cba369c Preparing release version 5.3.1 (#6277)
Preparing release version 5.3.1
2019-11-26 11:56:56 -03:00
Daniel Hahler
b6b0bc03f3 Merge pull request #6164 from blueyed/pytester-no-color
pytester: use no colors with inline runs by default
2019-11-26 03:30:45 +01:00
Daniel Hahler
a1219ab8fc pytester: use no colors with inline runs by default
Sets `PY_COLORS=0` in the environment by default, which is used by pylib.

Via https://github.com/blueyed/pytest/pull/58

(initially cherry picked from commit f153ad33d10)
2019-11-25 23:48:11 +01:00
Bruno Oliveira
05008f6b55 Preparing release version 5.3.1 2019-11-25 14:32:37 -03:00
Claudio Madotto
83182b82ea Merge branch 'bugfix-5430-pass-logs-to-junit-report' of https://github.com/zupermanzupereroe/pytest into bugfix-5430-pass-logs-to-junit-report 2019-11-25 13:00:04 +01:00
Claudio Madotto
31d5cedc6d Avoid duplicating system-out and system-error tags 2019-11-25 12:59:03 +01:00
Claudio Madotto
91b3ff1bb7 Create changelog file and update AUTHORS 2019-11-25 12:59:03 +01:00
Claudio Madotto
b66dc80008 Fix for issue #5430 - junit-xml: logs are not passed to junit report for tests failed not in a teardown phase 2019-11-25 12:59:03 +01:00
zupermanzupereroe
69ad2026f6 Merge pull request #1 from pytest-dev/master
Update repository
2019-11-25 12:56:54 +01:00
Anthony Sottile
9d900930db Merge pull request #6242 from nicoddemus/testdir-changelog
Add link to testdir fixture in CHANGELOG entry
2019-11-24 17:23:02 -08:00
Daniel Hahler
47ae1fb36b Merge pull request #6271 from blueyed/typing
typing: minor improvements
2019-11-25 01:49:34 +01:00
Daniel Hahler
a8230d77f4 Merge pull request #6270 from blueyed/docs-log_cli
docs: add missing `log_cli` confval
2019-11-24 23:21:49 +01:00
Daniel Hahler
b7d908f4a5 Merge pull request #6269 from blueyed/docs
tox: docs: --keep-going and posargs
2019-11-24 23:21:26 +01:00
Daniel Hahler
bc7282576f typing: minor improvements 2019-11-24 23:20:03 +01:00
Daniel Hahler
b9dd0e6210 docs: add missing log_cli confval 2019-11-24 22:34:15 +01:00
Daniel Hahler
57f3dc19b9 tox: docs: --keep-going and posargs
`--keep-going` makes sense with `-W` to see all warnings/errors.

`{posargs:}` is useful for passing in custom args.
2019-11-24 22:21:08 +01:00
Daniel Hahler
d7d5cf4136 Merge pull request #6215 from blueyed/cleanup-exc
_idval: remove trailing newline from exception
2019-11-24 20:29:46 +01:00
Florian Bruhin
ed67312bca Merge pull request #6268 from felixonmars/patch-2
Correct a typo in _pytest/config/__init__.py
2019-11-24 17:04:26 +01:00
Claudio Madotto
2d24c062b6 Avoid duplicating system-out and system-error tags 2019-11-24 16:33:17 +01:00
Claudio Madotto
d940d0b657 Create changelog file and update AUTHORS 2019-11-24 16:08:45 +01:00
Claudio Madotto
f9f092a5e6 Fix for issue #5430 - junit-xml: logs are not passed to junit report for tests failed not in a teardown phase 2019-11-24 15:20:02 +01:00
Felix Yan
b7bc52f770 Correct a typo in _pytest/config/__init__.py 2019-11-24 20:28:10 +08:00
Bruno Oliveira
a3c8246b60 Node from parent (#5975)
Node from parent
2019-11-23 20:34:48 -03:00
Ronny Pfannschmidt
15ffe63204 update doc examples **untested** 2019-11-23 21:54:11 +01:00
Ronny Pfannschmidt
c99c7d0f95 deprecate direct node construction and introduce Node.from_parent 2019-11-23 21:54:11 +01:00
Bruno Oliveira
886b8d27c6 Merge pull request #5984 from phloose/acceptance-tests_pytest-dev/pytest/#4445
Add acceptance tests for "config warnings" stacklevel (#4445)
2019-11-22 19:45:41 -03:00
Daniel Hahler
d1eb89d694 Merge pull request #6086 from kondratyev-nv/master
Fix line detection for properties in doctest tests
2019-11-22 23:09:10 +01:00
Daniel Hahler
a4408eb9c1 Merge pull request #6219 from blueyed/testdir-use-monkeypatch
pytester: remove special handling of env during inner runs
2019-11-22 22:41:48 +01:00
Daniel Hahler
b0ebcfb785 pytester: remove special handling of env during inner runs
Closes https://github.com/pytest-dev/pytest/issues/6213.
2019-11-22 21:50:31 +01:00
Nikolay Kondratyev
5e097970df Fix line detection for properties in doctest tests
Co-Authored-By: Daniel Hahler <github@thequod.de>
2019-11-22 23:50:20 +03:00
Philipp Loose
a02310a140 Add stacklevel tests for warnings, 'location' to pytest_warning_captured
Resolves #4445 and #5928 (thanks to allanlewis)

Add CHANGELOG for location parameter
2019-11-22 17:50:00 -03:00
Daniel Hahler
0601f5cdad Merge pull request #6261 from blueyed/stats-keys
terminal: _get_main_color: help pytest-parallel
2019-11-22 17:12:33 +01:00
Daniel Hahler
a7268aaa5d Merge pull request #6258 from blueyed/notify_exception-handle-exit-exc-upstream
main: wrap_session: handle exit.Exception with notify_exception
2019-11-22 05:49:04 +01:00
Daniel Hahler
1f736a663d terminal: _get_main_color: help pytest-parallel
Use `dict.keys()` to work around `__iter__` not working with a
multiprocessing DictProxy.

Ref: https://github.com/python/cpython/pull/17333
Fixes https://github.com/pytest-dev/pytest/issues/6254.
Ref: https://github.com/browsertron/pytest-parallel/issues/36
2019-11-22 05:48:10 +01:00
Daniel Hahler
2344982d7f main: wrap_session: handle exit.Exception with notify_exception
Fixes https://github.com/pytest-dev/pytest/issues/6257.
Via https://github.com/blueyed/pytest/pull/132.
2019-11-21 22:50:33 +01:00
Daniel Hahler
2fa0518e89 Merge pull request #6259 from blueyed/merge-master-into-features
Merge master into features
2019-11-21 22:48:53 +01:00
Daniel Hahler
df0c652333 Merge master into features 2019-11-21 20:31:52 +01:00
Daniel Hahler
63c9ad02f4 Merge pull request #6252 from blueyed/minor-changelog
CHANGELOG: two minor fixes/improvements
2019-11-21 18:44:41 +01:00
Daniel Hahler
8b7aeefd7d Merge pull request #6248 from blueyed/default-role
docs: configure default_role=literal
2019-11-21 18:44:17 +01:00
Bruno Oliveira
f1ac0eeef0 Remove sys.last_traceback attribute using del instead of settin… (#6256)
Remove sys.last_traceback attribute using del instead of setting to None
2019-11-21 11:16:19 -03:00
Mark Dickinson
82424c9270 Fix reST markup. 2019-11-21 13:37:17 +00:00
Mark Dickinson
dbb8c146f0 Use proper reST attribute markup. 2019-11-21 13:22:34 +00:00
Mark Dickinson
8d686a8e46 Add self to AUTHORS 2019-11-21 13:14:19 +00:00
Mark Dickinson
9d1082bd30 Add changelog file. 2019-11-21 13:13:36 +00:00
Bruno Oliveira
490c7c7262 Add develop instructions to CONTRIBUTING (#6249)
Add develop instructions to CONTRIBUTING
2019-11-21 10:07:00 -03:00
Mark Dickinson
2ffbe41ae5 clear sys.last_traceback via del instead of = None 2019-11-21 13:06:47 +00:00
Bruno Oliveira
8f2fd8ffc0 Add develop instructions to CONTRIBUTING
From: https://github.com/pytest-dev/pytest/pull/6244
2019-11-21 10:06:32 -03:00
Mark Dickinson
64eb9ea670 Modify test for new expected behaviour 2019-11-21 11:50:40 +00:00
Ran Benita
5820c5c5a6 Merge pull request #6241 from bluetech/type-annotations-9
Add type annotations to _pytest.config.argparsing and corresponding Config code
2019-11-21 13:33:13 +02:00
Zac Hatfield-Dodds
7e10c8191d Added link checking to tox and release.py (#5614)
Added link checking to tox and release.py
2019-11-21 16:46:13 +11:00
Daniel Hahler
6659fe0edc CHANGELOG: two minor fixes/improvements 2019-11-21 06:20:57 +01:00
Daniel Hahler
4ee984ff0a Merge pull request #6250 from blueyed/tbh
pytester: LineMatcher: __tracebackhide__ with _fail
2019-11-21 04:26:20 +01:00
Daniel Hahler
b96e0a71a6 pytester: LineMatcher: __tracebackhide__ with _fail
Follow-up to 2228ccb (gone lost in resolving the conflict).
2019-11-21 01:23:36 +01:00
Daniel Hahler
ed012c808a Merge pull request #6174 from blueyed/ids-iter
parametrized: ids: support generator/iterator
2019-11-21 00:37:25 +01:00
Daniel Hahler
be722652f0 docs: configure default_role=literal
This configures the default role for interpreted text (single
backticks), avoiding the need to check for / enforce double backticks.

Fixes also one instance in the existing changelog:

    - Detect `pytest_` prefixed hooks using the internal plugin manager since
      ``pluggy`` is deprecating the ``implprefix`` argument to ``PluginManager``.
      (`#3487 <https://github.com/pytest-dev/pytest/issues/3487>`_)
2019-11-21 00:35:00 +01:00
Daniel Hahler
6b75a7733b Merge pull request #6247 from blueyed/collecterror-fulltrace
Respect --fulltrace with collection errors
2019-11-21 00:27:23 +01:00
Daniel Hahler
2d449e95e4 Respect --fulltrace with collection errors 2019-11-20 23:35:33 +01:00
Ran Benita
dac16cd9e5 Add type annotations to _pytest.config.argparsing and corresponding Config code 2019-11-20 22:02:27 +02:00
Daniel Hahler
2c941b5d13 parametrized: ids: support generator/iterator
Fixes https://github.com/pytest-dev/pytest/issues/759

- Adjust test_parametrized_ids_invalid_type, create list to convert tuples
  Ref: https://github.com/pytest-dev/pytest/issues/1857#issuecomment-552922498

- Changelog for int to str conversion
  Ref: https://github.com/pytest-dev/pytest/issues/1857#issuecomment-552932952
2019-11-20 19:02:17 +01:00
Daniel Hahler
98c899c9b0 Merge pull request #6245 from blueyed/tests-_idval
testing/python/metafunc.py: import _idval once
2019-11-20 19:00:39 +01:00
Daniel Hahler
58ec5bea35 Merge pull request #6237 from blueyed/fix-no_fnmatch_line
pytester: reset log output in _match_lines
2019-11-20 18:44:37 +01:00
Daniel Hahler
f1224a0e85 Merge pull request #6243 from blueyed/move-_pformat_dispatch
minor: move internal _pformat_dispatch function
2019-11-20 18:42:21 +01:00
Daniel Hahler
ccb3ef3b33 testing/python/metafunc.py: import _idval once 2019-11-20 18:02:30 +01:00
Daniel Hahler
c0b1a39192 minor: move internal _pformat_dispatch function 2019-11-20 17:57:14 +01:00
Bruno Oliveira
0be03d7fe4 Add link to testdir fixture in CHANGELOG entry
As per https://github.com/pytest-dev/pytest/pull/5914#issuecomment-556063975
2019-11-20 13:14:17 -03:00
Ran Benita
51f9cd0e02 argparsing: remove "map_long_option" Action attribute support
This feature was added in commit
007a77c2ba, but was never used in pytest
itself. A GitHub code search doesn't find any users either (only pytest
repo copies). It seems safe to clean up.
2019-11-20 17:09:24 +02:00
Bruno Oliveira
2879d25812 Fix rendering of Before/After in changelog (#6238)
Fix rendering of Before/After in changelog
2019-11-20 07:32:17 -03:00
Bruno Oliveira
fe69a2cfb7 Delete 5934.feature.rst included in the wrong folder by accident 2019-11-20 07:06:11 -03:00
Bruno Oliveira
af9dfc604d Introduce 5934 in CHANGELOG and fix "pytest" blocks 2019-11-20 07:05:31 -03:00
Anthony Sottile
8c65eae5f4 Fix rendering of Before/After in changelog
Apparently the version of sphinx that rtd uses is a little more strict about whether an anonymous `code-block` can happen
2019-11-19 21:12:30 -08:00
Daniel Hahler
2228ccbfb4 pytester: reset log output in _match_lines (#70)
This is necessary for when using e.g. `no_fnmatch_line` after it.
Factor it out into `_fail`.

(cherry picked from commit aade7ed0045ba32557ef8565cbab28a2c91053a7)

Ref: https://github.com/pytest-dev/pytest/pull/5914#issuecomment-549182242
2019-11-20 05:24:18 +01:00
Bruno Oliveira
7e5ad31428 Merge features into master after 5.3 (#6236)
Merge features into master after 5.3
2019-11-19 19:17:06 -03:00
Bruno Oliveira
688bbefed1 Improve instructions on how to write CHANGELOG entries (#6235)
Improve instructions on how to write CHANGELOG entries
2019-11-19 19:10:41 -03:00
Bruno Oliveira
5b3867fd65 Release 5.3.0 (#6233)
Release 5.3.0
2019-11-19 18:49:14 -03:00
Bruno Oliveira
36ef545b2d Improve instructions on how to write CHANGELOG entries
This makes easier for contributors to get the CHANGELOG entry
right the first time.
2019-11-19 14:15:55 -03:00
Daniel Hahler
1d368e0ed4 Merge pull request #6231 from blueyed/param-spell
Improve check for misspelling of parametrize
2019-11-19 17:57:28 +01:00
Anthony Sottile
faea273c93 Revert "A warning is now issued when assertions are made for None" 2019-11-19 08:24:08 -08:00
Daniel Hahler
4ad61cbcf6 Improve check for misspelling of parametrize
- there is no need to do this with `--strict-markers`
- it can be done when looking up marks, instead of for every generated
  test
2019-11-19 16:05:52 +01:00
Daniel Hahler
426a4cdca9 _idval: remove trailing newline from exception 2019-11-18 01:10:00 +01:00
Bruno Oliveira
59369651db Bring back explicit tear down
Otherwise 'normal' failures won't call teardown explicitly
2019-11-12 14:03:40 -03:00
Bruno Oliveira
f7b1de70c0 No need to call tearDown on expected failures
- Isolate logic for getting expected exceptions
- Use original method name, as users see it when entering the debugger
2019-11-12 12:50:55 -03:00
Daniel Hahler
04f27d4eb4 unittest: do not use TestCase.debug() with --pdb
Fixes https://github.com/pytest-dev/pytest/issues/5991
Fixes https://github.com/pytest-dev/pytest/issues/3823

Ref: https://github.com/pytest-dev/pytest-django/issues/772
Ref: https://github.com/pytest-dev/pytest/pull/1890
Ref: https://github.com/pytest-dev/pytest-django/pull/782

- inject wrapped testMethod

- adjust test_trial_error

- add test for `--trace` with unittests
2019-11-10 00:21:51 +01:00
Steffen Schroeder
ceeb7bd085 Fixed broken links 2019-11-06 20:54:41 +01:00
Steffen Schroeder
1cecdf6619 Added checklinks to tox and release.py 2019-11-06 20:54:41 +01:00
498 changed files with 51284 additions and 30621 deletions

View File

@@ -24,3 +24,7 @@ exclude_lines =
\#\s*pragma: no cover
^\s*raise NotImplementedError\b
^\s*return NotImplemented\b
^\s*assert False(,|$)
^\s*if TYPE_CHECKING:
^\s*@overload( |$)

28
.gitblameignore Normal file
View File

@@ -0,0 +1,28 @@
# List of revisions that can be ignored with git-blame(1).
#
# See `blame.ignoreRevsFile` in git-config(1) to enable it by default, or
# use it with `--ignore-revs-file` manually with git-blame.
#
# To "install" it:
#
# git config --local blame.ignoreRevsFile .gitblameignore
# run black
703e4b11ba76171eccd3f13e723c47b810ded7ef
# switched to src layout
eaa882f3d5340956beb176aa1753e07e3f3f2190
# pre-commit run pyupgrade --all-files
a91fe1feddbded535a4322ab854429e3a3961fb4
# move node base classes from main to nodes
afc607cfd81458d4e4f3b1f3cf8cc931b933907e
# [?] split most fixture related code into own plugin
8c49561470708761f7321504f5e8343811be87ac
# run pyupgrade
9aacb4635e81edd6ecf281d4f6c0cfc8e94ab301
# run blacken-docs
5f95dce95602921a70bfbc7d8de2f7712c5e4505
# ran pyupgrade-docs again
75d0b899bbb56d6849e9d69d83a9426ed3f43f8b
# move argument parser to own file
c9df77cbd6a365dcb73c39618e4842711817e871

View File

@@ -1,10 +1,16 @@
---
name: 🐛 Bug Report
about: Report errors and problems
---
<!--
Thanks for submitting an issue!
Here's a quick checklist for what to provide:
Quick check-list while reporting bugs:
-->
- [ ] a detailed description of the bug or suggestion
- [ ] a detailed description of the bug or problem you are having
- [ ] output of `pip list` from the virtual environment you are using
- [ ] pytest and operating system versions
- [ ] minimal example if possible

View File

@@ -0,0 +1,25 @@
---
name: 🚀 Feature Request
about: Ideas for new features and improvements
---
<!--
Thanks for suggesting a feature!
Quick check-list while suggesting features:
-->
#### What's the problem this feature will solve?
<!-- What are you trying to do, that you are unable to achieve with pytest as it currently stands? -->
#### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
<!-- Provide examples of real-world use cases that this would enable and how it solves the problem described above. -->
#### Alternative Solutions
<!-- Have you tried to workaround the problem using a pytest plugin or other tools? Or a different approach to solving this issue? Please elaborate here. -->
#### Additional context
<!-- Add any other context, links, etc. about the feature here. -->

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: ❓ Support Question
url: https://github.com/pytest-dev/pytest/discussions
about: Use GitHub's new Discussions feature for questions

View File

@@ -3,13 +3,24 @@ Thanks for submitting a PR, your contribution is really appreciated!
Here is a quick checklist that should be present in PRs.
- [ ] Target the `master` branch for bug fixes, documentation updates and trivial changes.
- [ ] Target the `features` branch for new features, improvements, and removals/deprecations.
- [ ] Include documentation when adding new features.
- [ ] Include new tests or update existing tests when applicable.
- [X] Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the commits yourself.
If this change fixes an issue, please:
- [ ] Add text like ``closes #XYZW`` to the PR description and/or commits (where ``XYZW`` is the issue number). See the [github docs](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) for more information.
Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:
- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](https://github.com/pytest-dev/pytest/blob/master/changelog/README.rst) for details.
- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](https://github.com/pytest-dev/pytest/blob/main/changelog/README.rst) for details.
Write sentences in the **past or present tense**, examples:
* *Improved verbose diff output with sequences.*
* *Terminal summary statistics now use multiple colors.*
Also make sure to end the sentence with a `.`.
- [ ] Add yourself to `AUTHORS` in alphabetical order.
-->

11
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/testing/plugins_integration"
schedule:
interval: weekly
time: "03:00"
open-pull-requests-limit: 10
allow:
- dependency-type: direct
- dependency-type: indirect

242
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,242 @@
name: main
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.x"
env:
PYTEST_ADDOPTS: "--color=yes"
# Set permissions at the job level.
permissions: {}
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
name: [
"windows-py36",
"windows-py37",
"windows-py37-pluggy",
"windows-py38",
"windows-py39",
"windows-py310",
"ubuntu-py36",
"ubuntu-py37",
"ubuntu-py37-pluggy",
"ubuntu-py37-freeze",
"ubuntu-py38",
"ubuntu-py39",
"ubuntu-py310",
"ubuntu-pypy3",
"macos-py37",
"macos-py38",
"docs",
"doctesting",
"plugins",
]
include:
- name: "windows-py36"
python: "3.6"
os: windows-latest
tox_env: "py36-xdist"
- name: "windows-py37"
python: "3.7"
os: windows-latest
tox_env: "py37-numpy"
- name: "windows-py37-pluggy"
python: "3.7"
os: windows-latest
tox_env: "py37-pluggymain-xdist"
- name: "windows-py38"
python: "3.8"
os: windows-latest
tox_env: "py38-unittestextras"
use_coverage: true
- name: "windows-py39"
python: "3.9"
os: windows-latest
tox_env: "py39-xdist"
- name: "windows-py310"
python: "3.10-dev"
os: windows-latest
tox_env: "py310-xdist"
- name: "ubuntu-py36"
python: "3.6"
os: ubuntu-latest
tox_env: "py36-xdist"
- name: "ubuntu-py37"
python: "3.7"
os: ubuntu-latest
tox_env: "py37-lsof-numpy-pexpect"
use_coverage: true
- name: "ubuntu-py37-pluggy"
python: "3.7"
os: ubuntu-latest
tox_env: "py37-pluggymain-xdist"
- name: "ubuntu-py37-freeze"
python: "3.7"
os: ubuntu-latest
tox_env: "py37-freeze"
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
tox_env: "py38-xdist"
- name: "ubuntu-py39"
python: "3.9"
os: ubuntu-latest
tox_env: "py39-xdist"
- name: "ubuntu-py310"
python: "3.10-dev"
os: ubuntu-latest
tox_env: "py310-xdist"
- name: "ubuntu-pypy3"
python: "pypy-3.7"
os: ubuntu-latest
tox_env: "pypy3-xdist"
- name: "macos-py37"
python: "3.7"
os: macos-latest
tox_env: "py37-xdist"
- name: "macos-py38"
python: "3.8"
os: macos-latest
tox_env: "py38-xdist"
use_coverage: true
- name: "plugins"
python: "3.7"
os: ubuntu-latest
tox_env: "plugins"
- name: "docs"
python: "3.7"
os: ubuntu-latest
tox_env: "docs"
- name: "doctesting"
python: "3.7"
os: ubuntu-latest
tox_env: "doctesting"
use_coverage: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox coverage
- name: Test without coverage
if: "! matrix.use_coverage"
run: "tox -e ${{ matrix.tox_env }}"
- name: Test with coverage
if: "matrix.use_coverage"
run: "tox -e ${{ matrix.tox_env }}-coverage"
- name: Upload coverage
if: matrix.use_coverage && github.repository == 'pytest-dev/pytest'
env:
CODECOV_NAME: ${{ matrix.name }}
run: bash scripts/upload-coverage.sh -F GHA,${{ runner.os }}
linting:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/setup-python@v2
- name: set PY
run: echo "name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- run: tox -e linting
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
needs: [build]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade wheel setuptools tox
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_token }}
- name: Publish GitHub release notes
env:
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
run: |
sudo apt-get install pandoc
tox -e publish-gh-release-notes

View File

@@ -0,0 +1,53 @@
name: prepare release pr
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to base the release from'
required: true
default: ''
major:
description: 'Major release? (yes/no)'
required: true
default: 'no'
prerelease:
description: 'Prerelease (ex: rc1). Leave empty if not a pre-release.'
required: true
default: ''
# Set permissions at the job level.
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools tox
- name: Prepare release PR (minor/patch release)
if: github.event.inputs.major == 'no'
run: |
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --prerelease '${{ github.event.inputs.prerelease }}'
- name: Prepare release PR (major release)
if: github.event.inputs.major == 'yes'
run: |
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major --prerelease '${{ github.event.inputs.prerelease }}'

View File

@@ -0,0 +1,48 @@
name: Update Plugin List
on:
schedule:
# At 00:00 on Sunday.
# https://crontab.guru
- cron: '0 0 * * 0'
workflow_dispatch:
# Set permissions at the job level.
permissions: {}
jobs:
createPullRequest:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install packaging requests tabulate[widechars]
- name: Update Plugin List
run: python scripts/update-plugin-list.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@2455e1596942c2902952003bbb574afbbe2ab2e6
with:
commit-message: '[automated] Update plugin list'
author: 'pytest bot <pytestbot@users.noreply.github.com>'
branch: update-plugin-list/patch
delete-branch: true
branch-suffix: short-commit-hash
title: '[automated] Update plugin list'
body: '[automated] Update plugin list'

4
.gitignore vendored
View File

@@ -25,12 +25,16 @@ src/_pytest/_version.py
doc/*/_build
doc/*/.doctrees
doc/*/_changelog_towncrier_draft.rst
build/
dist/
*.egg-info
htmlcov/
issue/
env/
.env/
.venv/
/pythonenv*/
3rdparty/
.tox
.cache

View File

@@ -1,17 +1,16 @@
exclude: doc/en/example/py2py3/test_py2.py
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 21.6b0
hooks:
- id: black
args: [--safe, --quiet]
- repo: https://github.com/asottile/blacken-docs
rev: v1.0.0
rev: v1.10.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.3b0]
additional_dependencies: [black==20.8b1]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -19,47 +18,61 @@ repos:
args: [--remove]
- id: check-yaml
- id: debug-statements
exclude: _pytest/debugging.py
exclude: _pytest/(debugging|hookspec).py
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
language_version: python3
additional_dependencies: [flake8-typing-imports==1.3.0]
additional_dependencies:
- flake8-typing-imports==1.9.0
- flake8-docstrings==1.5.0
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.4.0
rev: v2.5.0
hooks:
- id: reorder-python-imports
args: ['--application-directories=.:src', --py3-plus]
args: ['--application-directories=.:src', --py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v1.18.0
rev: v2.19.4
hooks:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.0
args: [--py36-plus]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
hooks:
- id: rst-backticks
- id: setup-cfg-fmt
args: [--max-py-version=3.10]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-use-type-annotations
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.740
rev: v0.902
hooks:
- id: mypy
files: ^(src/|testing/)
args: []
additional_dependencies:
- iniconfig>=1.1.0
- py>=1.8.2
- attrs>=19.2.0
- packaging
- types-toml
- types-pkg_resources
- repo: local
hooks:
- id: rst
name: rst
entry: rst-lint --encoding utf-8
files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|TIDELIFT.rst|changelog/.*)$
files: ^(RELEASING.rst|README.rst|TIDELIFT.rst)$
language: python
additional_dependencies: [pygments, restructuredtext_lint]
- id: changelogs-rst
name: changelog filenames
language: fail
entry: 'changelog files must be named ####.(feature|bugfix|doc|deprecation|removal|vendor|trivial).rst'
exclude: changelog/(\d+\.(feature|improvement|bugfix|doc|deprecation|removal|vendor|trivial).rst|README.rst|_template.rst)
entry: 'changelog files must be named ####.(breaking|bugfix|deprecation|doc|feature|improvement|trivial|vendor).rst'
exclude: changelog/(\d+\.(breaking|bugfix|deprecation|doc|feature|improvement|trivial|vendor).rst|README.rst|_template.rst)
files: ^changelog/
- id: py-deprecated
name: py library is deprecated
@@ -69,9 +82,17 @@ repos:
_code\.|
builtin\.|
code\.|
io\.(BytesIO|saferepr)|
io\.|
path\.local\.sysfind|
process\.|
std\.
std\.|
error\.|
xml\.
)
types: [python]
- id: py-path-deprecated
name: py.path usage is deprecated
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py
language: pygrep
entry: \bpy\.path\.local
types: [python]

12
.readthedocs.yml Normal file
View File

@@ -0,0 +1,12 @@
version: 2
python:
version: 3.7
install:
- requirements: doc/en/requirements.txt
- method: pip
path: .
formats:
- epub
- pdf

View File

@@ -1,134 +0,0 @@
language: python
dist: xenial
stages:
- baseline
- name: test
if: repo = pytest-dev/pytest AND tag IS NOT present
- name: deploy
if: repo = pytest-dev/pytest AND tag IS present
python: '3.7'
cache: false
env:
global:
- PYTEST_ADDOPTS=-vv
# setuptools-scm needs all tags in order to obtain a proper version
git:
depth: false
install:
- python -m pip install --upgrade --pre tox
jobs:
include:
# OSX tests - first (in test stage), since they are the slower ones.
# Coverage for:
# - osx
# - verbose=1
- os: osx
osx_image: xcode10.1
language: generic
env: TOXENV=py37-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS=-v
before_install:
- which python3
- python3 -V
- ln -sfn "$(which python3)" /usr/local/bin/python
- python -V
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37
# Full run of latest supported version, without xdist.
# Coverage for:
# - pytester's LsofFdLeakChecker
# - TestArgComplete (linux only)
# - numpy
# - old attrs
# - verbose=0
# - test_sys_breakpoint_interception (via pexpect).
- env: TOXENV=py37-lsof-numpy-oldattrs-pexpect-twisted PYTEST_COVERAGE=1 PYTEST_ADDOPTS=
python: '3.7'
# Coverage tracking is slow with pypy, skip it.
- env: TOXENV=pypy3-xdist
python: 'pypy3'
- env: TOXENV=py35-xdist
python: '3.5'
# Specialized factors for py37.
- env: TOXENV=py37-pluggymaster-xdist
- env: TOXENV=py37-freeze
- env: TOXENV=py38-xdist
python: '3.8'
- stage: baseline
env: TOXENV=py36-xdist
python: '3.6'
- env: TOXENV=linting,docs,doctesting PYTEST_COVERAGE=1
cache:
directories:
- $HOME/.cache/pre-commit
- stage: deploy
python: '3.6'
install: pip install -U setuptools setuptools_scm tox
script: skip
# token to upload github release notes: GH_RELEASE_NOTES_TOKEN
env:
- secure: "OjOeL7/0JUDkV00SsTs732e8vQjHynpbG9FKTNtZZJ+1Zn4Cib+hAlwmlBnvVukML0X60YpcfjnC4quDOIGLPsh5zeXnvJmYtAIIUNQXjWz8NhcGYrhyzuP1rqV22U68RTCdmOq3lMYU/W2acwHP7T49PwJtOiUM5kF120UAQ0Zi5EmkqkIvH8oM5mO9Dlver+/U7Htpz9rhKrHBXQNCMZI6yj2aUyukqB2PN2fjAlDbCF//+FmvYw9NjT4GeFOSkTCf4ER9yfqs7yglRfwiLtOCZ2qKQhWZNsSJDB89rxIRXWavJUjJKeY2EW2/NkomYJDpqJLIF4JeFRw/HhA47CYPeo6BJqyyNV+0CovL1frpWfi9UQw2cMbgFUkUIUk3F6DD59PHNIOX2R/HX56dQsw7WKl3QuHlCOkICXYg8F7Ta684IoKjeTX03/6QNOkURfDBwfGszY0FpbxrjCSWKom6RyZdyidnESaxv9RzjcIRZVh1rp8KMrwS1OrwRSdG0zjlsPr49hWMenN/8fKgcHTV4/r1Tj6mip0dorSRCrgUNIeRBKgmui6FS8642ab5JNKOxMteVPVR2sFuhjOQ0Jy+PmvceYY9ZMWc3+/B/KVh0dZ3hwvLGZep/vxDS2PwCA5/xw31714vT5LxidKo8yECjBynMU/wUTTS695D3NY="
addons:
apt:
packages:
# required by publish_gh_release_notes
- pandoc
after_deploy: tox -e publish_gh_release_notes
deploy:
provider: pypi
user: nicoddemus
distributions: sdist bdist_wheel
skip_upload_docs: true
password:
secure: xanTgTUu6XDQVqB/0bwJQXoDMnU5tkwZc5koz6mBkkqZhKdNOi2CLoC1XhiSZ+ah24l4V1E0GAqY5kBBcy9d7NVe4WNg4tD095LsHw+CRU6/HCVIFfyk2IZ+FPAlguesCcUiJSXOrlBF+Wj68wEvLoK7EoRFbJeiZ/f91Ww1sbtDlqXABWGHrmhPJL5Wva7o7+wG7JwJowqdZg1pbQExsCc7b53w4v2RBu3D6TJaTAzHiVsW+nUSI67vKI/uf+cR/OixsTfy37wlHgSwihYmrYLFls3V0bSpahCim3bCgMaFZx8S8xrdgJ++PzBCof2HeflFKvW+VCkoYzGEG4NrTWJoNz6ni4red9GdvfjGH3YCjAKS56h9x58zp2E5rpsb/kVq5/45xzV+dq6JRuhQ1nJWjBC6fSKAc/bfwnuFK3EBxNLkvBssLHvsNjj5XG++cB8DdS9wVGUqjpoK4puaXUWFqy4q3S9F86HEsKNgExtieA9qNx+pCIZVs6JCXZNjr0I5eVNzqJIyggNgJG6RyravsU35t9Zd9doL5g4Y7UKmAGTn1Sz24HQ4sMQgXdm2SyD8gEK5je4tlhUvfGtDvMSlstq71kIn9nRpFnqB6MFlbYSEAZmo8dGbCquoUc++6Rum208wcVbrzzVtGlXB/Ow9AbFMYeAGA0+N/K1e59c=
on:
tags: true
repo: pytest-dev/pytest
before_script:
- |
# Do not (re-)upload coverage with cron runs.
if [[ "$TRAVIS_EVENT_TYPE" = cron ]]; then
PYTEST_COVERAGE=0
fi
- |
if [[ "$PYTEST_COVERAGE" = 1 ]]; then
export COVERAGE_FILE="$PWD/.coverage"
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
export _PYTEST_TOX_COVERAGE_RUN="coverage run -m"
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
fi
script: tox
after_success:
- |
if [[ "$PYTEST_COVERAGE" = 1 ]]; then
env CODECOV_NAME="$TOXENV-$TRAVIS_OS_NAME" scripts/report-coverage.sh
fi
notifications:
irc:
channels:
- "chat.freenode.net#pytest"
on_success: change
on_failure: change
skip_join: true
email:
- pytest-commit@python.org
branches:
only:
- master
- features
- 4.6-maintenance
- /^\d+(\.\d+)+$/

68
AUTHORS
View File

@@ -5,6 +5,7 @@ Contributors include::
Aaron Coleman
Abdeali JK
Abdelrahman Elbehery
Abhijeet Kasurde
Adam Johnson
Adam Uhlir
@@ -21,7 +22,9 @@ Anders Hovmöller
Andras Mitzki
Andras Tim
Andrea Cimatoribus
Andreas Motl
Andreas Zeidler
Andrew Shapton
Andrey Paramonov
Andrzej Klajnert
Andrzej Ostrowski
@@ -29,15 +32,18 @@ Andy Freeland
Anthon van der Neut
Anthony Shaw
Anthony Sottile
Anton Grinevich
Anton Lodder
Antony Lee
Arel Cordero
Ariel Pillemer
Armin Rigo
Aron Coyle
Aron Curzon
Aviral Verma
Aviv Palivoda
Barney Gale
Ben Gartner
Ben Webb
Benjamin Peterson
Bernard Pratz
@@ -52,23 +58,30 @@ Carl Friedrich Bolz
Carlos Jenkins
Ceridwen
Charles Cloud
Charles Machalow
Charnjit SiNGH (CCSJ)
Chris Lamb
Chris NeJame
Chris Rose
Christian Boelsen
Christian Fetzer
Christian Neumüller
Christian Theunert
Christian Tismer
Christopher Gilling
Christine Mecklenborg
Christoph Buelter
Christopher Dignam
Christopher Gilling
Claire Cecil
Claudio Madotto
CrazyMerlyn
Cyrus Maden
Damian Skrzypczak
Dhiren Serai
Daniel Grana
Daniel Hahler
Daniel Nuri
Daniel Wandschneider
Daniele Procida
Danielle Jenkins
Daniil Galiev
Dave Hunt
@@ -78,30 +91,39 @@ David Paul Röthlisberger
David Szotten
David Vierra
Daw-Ran Liou
Debi Mishra
Denis Kirisov
Dhiren Serai
Diego Russo
Dmitry Dygalo
Dmitry Pribysh
Dominic Mortlock
Duncan Betts
Edison Gustavo Muenz
Edoardo Batini
Edson Tadeu M. Manoel
Eduardo Schettino
Eli Boyarski
Elizaveta Shashkova
Endre Galaczi
Eric Hunsberger
Eric Siegerman
Erik Aronesty
Erik M. Bray
Evan Kepner
Fabien Zarifian
Fabio Zadrozny
Felix Nieuwenhuizen
Feng Ma
Florian Bruhin
Florian Dahlitz
Floris Bruynooghe
Gabriel Reis
Garvit Shubham
Gene Wood
George Kussumoto
Georgy Dyuldin
Gleb Nikonorov
Graham Horler
Greg Price
Gregory Lee
@@ -111,6 +133,7 @@ Guido Wesdorp
Guoqiang Zhang
Harald Armin Massa
Henk-Jaap Wagenaar
Holger Kohr
Hugo van Kemenade
Hui Wang (coldnight)
Ian Bicking
@@ -119,6 +142,9 @@ Ilya Konstantinov
Ionuț Turturică
Iwan Briquemont
Jaap Broekhuizen
Jakob van Santen
Jakub Mitoraj
James Bourbeau
Jan Balster
Janne Vanhala
Jason R. Coombs
@@ -139,9 +165,15 @@ Josh Karpel
Joshua Bronson
Jurko Gospodnetić
Justyna Janczyszyn
Justice Ndou
Kale Kundert
Kamran Ahmad
Karl O. Pinc
Karthikeyan Singaravelan
Katarzyna Jachim
Katarzyna Król
Katerina Koukiou
Keri Volans
Kevin Cox
Kevin J. Foley
Kodi B. Arfer
@@ -151,6 +183,7 @@ Kyle Altendorf
Lawrence Mitchell
Lee Kamentsky
Lev Maximov
Lewis Cowles
Llandy Riveron Del Risco
Loic Esteve
Lukas Bednar
@@ -165,6 +198,7 @@ Marcelo Duarte Trevisani
Marcin Bachry
Marco Gorelli
Mark Abramowitz
Mark Dickinson
Markus Unterwaditzer
Martijn Faassen
Martin Altmayer
@@ -176,7 +210,9 @@ Matt Duck
Matt Williams
Matthias Hafner
Maxim Filipenko
Maximilian Cosmo Sitter
mbyt
Mickey Pashov
Michael Aquilina
Michael Birtwell
Michael Droettboom
@@ -188,6 +224,7 @@ Mihai Capotă
Mike Hoyle (hoylemd)
Mike Lundy
Miro Hrončok
Nathaniel Compton
Nathaniel Waisbrot
Ned Batchelder
Neven Mundar
@@ -196,6 +233,7 @@ Nicholas Murphy
Niclas Olofsson
Nicolas Delaby
Nikolay Kondratyev
Olga Matoula
Oleg Pidsadnyi
Oleg Sushchenko
Oliver Bestwalter
@@ -203,15 +241,25 @@ Omar Kohl
Omer Hadari
Ondřej Súkup
Oscar Benjamin
Parth Patel
Patrick Hayes
Pauli Virtanen
Pavel Karateev
Paweł Adamczak
Pedro Algarvio
Petter Strandmark
Philipp Loose
Pieter Mulder
Piotr Banaszkiewicz
Piotr Helm
Prakhar Gurunani
Prashant Anand
Prashant Sharma
Pulkit Goyal
Punyashloka Biswal
Quentin Pradet
Ralf Schmitt
Ram Rachum
Ralph Giles
Ran Benita
Raphael Castaneda
@@ -225,25 +273,35 @@ Romain Dorgueil
Roman Bolshakov
Ronny Pfannschmidt
Ross Lawley
Ruaridh Williamson
Russel Winder
Ryan Wooden
Saiprasad Kale
Samuel Dion-Girardeau
Samuel Searles-Bryant
Samuele Pedroni
Sanket Duthade
Sankt Petersbug
Segev Finer
Serhii Mozghovyi
Seth Junot
Shantanu Jain
Shubham Adep
Simon Gomizelj
Simon Kerr
Skylar Downes
Srinivas Reddy Thatiparthy
Stefan Farmbauer
Stefan Scherfke
Stefan Zimmermann
Stefano Taschini
Steffen Allner
Stephan Obermann
Sven-Hendrik Haase
Sylvain Marié
Tadek Teleżyński
Takafumi Arakaki
Tanvi Mehta
Tarcisio Fischer
Tareq Alayan
Ted Xiao
@@ -253,7 +311,9 @@ Tim Hoffmann
Tim Strazny
Tom Dalton
Tom Viner
Tomáš Gavenčiak
Tomer Keren
Tor Colvin
Trevor Bekolay
Tyler Goodlet
Tzu-ping Chung
@@ -264,6 +324,8 @@ Vidar T. Fauske
Virgil Dupras
Vitaly Lashmanov
Vlad Dragos
Vlad Radziuk
Vladyslav Rachek
Volodymyr Piskun
Wei Lin
Wil Cooley
@@ -275,4 +337,6 @@ Xuan Luong
Xuecong Liao
Yoav Caspi
Zac Hatfield-Dodds
Zachary Kneupper
Zoltán Máté
Zsolt Cserna

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,6 @@ contacted individually:
- Brianna Laugher ([@pfctdayelise](https://github.com/pfctdayelise)): brianna@laugher.id.au
- Bruno Oliveira ([@nicoddemus](https://github.com/nicoddemus)): nicoddemus@gmail.com
- Florian Bruhin ([@the-compiler](https://github.com/the-compiler)): pytest@the-compiler.org
- Ronny Pfannschmidt ([@RonnyPfannschmidt](https://github.com/RonnyPfannschmidt)): ich@ronnypfannschmidt.de
## Attribution

View File

@@ -2,7 +2,7 @@
Contribution getting started
============================
Contributions are highly welcomed and appreciated. Every little help counts,
Contributions are highly welcomed and appreciated. Every little bit of help counts,
so do not hesitate!
.. contents::
@@ -51,7 +51,8 @@ Fix bugs
Look through the `GitHub issues for bugs <https://github.com/pytest-dev/pytest/labels/type:%20bug>`_.
:ref:`Talk <contact>` to developers to find out how you can fix specific bugs.
:ref:`Talk <contact>` to developers to find out how you can fix specific bugs. To indicate that you are going
to work on a particular issue, add a comment to that effect on the specific issue.
Don't forget to check the issue trackers of your favourite plugins, too!
@@ -85,9 +86,40 @@ without using a local copy. This can be convenient for small fixes.
$ tox -e docs
The built documentation should be available in the ``doc/en/_build/``.
The built documentation should be available in ``doc/en/_build/html``,
where 'en' refers to the documentation language.
Pytest has an API reference which in large part is
`generated automatically <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
from the docstrings of the documented items. Pytest uses the
`Sphinx docstring format <https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html>`_.
For example:
.. code-block:: python
def my_function(arg: ArgType) -> Foo:
"""Do important stuff.
More detailed info here, in separate paragraphs from the subject line.
Use proper sentences -- start sentences with capital letters and end
with periods.
Can include annotated documentation:
:param short_arg: An argument which determines stuff.
:param long_arg:
A long explanation which spans multiple lines, overflows
like this.
:returns: The result.
:raises ValueError:
Detailed information when this can happen.
.. versionadded:: 6.0
Including types into the annotations above is not necessary when
type-hinting is being used (as in this example).
"""
Where 'en' refers to the documentation language.
.. _submitplugin:
@@ -99,8 +131,6 @@ in repositories living under the ``pytest-dev`` organisations:
- `pytest-dev on GitHub <https://github.com/pytest-dev>`_
- `pytest-dev on Bitbucket <https://bitbucket.org/pytest-dev>`_
All pytest-dev Contributors team members have write access to all contained
repositories. Pytest core and plugins are generally developed
using `pull requests`_ to respective repositories.
@@ -116,20 +146,21 @@ You can submit your plugin by subscribing to the `pytest-dev mail list
mail pointing to your existing pytest plugin repository which must have
the following:
- PyPI presence with a ``setup.py`` that contains a license, ``pytest-``
- PyPI presence with packaging metadata that contains a ``pytest-``
prefixed name, version number, authors, short and long description.
- a ``tox.ini`` for running tests using `tox <https://tox.readthedocs.io>`_.
- a `tox configuration <https://tox.readthedocs.io/en/latest/config.html#configuration-discovery>`_
for running tests using `tox <https://tox.readthedocs.io>`_.
- a ``README.txt`` describing how to use the plugin and on which
- a ``README`` describing how to use the plugin and on which
platforms it runs.
- a ``LICENSE.txt`` file or equivalent containing the licensing
information, with matching info in ``setup.py``.
- a ``LICENSE`` file containing the licensing information, with
matching info in its packaging metadata.
- an issue tracker for bug reports and enhancement requests.
- a `changelog <http://keepachangelog.com/>`_
- a `changelog <https://keepachangelog.com/>`_.
If no contributor strongly objects and two agree, the repository can then be
transferred to the ``pytest-dev`` organisation.
@@ -165,8 +196,6 @@ Short version
#. Fork the repository.
#. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
#. Target ``master`` for bugfixes and doc changes.
#. Target ``features`` for new features or functionality changes.
#. Follow **PEP-8** for naming and `black <https://github.com/psf/black>`_ for formatting.
#. Tests are run using ``tox``::
@@ -175,8 +204,10 @@ Short version
The test environments above are usually enough to cover most cases locally.
#. Write a ``changelog`` entry: ``changelog/2574.bugfix.rst``, use issue id number
and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or
``trivial`` for the issue type.
and one of ``feature``, ``improvement``, ``bugfix``, ``doc``, ``deprecation``,
``breaking``, ``vendor`` or ``trivial`` for the issue type.
#. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please
add yourself to the ``AUTHORS`` file, in alphabetical order.
@@ -203,24 +234,18 @@ Here is a simple overview, with pytest-specific bits:
$ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git
$ cd pytest
# now, to fix a bug create your own branch off "master":
# now, create your own branch off "main":
$ git checkout -b your-bugfix-branch-name master
$ git checkout -b your-bugfix-branch-name main
# or to instead add a feature create your own branch off "features":
$ git checkout -b your-feature-branch-name features
Given we have "major.minor.micro" version numbers, bugfixes will usually
Given we have "major.minor.micro" version numbers, bug fixes will usually
be released in micro releases whereas features will be released in
minor releases and incompatible changes in major releases.
If you need some help with Git, follow this quick start
guide: https://git.wiki.kernel.org/index.php/QuickStart
#. Install `pre-commit <https://pre-commit.com>`_ and its hook on the pytest repo:
**Note: pre-commit must be installed as admin, as it will not function otherwise**::
#. Install `pre-commit <https://pre-commit.com>`_ and its hook on the pytest repo::
$ pip install --user pre-commit
$ pre-commit install
@@ -234,7 +259,7 @@ Here is a simple overview, with pytest-specific bits:
Tox is used to run all the tests and will automatically setup virtualenvs
to run the tests in.
(will implicitly use http://www.virtualenv.org/en/latest/)::
(will implicitly use https://virtualenv.pypa.io/en/latest/)::
$ pip install tox
@@ -262,45 +287,57 @@ Here is a simple overview, with pytest-specific bits:
When committing, ``pre-commit`` will re-format the files if necessary.
#. If instead of using ``tox`` you prefer to run the tests directly, then we suggest to create a virtual environment and use
an editable install with the ``testing`` extra::
$ python3 -m venv .venv
$ source .venv/bin/activate # Linux
$ .venv/Scripts/activate.bat # Windows
$ pip install -e ".[testing]"
Afterwards, you can edit the files and run pytest normally::
$ pytest testing/test_config.py
#. Create a new changelog entry in ``changelog``. The file should be named ``<issueid>.<type>.rst``,
where *issueid* is the number of the issue related to the change and *type* is one of
``feature``, ``improvement``, ``bugfix``, ``doc``, ``deprecation``, ``breaking``, ``vendor``
or ``trivial``. You may skip creating the changelog entry if the change doesn't affect the
documented behaviour of pytest.
#. Add yourself to ``AUTHORS`` file if not there yet, in alphabetical order.
#. Commit and push once your tests pass and you are happy with your change(s)::
$ git commit -a -m "<commit message>"
$ git push -u
#. Create a new changelog entry in ``changelog``. The file should be named ``<issueid>.<type>.rst``,
where *issueid* is the number of the issue related to the change and *type* is one of
``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or ``trivial``. You may not create a
changelog entry if the change doesn't affect the documented behaviour of Pytest.
#. Add yourself to ``AUTHORS`` file if not there yet, in alphabetical order.
#. Finally, submit a pull request through the GitHub website using this data::
head-fork: YOUR_GITHUB_USERNAME/pytest
compare: your-branch-name
base-fork: pytest-dev/pytest
base: master # if it's a bugfix
base: features # if it's a feature
base: main
Writing Tests
----------------------------
~~~~~~~~~~~~~
Writing tests for plugins or for pytest itself is often done using the `testdir fixture <https://docs.pytest.org/en/latest/reference.html#testdir>`_, as a "black-box" test.
Writing tests for plugins or for pytest itself is often done using the `pytester fixture <https://docs.pytest.org/en/stable/reference.html#pytester>`_, as a "black-box" test.
For example, to ensure a simple test passes you can write:
.. code-block:: python
def test_true_assertion(testdir):
testdir.makepyfile(
def test_true_assertion(pytester):
pytester.makepyfile(
"""
def test_foo():
assert True
"""
)
result = testdir.runpytest()
result = pytester.runpytest()
result.assert_outcomes(failed=0, passed=1)
@@ -309,14 +346,14 @@ Alternatively, it is possible to make checks based on the actual output of the t
.. code-block:: python
def test_true_assertion(testdir):
testdir.makepyfile(
def test_true_assertion(pytester):
pytester.makepyfile(
"""
def test_foo():
assert False
"""
)
result = testdir.runpytest()
result = pytester.runpytest()
result.stdout.fnmatch_lines(["*assert False*", "*1 failed*"])
When choosing a file where to write a new test, take a look at the existing files and see if there's
@@ -324,16 +361,121 @@ one file which looks like a good fit. For example, a regression test about a bug
should go into ``test_cacheprovider.py``, given that this option is implemented in ``cacheprovider.py``.
If in doubt, go ahead and open a PR with your best guess and we can discuss this over the code.
Joining the Development Team
----------------------------
Anyone who has successfully seen through a pull request which did not
require any extra work from the development team to merge will
themselves gain commit access if they so wish (if we forget to ask please send a friendly
reminder). This does not mean your workflow to contribute changes,
reminder). This does not mean there is any change in your contribution workflow:
everyone goes through the same pull-request-and-review process and
no-one merges their own pull requests unless already approved. It does however mean you can
participate in the development process more fully since you can merge
pull requests from other contributors yourself after having reviewed
them.
Backporting bug fixes for the next patch release
------------------------------------------------
Pytest makes feature release every few weeks or months. In between, patch releases
are made to the previous feature release, containing bug fixes only. The bug fixes
usually fix regressions, but may be any change that should reach users before the
next feature release.
Suppose for example that the latest release was 1.2.3, and you want to include
a bug fix in 1.2.4 (check https://github.com/pytest-dev/pytest/releases for the
actual latest release). The procedure for this is:
#. First, make sure the bug is fixed the ``main`` branch, with a regular pull
request, as described above. An exception to this is if the bug fix is not
applicable to ``main`` anymore.
#. ``git checkout origin/1.2.x -b backport-XXXX`` # use the main PR number here
#. Locate the merge commit on the PR, in the *merged* message, for example:
nicoddemus merged commit 0f8b462 into pytest-dev:main
#. ``git cherry-pick -x -m1 REVISION`` # use the revision you found above (``0f8b462``).
#. Open a PR targeting ``1.2.x``:
* Prefix the message with ``[1.2.x]``.
* Delete the PR body, it usually contains a duplicate commit message.
Who does the backporting
~~~~~~~~~~~~~~~~~~~~~~~~
As mentioned above, bugs should first be fixed on ``main`` (except in rare occasions
that a bug only happens in a previous release). So, who should do the backport procedure described
above?
1. If the bug was fixed by a core developer, it is the main responsibility of that core developer
to do the backport.
2. However, often the merge is done by another maintainer, in which case it is nice of them to
do the backport procedure if they have the time.
3. For bugs submitted by non-maintainers, it is expected that a core developer will to do
the backport, normally the one that merged the PR on ``main``.
4. If a non-maintainers notices a bug which is fixed on ``main`` but has not been backported
(due to maintainers forgetting to apply the *needs backport* label, or just plain missing it),
they are also welcome to open a PR with the backport. The procedure is simple and really
helps with the maintenance of the project.
All the above are not rules, but merely some guidelines/suggestions on what we should expect
about backports.
Handling stale issues/PRs
-------------------------
Stale issues/PRs are those where pytest contributors have asked for questions/changes
and the authors didn't get around to answer/implement them yet after a somewhat long time, or
the discussion simply died because people seemed to lose interest.
There are many reasons why people don't answer questions or implement requested changes:
they might get busy, lose interest, or just forget about it,
but the fact is that this is very common in open source software.
The pytest team really appreciates every issue and pull request, but being a high-volume project
with many issues and pull requests being submitted daily, we try to reduce the number of stale
issues and PRs by regularly closing them. When an issue/pull request is closed in this manner,
it is by no means a dismissal of the topic being tackled by the issue/pull request, but it
is just a way for us to clear up the queue and make the maintainers' work more manageable. Submitters
can always reopen the issue/pull request in their own time later if it makes sense.
When to close
~~~~~~~~~~~~~
Here are a few general rules the maintainers use deciding when to close issues/PRs because
of lack of inactivity:
* Issues labeled ``question`` or ``needs information``: closed after 14 days inactive.
* Issues labeled ``proposal``: closed after six months inactive.
* Pull requests: after one month, consider pinging the author, update linked issue, or consider closing. For pull requests which are nearly finished, the team should consider finishing it up and merging it.
The above are **not hard rules**, but merely **guidelines**, and can be (and often are!) reviewed on a case-by-case basis.
Closing pull requests
~~~~~~~~~~~~~~~~~~~~~
When closing a Pull Request, it needs to be acknowledging the time, effort, and interest demonstrated by the person which submitted it. As mentioned previously, it is not the intent of the team to dismiss a stalled pull request entirely but to merely to clear up our queue, so a message like the one below is warranted when closing a pull request that went stale:
Hi <contributor>,
First of all, we would like to thank you for your time and effort on working on this, the pytest team deeply appreciates it.
We noticed it has been awhile since you have updated this PR, however. pytest is a high activity project, with many issues/PRs being opened daily, so it is hard for us maintainers to track which PRs are ready for merging, for review, or need more attention.
So for those reasons we, think it is best to close the PR for now, but with the only intention to clean up our queue, it is by no means a rejection of your changes. We still encourage you to re-open this PR (it is just a click of a button away) when you are ready to get back to it.
Again we appreciate your time for working on this, and hope you might get back to this at a later time!
<bye>
Closing Issues
--------------
When a pull request is submitted to fix an issue, add text like ``closes #XYZW`` to the PR description and/or commits (where ``XYZW`` is the issue number). See the `GitHub docs <https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>`_ for more information.
When an issue is due to user error (e.g. misunderstanding of a functionality), please politely explain to the user why the issue raised is really a non-issue and ask them to close the issue if they have no further questions. If the original requestor is unresponsive, the issue will be handled as described in the section `Handling stale issues/PRs`_ above.

View File

@@ -1,60 +0,0 @@
Release Procedure
-----------------
Our current policy for releasing is to aim for a bugfix every few weeks and a minor release every 2-3 months. The idea
is to get fixes and new features out instead of trying to cram a ton of features into a release and by consequence
taking a lot of time to make a new one.
.. important::
pytest releases must be prepared on **Linux** because the docs and examples expect
to be executed in that platform.
#. Create a branch ``release-X.Y.Z`` with the version for the release.
* **maintenance releases**: from ``4.6-maintenance``;
* **patch releases**: from the latest ``master``;
* **minor releases**: from the latest ``features``; then merge with the latest ``master``;
Ensure your are in a clean work tree.
#. Using ``tox``, generate docs, changelog, announcements::
$ tox -e release -- <VERSION>
This will generate a commit with all the changes ready for pushing.
#. Open a PR for this branch targeting ``master`` (or ``4.6-maintenance`` for
maintenance releases).
#. After all tests pass and the PR has been approved, publish to PyPI by pushing the tag::
git tag <VERSION>
git push git@github.com:pytest-dev/pytest.git <VERSION>
Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
#. Merge the PR.
#. If this is a maintenance release, cherry-pick the CHANGELOG / announce
files to the ``master`` branch::
git fetch --all --prune
git checkout origin/master -b cherry-pick-maintenance-release
git cherry-pick --no-commit -m1 origin/4.6-maintenance
git checkout origin/master -- changelog
git commit # no arguments
#. Send an email announcement with the contents from::
doc/en/announce/release-<VERSION>.rst
To the following mailing lists:
* pytest-dev@python.org (all releases)
* python-announce-list@python.org (all releases)
* testing-in-python@lists.idyll.org (only major/minor releases)
And announce it on `Twitter <https://twitter.com/>`_ with the ``#pytest`` hashtag.

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2004-2019 Holger Krekel and others
Copyright (c) 2004-2021 Holger Krekel and others
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -1,6 +1,7 @@
.. image:: https://docs.pytest.org/en/latest/_static/pytest1.png
:target: https://docs.pytest.org/en/latest/
.. image:: https://github.com/pytest-dev/pytest/raw/main/doc/en/img/pytest_logo_curves.svg
:target: https://docs.pytest.org/en/stable/
:align: center
:height: 200
:alt: pytest
@@ -15,15 +16,16 @@
.. image:: https://img.shields.io/pypi/pyversions/pytest.svg
:target: https://pypi.org/project/pytest/
.. image:: https://codecov.io/gh/pytest-dev/pytest/branch/master/graph/badge.svg
.. image:: https://codecov.io/gh/pytest-dev/pytest/branch/main/graph/badge.svg
:target: https://codecov.io/gh/pytest-dev/pytest
:alt: Code coverage Status
.. image:: https://travis-ci.org/pytest-dev/pytest.svg?branch=master
:target: https://travis-ci.org/pytest-dev/pytest
.. image:: https://github.com/pytest-dev/pytest/workflows/main/badge.svg
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Amain
.. image:: https://dev.azure.com/pytest-dev/pytest/_apis/build/status/pytest-CI?branchName=master
:target: https://dev.azure.com/pytest-dev/pytest
.. image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest/main.svg
:target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/main
:alt: pre-commit.ci status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
@@ -31,6 +33,10 @@
.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
:target: https://www.codetriage.com/pytest-dev/pytest
.. image:: https://readthedocs.org/projects/pytest/badge/?version=latest
:target: https://pytest.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
The ``pytest`` framework makes it easy to write small tests, yet
scales to support complex functional testing for applications and libraries.
@@ -67,33 +73,33 @@ To execute it::
========================== 1 failed in 0.04 seconds ===========================
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <https://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <https://docs.pytest.org/en/stable/getting-started.html#our-first-test-run>`_ for more examples.
Features
--------
- Detailed info on failing `assert statements <https://docs.pytest.org/en/latest/assert.html>`_ (no need to remember ``self.assert*`` names);
- Detailed info on failing `assert statements <https://docs.pytest.org/en/stable/assert.html>`_ (no need to remember ``self.assert*`` names)
- `Auto-discovery
<https://docs.pytest.org/en/latest/goodpractices.html#python-test-discovery>`_
of test modules and functions;
<https://docs.pytest.org/en/stable/goodpractices.html#python-test-discovery>`_
of test modules and functions
- `Modular fixtures <https://docs.pytest.org/en/latest/fixture.html>`_ for
managing small or parametrized long-lived test resources;
- `Modular fixtures <https://docs.pytest.org/en/stable/fixture.html>`_ for
managing small or parametrized long-lived test resources
- Can run `unittest <https://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
`nose <https://docs.pytest.org/en/latest/nose.html>`_ test suites out of the box;
- Can run `unittest <https://docs.pytest.org/en/stable/unittest.html>`_ (or trial),
`nose <https://docs.pytest.org/en/stable/nose.html>`_ test suites out of the box
- Python 3.5+ and PyPy3;
- Python 3.6+ and PyPy3
- Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community;
- Rich plugin architecture, with over 850+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community
Documentation
-------------
For full documentation, including installation, tutorials and PDF documents, please see https://docs.pytest.org/en/latest/.
For full documentation, including installation, tutorials and PDF documents, please see https://docs.pytest.org/en/stable/.
Bugs/Requests
@@ -105,19 +111,19 @@ Please use the `GitHub issue tracker <https://github.com/pytest-dev/pytest/issue
Changelog
---------
Consult the `Changelog <https://docs.pytest.org/en/latest/changelog.html>`__ page for fixes and enhancements of each version.
Consult the `Changelog <https://docs.pytest.org/en/stable/changelog.html>`__ page for fixes and enhancements of each version.
Support pytest
--------------
`Open Collective`_ is an online funding platform for open and transparent communities.
It provide tools to raise money and share your finances in full transparency.
It provides tools to raise money and share your finances in full transparency.
It is the platform of choice for individuals and companies that want to make one-time or
monthly donations directly to the project.
See more datails in the `pytest collective`_.
See more details in the `pytest collective`_.
.. _Open Collective: https://opencollective.com
.. _pytest collective: https://opencollective.com/pytest
@@ -137,7 +143,7 @@ Save time, reduce risk, and improve code health, while paying the maintainers of
Security
^^^^^^^^
pytest has never been associated with a security vunerability, but in any case, to report a
pytest has never been associated with a security vulnerability, but in any case, to report a
security vulnerability please use the `Tidelift security contact <https://tidelift.com/security>`_.
Tidelift will coordinate the fix and disclosure.
@@ -145,8 +151,8 @@ Tidelift will coordinate the fix and disclosure.
License
-------
Copyright Holger Krekel and others, 2004-2019.
Copyright Holger Krekel and others, 2004-2021.
Distributed under the terms of the `MIT`_ license, pytest is free and open source software.
.. _`MIT`: https://github.com/pytest-dev/pytest/blob/master/LICENSE
.. _`MIT`: https://github.com/pytest-dev/pytest/blob/main/LICENSE

173
RELEASING.rst Normal file
View File

@@ -0,0 +1,173 @@
Release Procedure
-----------------
Our current policy for releasing is to aim for a bug-fix release every few weeks and a minor release every 2-3 months. The idea
is to get fixes and new features out instead of trying to cram a ton of features into a release and by consequence
taking a lot of time to make a new one.
The git commands assume the following remotes are setup:
* ``origin``: your own fork of the repository.
* ``upstream``: the ``pytest-dev/pytest`` official repository.
Preparing: Automatic Method
~~~~~~~~~~~~~~~~~~~~~~~~~~~
We have developed an automated workflow for releases, that uses GitHub workflows and is triggered
by `manually running <https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow>`__
the `prepare-release-pr workflow <https://github.com/pytest-dev/pytest/actions/workflows/prepare-release-pr.yml>`__
on GitHub Actions.
The automation will decide the new version number based on the following criteria:
- If the "major release" input is set to "yes", release a new major release
(e.g. 7.0.0 -> 8.0.0)
- If there are any ``.feature.rst`` or ``.breaking.rst`` files in the
``changelog`` directory, release a new minor release (e.g. 7.0.0 -> 7.1.0)
- Otherwise, release a bugfix release (e.g. 7.0.0 -> 7.0.1)
- If the "prerelease" input is set, append the string to the version number
(e.g. 7.0.0 -> 8.0.0rc1), if "major" is set, and "prerelease" is set to `rc1`)
Bug-fix and minor releases
^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug-fix and minor releases are always done from a maintenance branch. First,
consider double-checking the ``changelog`` directory to see if there are any
breaking changes or new features.
For a new minor release, first create a new maintenance branch from ``main``::
git fetch --all
git branch 7.1.x upstream/main
git push upstream 7.1.x
Then, trigger the workflow with the following inputs:
- branch: **7.1.x**
- major release: **no**
- prerelease: empty
Or via the commandline using `GitHub's cli <https://github.com/cli/cli>`__::
gh workflow run prepare-release-pr.yml -f branch=7.1.x -f major=no -f prerelease=
Where ``7.1.x`` is the maintenance branch for the ``7.1`` series. The automated
workflow will publish a PR for a branch ``release-7.1.0``.
Similarly, for a bug-fix release, use the existing maintenance branch and
trigger the workflow with e.g. ``branch: 7.0.x`` to get a new ``release-7.0.1``
PR.
Major releases
^^^^^^^^^^^^^^
1. Create a new maintenance branch from ``main``::
git fetch --all
git branch 8.0.x upstream/main
git push upstream 8.0.x
2. Trigger the workflow with the following inputs:
- branch: **8.0.x**
- major release: **yes**
- prerelease: empty
Or via the commandline::
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=
The automated workflow will publish a PR for a branch ``release-8.0.0``.
At this point on, this follows the same workflow as other maintenance branches: bug-fixes are merged
into ``main`` and ported back to the maintenance branch, even for release candidates.
Release candidates
^^^^^^^^^^^^^^^^^^
To release a release candidate, set the "prerelease" input to the version number
suffix to use. To release a ``8.0.0rc1``, proceed like under "major releases", but set:
- branch: 8.0.x
- major release: yes
- prerelease: **rc1**
Or via the commandline::
gh workflow run prepare-release-pr.yml -f branch=8.0.x -f major=yes -f prerelease=rc1
The automated workflow will publish a PR for a branch ``release-8.0.0rc1``.
**A note about release candidates**
During release candidates we can merge small improvements into
the maintenance branch before releasing the final major version, however we must take care
to avoid introducing big changes at this stage.
Preparing: Manual Method
~~~~~~~~~~~~~~~~~~~~~~~~
**Important**: pytest releases must be prepared on **Linux** because the docs and examples expect
to be executed on that platform.
To release a version ``MAJOR.MINOR.PATCH``, follow these steps:
#. For major and minor releases, create a new branch ``MAJOR.MINOR.x`` from
``upstream/main`` and push it to ``upstream``.
#. Create a branch ``release-MAJOR.MINOR.PATCH`` from the ``MAJOR.MINOR.x`` branch.
Ensure your are updated and in a clean working tree.
#. Using ``tox``, generate docs, changelog, announcements::
$ tox -e release -- MAJOR.MINOR.PATCH
This will generate a commit with all the changes ready for pushing.
#. Open a PR for the ``release-MAJOR.MINOR.PATCH`` branch targeting ``MAJOR.MINOR.x``.
Releasing
~~~~~~~~~
Both automatic and manual processes described above follow the same steps from this point onward.
#. After all tests pass and the PR has been approved, tag the release commit
in the ``release-MAJOR.MINOR.PATCH`` branch and push it. This will publish to PyPI::
git fetch --all
git tag MAJOR.MINOR.PATCH upstream/release-MAJOR.MINOR.PATCH
git push git@github.com:pytest-dev/pytest.git MAJOR.MINOR.PATCH
Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
#. Merge the PR.
#. Cherry-pick the CHANGELOG / announce files to the ``main`` branch::
git fetch --all --prune
git checkout upstream/main -b cherry-pick-release
git cherry-pick -x -m1 upstream/MAJOR.MINOR.x
#. Open a PR for ``cherry-pick-release`` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step.
#. For major and minor releases, tag the release cherry-pick merge commit in main with
a dev tag for the next feature release::
git checkout main
git pull
git tag MAJOR.{MINOR+1}.0.dev0
git push git@github.com:pytest-dev/pytest.git MAJOR.{MINOR+1}.0.dev0
#. Send an email announcement with the contents from::
doc/en/announce/release-<VERSION>.rst
To the following mailing lists:
* pytest-dev@python.org (all releases)
* python-announce-list@python.org (all releases)
* testing-in-python@lists.idyll.org (only major/minor releases)
And announce it on `Twitter <https://twitter.com/>`_ with the ``#pytest`` hashtag.

View File

@@ -24,8 +24,8 @@ members of the `contributors team`_ interested in receiving funding.
The current list of contributors receiving funding are:
* `@asottile`_
* `@blueyed`_
* `@nicoddemus`_
* `@The-Compiler`_
Contributors interested in receiving a part of the funds just need to submit a PR adding their
name to the list. Contributors that want to stop receiving the funds should also submit a PR
@@ -56,5 +56,5 @@ funds. Just drop a line to one of the `@pytest-dev/tidelift-admins`_ or use the
.. _`agreement`: https://tidelift.com/docs/lifting/agreement
.. _`@asottile`: https://github.com/asottile
.. _`@blueyed`: https://github.com/blueyed
.. _`@nicoddemus`: https://github.com/nicoddemus
.. _`@The-Compiler`: https://github.com/The-Compiler

View File

@@ -1,77 +0,0 @@
trigger:
- master
- features
variables:
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml -vv"
PYTEST_COVERAGE: '0'
jobs:
- job: 'Test'
pool:
vmImage: "vs2017-win2016"
strategy:
matrix:
# -- pypy3 disabled for now: #5279 --
# pypy3:
# python.version: 'pypy3'
# tox.env: 'pypy3'
py35-xdist:
python.version: '3.5'
tox.env: 'py35-xdist'
# Coverage for:
# - test_supports_breakpoint_module_global
PYTEST_COVERAGE: '1'
py36-xdist:
python.version: '3.6'
tox.env: 'py36-xdist'
py37:
python.version: '3.7'
tox.env: 'py37-twisted-numpy'
# Coverage for:
# - _py36_windowsconsoleio_workaround (with py36+)
# - test_request_garbage (no xdist)
PYTEST_COVERAGE: '1'
py37-linting/docs/doctesting:
python.version: '3.7'
tox.env: 'linting,docs,doctesting'
py37-pluggymaster-xdist:
python.version: '3.7'
tox.env: 'py37-pluggymaster-xdist'
maxParallel: 10
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: python -m pip install --upgrade pip && python -m pip install tox
displayName: 'Install tox'
- bash: |
if [[ "$PYTEST_COVERAGE" == "1" ]]; then
export _PYTEST_TOX_COVERAGE_RUN="coverage run -m"
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
export COVERAGE_FILE="$PWD/.coverage"
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
fi
python -m tox -e $(tox.env)
displayName: 'Run tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: 'build/test-results/$(tox.env).xml'
testRunTitle: '$(tox.env)'
condition: succeededOrFailed()
- bash: |
if [[ "$PYTEST_COVERAGE" == 1 ]]; then
scripts/report-coverage.sh
fi
env:
CODECOV_NAME: $(tox.env)
CODECOV_TOKEN: $(CODECOV_TOKEN)
displayName: Report and upload coverage
condition: eq(variables['PYTEST_COVERAGE'], '1')

13
bench/unit_test.py Normal file
View File

@@ -0,0 +1,13 @@
from unittest import TestCase # noqa: F401
for i in range(15000):
exec(
f"""
class Test{i}(TestCase):
@classmethod
def setUpClass(cls): pass
def test_1(self): pass
def test_2(self): pass
def test_3(self): pass
"""
)

11
bench/xunit.py Normal file
View File

@@ -0,0 +1,11 @@
for i in range(5000):
exec(
f"""
class Test{i}:
@classmethod
def setup_class(cls): pass
def test_1(self): pass
def test_2(self): pass
def test_3(self): pass
"""
)

1
changelog/5105.doc.rst Normal file
View File

@@ -0,0 +1 @@
Add automatically generated :ref:`plugin-list`. The list is updated on a periodic schedule.

View File

@@ -0,0 +1,7 @@
Added :meth:`cache.mkdir() <pytest.Cache.mkdir>`, which is similar to the existing :meth:`cache.makedir() <pytest.Cache.makedir>`,
but returns a :class:`pathlib.Path` instead of a legacy ``py.path.local``.
Added a ``paths`` type to :meth:`parser.addini() <pytest.Parser.addini>`,
as in ``parser.addini("mypaths", "my paths", type="paths")``,
which is similar to the existing ``pathlist``,
but returns a list of :class:`pathlib.Path` instead of legacy ``py.path.local``.

View File

@@ -0,0 +1,12 @@
Directly constructing the following classes is now deprecated:
- ``_pytest.mark.structures.Mark``
- ``_pytest.mark.structures.MarkDecorator``
- ``_pytest.mark.structures.MarkGenerator``
- ``_pytest.python.Metafunc``
- ``_pytest.runner.CallInfo``
- ``_pytest._code.ExceptionInfo``
- ``_pytest.config.argparsing.Parser``
- ``_pytest.config.argparsing.OptionGroup``
These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.

View File

@@ -0,0 +1,19 @@
The types of objects used in pytest's API are now exported so they may be used in type annotations.
The newly-exported types are:
- ``pytest.Config`` for :class:`Config <pytest.Config>`.
- ``pytest.Mark`` for :class:`marks <pytest.Mark>`.
- ``pytest.MarkDecorator`` for :class:`mark decorators <pytest.MarkDecorator>`.
- ``pytest.MarkGenerator`` for the :class:`pytest.mark <pytest.MarkGenerator>` singleton.
- ``pytest.Metafunc`` for the :class:`metafunc <pytest.MarkGenerator>` argument to the :func:`pytest_generate_tests <pytest.hookspec.pytest_generate_tests>` hook.
- ``pytest.CallInfo`` for the :class:`CallInfo <pytest.CallInfo>` type passed to various hooks.
- ``pytest.PytestPluginManager`` for :class:`PytestPluginManager <pytest.PytestPluginManager>`.
- ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo <pytest.ExceptionInfo>` type returned from :func:`pytest.raises` and passed to various hooks.
- ``pytest.Parser`` for the :class:`Parser <pytest.Parser>` type passed to the :func:`pytest_addoption <pytest.hookspec.pytest_addoption>` hook.
- ``pytest.OptionGroup`` for the :class:`OptionGroup <pytest.OptionGroup>` type returned from the :func:`parser.addgroup <pytest.Parser.getgroup>` method.
Constructing them directly is not supported; they are only meant for use in type annotations.
Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.

View File

@@ -0,0 +1,2 @@
:ref:`--import-mode=importlib <import-modes>` now works with features that
depend on modules being on :py:data:`sys.modules`, such as :mod:`pickle` and :mod:`dataclasses`.

View File

@@ -0,0 +1 @@
Fixed failing staticmethod test cases if they are inherited from a parent test class.

View File

@@ -0,0 +1,7 @@
The following hooks now receive an additional ``pathlib.Path`` argument, equivalent to an existing ``py.path.local`` argument:
- :func:`pytest_ignore_collect <_pytest.hookspec.pytest_ignore_collect>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
- :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
- :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
- :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter).
- :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter).

View File

@@ -0,0 +1,6 @@
The following changes have been made to internal pytest types/functions:
- The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``.
- The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``.
- The ``_pytest.code.getfslineno()`` function returns ``Path`` instead of ``py.path.local``.
- The ``_pytest.python.path_matches_patterns()`` function takes ``Path`` instead of ``py.path.local``.

View File

@@ -0,0 +1,3 @@
``testdir.makefile`` now silently accepts values which don't start with ``.`` to maintain backward compatibility with older pytest versions.
``pytester.makefile`` now issues a clearer error if the ``.`` is missing in the ``ext`` argument.

View File

@@ -0,0 +1,7 @@
Raising :class:`unittest.SkipTest` to skip collection of tests during the
pytest collection phase is deprecated. Use :func:`pytest.skip` instead.
Note: This deprecation only relates to using `unittest.SkipTest` during test
collection. You are probably not doing that. Ordinary usage of
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
:func:`unittest.skip` in unittest test cases is fully supported.

View File

@@ -0,0 +1 @@
``--version`` now writes version information to ``stdout`` rather than ``stderr``.

View File

@@ -0,0 +1 @@
Internal Restructure: let python.PyObjMixing inherit from nodes.Node to carry over typing information.

View File

@@ -0,0 +1 @@
Deprecate ``Node.fspath`` as we plan to move off `py.path.local <https://py.readthedocs.io/en/latest/path.html>`__ and switch to :mod:``pathlib``.

View File

@@ -0,0 +1 @@
Implement ``Node.path`` as a ``pathlib.Path``.

View File

@@ -0,0 +1,3 @@
Fixed issue where pytest's ``faulthandler`` support would not dump traceback on crashes
if the :mod:`faulthandler` module was already enabled during pytest startup (using
``python -X dev -m pytest`` for example).

View File

@@ -0,0 +1,5 @@
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
scheduled for removal in pytest 7 (deprecated since pytest 2.4.0):
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.

View File

@@ -0,0 +1 @@
Fixed an issue where illegal directory characters derived from ``getpass.getuser()`` raised an ``OSError``.

View File

@@ -0,0 +1,10 @@
Improved :func:`pytest.approx` assertion messages for sequences of numbers.
The assertion messages now dumps a table with the index and the error of each diff.
Example::
> assert [1, 2, 3, 4] == pytest.approx([1, 3, 3, 5])
E assert comparison failed for 2 values:
E Index | Obtained | Expected
E 1 | 2 | 3 +- 3.0e-06
E 3 | 4 | 5 +- 5.0e-06

1
changelog/8337.doc.rst Normal file
View File

@@ -0,0 +1 @@
Recommend `numpy.testing <https://numpy.org/doc/stable/reference/routines.testing.html>`__ module on :func:`pytest.approx` documentation.

View File

@@ -0,0 +1 @@
Fix ``Class.from_parent`` so it forwards extra keyword arguments to the constructor.

View File

@@ -0,0 +1 @@
The ``@pytest.mark.skip`` decorator now correctly handles its arguments. When the ``reason`` argument is accidentally given both positional and as a keyword (e.g. because it was confused with ``skipif``), a ``TypeError`` now occurs. Before, such tests were silently skipped, and the positional argument ignored. Additionally, ``reason`` is now documented correctly as positional or keyword (rather than keyword-only).

View File

@@ -0,0 +1 @@
Use private names for internal fixtures that handle classic setup/teardown so that they don't show up with the default ``--fixtures`` invocation (but they still show up with ``--fixtures -v``).

View File

@@ -0,0 +1,5 @@
By default, pytest will truncate long strings in assert errors so they don't clutter the output too much,
currently at ``240`` characters by default.
However, in some cases the longer output helps, or is even crucial, to diagnose a failure. Using ``-v`` will
now increase the truncation threshold to ``2400`` characters, and ``-vv`` or higher will disable truncation entirely.

View File

@@ -0,0 +1 @@
Assert the outcomes for the issue 518 test and fix the test.

View File

@@ -0,0 +1 @@
:func:`pytest.approx` now works on :class:`~decimal.Decimal` within mappings/dicts and sequences/lists.

View File

@@ -0,0 +1,4 @@
Defining a custom pytest node type which is both an item and a collector now issues a warning.
It was never sanely supported and triggers hard to debug errors.
Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example.

View File

@@ -0,0 +1 @@
The :confval:`required_plugins` config option now works correctly when pre-releases of plugins are installed, rather than falsely claiming that those plugins aren't installed at all.

View File

@@ -0,0 +1 @@
``-c <config file>`` now also properly defines ``rootdir`` as the directory that contains ``<config file>``.

View File

@@ -0,0 +1 @@
Python 3.10 is now supported.

View File

@@ -0,0 +1,4 @@
:meth:`pytest.MonkeyPatch.syspath_prepend` no longer fails when
``setuptools`` is not installed.
It now only calls :func:`pkg_resources.fixup_namespace_packages` if
``pkg_resources`` was previously imported, because it is not needed otherwise.

View File

@@ -0,0 +1,5 @@
Fixed issue where `TestCase.setUpClass` is not called when a test has `/` in its name since pytest 6.2.0.
This refers to the path part in pytest node IDs, e.g. `TestClass::test_it` in the node ID `tests/test_file.py::TestClass::test_it`.
Now, instead of assuming that the test name does not contain ``/``, it is assumed that test path does not contain ``::``. We plan to hopefully make both of these work in the future.

View File

@@ -0,0 +1 @@
Introduce fix to handle precision width in ``log-cli-format`` in turn to fix output coloring for certain formats.

View File

@@ -0,0 +1,5 @@
pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enabled with:
- Fixture location path printed with the fixture name.
- First section of the fixture's docstring printed under the fixture name.
- Whole of fixture's docstring printed under the fixture name using ``--verbose`` option.

View File

@@ -0,0 +1,4 @@
Reducing confusion from `pytest.warns(None)` by:
- Allowing no arguments to be passed in order to catch any exception (no argument defaults to `Warning`).
- Emit a deprecation warning if passed `None`.

1
changelog/8655.doc.rst Normal file
View File

@@ -0,0 +1 @@
Help text for ``--pdbcls`` more accurately reflects the option's behavior.

View File

@@ -0,0 +1 @@
New :ref:`version-tuple` attribute, which makes it simpler for users to do something depending on the pytest version (such as declaring hooks which are introduced in later versions).

View File

@@ -1,22 +1,24 @@
This directory contains "newsfragments" which are short files that contain a small **ReST**-formatted
text that will be added to the next ``CHANGELOG``.
The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users
The ``CHANGELOG`` will be read by **users**, so this description should be aimed to pytest users
instead of describing internal changes which are only relevant to the developers.
Make sure to use full sentences with correct case and punctuation, for example::
Make sure to use full sentences in the **past or present tense** and use punctuation, examples::
Fix issue with non-ascii messages from the ``warnings`` module.
Improved verbose diff output with sequences.
Terminal summary statistics now use multiple colors.
Each file should be named like ``<ISSUE>.<TYPE>.rst``, where
``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of:
* ``feature``: new user facing features, like new command-line options and new behavior.
* ``improvement``: improvement of existing functionality, usually without requiring user intervention (for example, new fields being written in ``--junitxml``, improved colors in terminal, etc).
* ``bugfix``: fixes a reported bug.
* ``bugfix``: fixes a bug.
* ``doc``: documentation improvement, like rewording an entire session or adding missing docs.
* ``deprecation``: feature deprecation.
* ``removal``: feature removal.
* ``breaking``: a change which may break existing suites, such as feature removal or behavior change.
* ``vendor``: changes in packages vendored in pytest.
* ``trivial``: fixing a small typo or internal change that might be noteworthy.
@@ -29,6 +31,7 @@ changelog using that instead.
If you are not sure what issue type to use, don't hesitate to ask in your PR.
``towncrier`` preserves multiple paragraphs and formatting (code blocks, lists, and so on), but for entries
other than ``features`` it is usually better to stick to a single paragraph to keep it concise. You can install
``towncrier`` and then run ``towncrier --draft``
if you want to get a preview of how your change will look in the final release notes.
other than ``features`` it is usually better to stick to a single paragraph to keep it concise.
You can also run ``tox -e docs`` to build the documentation
with the draft changelog (``doc/en/_build/html/changelog.html``) if you want to get a preview of how your change will look in the final release notes.

View File

@@ -1,7 +1,6 @@
# reference: https://docs.codecov.io/docs/codecovyml-reference
coverage:
status:
project: true
patch: true
changes: true
comment: off
project: false
comment: false

View File

@@ -1 +0,0 @@
``repr`` of ``ExceptionInfo`` objects has been improved to honor the ``__repr__`` method of the underlying exception.

View File

@@ -1,16 +1,24 @@
# Makefile for Sphinx documentation
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
REGENDOC_ARGS := \
--normalize "/[ \t]+\n/\n/" \
@@ -19,136 +27,13 @@ REGENDOC_ARGS := \
--normalize "/in \d.\d\ds/in 0.12s/" \
--normalize "@/tmp/pytest-of-.*/pytest-\d+@PYTEST_TMPDIR@" \
--normalize "@pytest-(\d+)\\.[^ ,]+@pytest-\1.x.y@" \
--normalize "@(This is pytest version )(\d+)\\.[^ ,]+@\1\2.x.y@" \
--normalize "@py-(\d+)\\.[^ ,]+@py-\1.x.y@" \
--normalize "@pluggy-(\d+)\\.[.\d,]+@pluggy-\1.x.y@" \
--normalize "@hypothesis-(\d+)\\.[.\d,]+@hypothesis-\1.x.y@" \
--normalize "@Python (\d+)\\.[^ ,]+@Python \1.x.y@"
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " showtarget to show the pytest.org target directory"
@echo " install to install docs to pytest.org/SITETARGET"
@echo " install-ldf to install the doc pdf to pytest.org/SITETARGET"
@echo " regen to regenerate pytest examples using the installed pytest"
@echo " linkcheck to check all external links for integrity"
clean:
-rm -rf $(BUILDDIR)/*
regen: REGENDOC_FILES:=*.rst */*.rst
regen:
PYTHONDONTWRITEBYTECODE=1 PYTEST_ADDOPTS="-pno:hypothesis -Wignore::pytest.PytestUnknownMarkWarning" COLUMNS=76 regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pytest.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pytest.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/pytest"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pytest"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
texinfo:
mkdir -p $(BUILDDIR)/texinfo
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
mkdir -p $(BUILDDIR)/texinfo
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: regen

View File

@@ -1,12 +1,19 @@
<h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
<h3>Contents</h3>
<ul>
<li><a href="{{ pathto('index') }}">Home</a></li>
<li><a href="{{ pathto('getting-started') }}">Install</a></li>
<li><a href="{{ pathto('contents') }}">Contents</a></li>
<li><a href="{{ pathto('reference') }}">API Reference</a></li>
<li><a href="{{ pathto('example/index') }}">Examples</a></li>
<li><a href="{{ pathto('customize') }}">Customize</a></li>
<li><a href="{{ pathto('getting-started') }}">Get started</a></li>
<li><a href="{{ pathto('how-to/index') }}">How-to guides</a></li>
<li><a href="{{ pathto('reference/index') }}">Reference guides</a></li>
<li><a href="{{ pathto('explanation/index') }}">Explanation</a></li>
<li><a href="{{ pathto('contents') }}">Complete table of contents</a></li>
<li><a href="{{ pathto('example/index') }}">Library of examples</a></li>
</ul>
<h3>About the project</h3>
<ul>
<li><a href="{{ pathto('changelog') }}">Changelog</a></li>
<li><a href="{{ pathto('contributing') }}">Contributing</a></li>
<li><a href="{{ pathto('backwards-compatibility') }}">Backwards Compatibility</a></li>
@@ -21,3 +28,7 @@
<hr>
{{ toc }}
{%- endif %}
<hr>
<a href="{{ pathto('genindex') }}">Index</a>
<hr>

View File

@@ -1,20 +1,52 @@
{% extends "!layout.html" %}
{% block header %}
{{super()}}
{#
Copied from:
https://raw.githubusercontent.com/pallets/pallets-sphinx-themes/b0c6c41849b4e15cbf62cc1d95c05ef2b3e155c8/src/pallets_sphinx_themes/themes/pocoo/layout.html
And removed the warning version (see #7331).
#}
{% extends "basic/layout.html" %}
{% set metatags %}
{{- metatags }}
<meta name="viewport" content="width=device-width, initial-scale=1">
{%- endset %}
{% block extrahead %}
{%- if page_canonical_url %}
<link rel="canonical" href="{{ page_canonical_url }}">
{%- endif %}
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '{{ url_root }}';</script>
{{ super() }}
{%- endblock %}
{% block sidebarlogo %}
{% if pagename != "index" or theme_index_sidebar_logo %}
{{ super() }}
{% endif %}
{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebar2 %}
<span id="sidebar-top"></span>
{{- super() }}
{%- endblock %}
{% block footer %}
{{ super() }}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-7597274-13']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{{ super() }}
{%- if READTHEDOCS and not readthedocs_docsearch %}
<script>
if (typeof READTHEDOCS_DATA !== 'undefined') {
if (!READTHEDOCS_DATA.features) {
READTHEDOCS_DATA.features = {};
}
READTHEDOCS_DATA.features.docsearch_disabled = true;
}
</script>
{%- endif %}
{{ js_tag("_static/version_warning_offset.js") }}
{% endblock %}

View File

@@ -2,7 +2,6 @@
<ul>
<li><a href="https://pypi.org/project/pytest/">pytest @ PyPI</a></li>
<li><a href="https://github.com/pytest-dev/pytest/">pytest @ GitHub</a></li>
<li><a href="http://plugincompat.herokuapp.com/">3rd party plugins</a></li>
<li><a href="https://github.com/pytest-dev/pytest/issues">Issue Tracker</a></li>
<li><a href="https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf">PDF Documentation</a>
</ul>

View File

@@ -1,3 +0,0 @@
*.pyc
*.pyo
.DS_Store

View File

@@ -1,37 +0,0 @@
Copyright (c) 2010 by Armin Ronacher.
Some rights reserved.
Redistribution and use in source and binary forms of the theme, with or
without modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
We kindly ask you to only use these themes in an unmodified manner just
for Flask and Flask-related products, not for unrelated projects. If you
like the visual style and want to use it for your own projects, please
consider making some larger changes to the themes (such as changing
font faces, sizes, colors or margins).
THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,31 +0,0 @@
Flask Sphinx Styles
===================
This repository contains sphinx styles for Flask and Flask related
projects. To use this style in your Sphinx documentation, follow
this guide:
1. put this folder as _themes into your docs folder. Alternatively
you can also use git submodules to check out the contents there.
2. add this to your conf.py:
sys.path.append(os.path.abspath('_themes'))
html_theme_path = ['_themes']
html_theme = 'flask'
The following themes exist:
- 'flask' - the standard flask documentation theme for large
projects
- 'flask_small' - small one-page theme. Intended to be used by
very small addon libraries for flask.
The following options exist for the flask_small theme:
[options]
index_logo = '' filename of a picture in _static
to be used as replacement for the
h1 in the index.rst file.
index_logo_height = 120px height of the index logo
github_fork = '' repository name on github for the
"fork me" badge

View File

@@ -1,24 +0,0 @@
{%- extends "basic/layout.html" %}
{%- block extrahead %}
{{ super() }}
{% if theme_touch_icon %}
<link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
{% endblock %}
{%- block relbar2 %}{% endblock %}
{% block header %}
{{ super() }}
{% if pagename == 'index' %}
<div class=indexwrapper>
{% endif %}
{% endblock %}
{%- block footer %}
<div class="footer">
&copy; Copyright {{ copyright }}.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.
</div>
{% if pagename == 'index' %}
</div>
{% endif %}
{%- endblock %}

View File

@@ -1,623 +0,0 @@
/*
* flasky.css_t
* ~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: Flask Design License, see LICENSE for details.
*/
{% set page_width = '1020px' %}
{% set sidebar_width = '220px' %}
/* muted version of green logo color #C9D22A */
{% set link_color = '#606413' %}
/* blue logo color */
{% set link_hover_color = '#009de0' %}
{% set base_font = 'sans-serif' %}
{% set header_font = 'sans-serif' %}
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: {{ base_font }};
font-size: 16px;
background-color: white;
color: #000;
margin: 0;
padding: 0;
}
div.document {
width: {{ page_width }};
margin: 30px auto 0 auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ sidebar_width }};
}
div.sphinxsidebar {
width: {{ sidebar_width }};
}
hr {
border: 0;
border-top: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 0 30px;
}
img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
width: {{ page_width }};
margin: 20px auto 30px auto;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
div.related {
display: none;
}
div.sphinxsidebar a {
text-decoration: none;
border-bottom: none;
}
div.sphinxsidebar a:hover {
color: {{ link_hover_color }};
border-bottom: 1px solid {{ link_hover_color }};
}
div.sphinxsidebar {
font-size: 14px;
line-height: 1.5;
}
div.sphinxsidebarwrapper {
padding: 18px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0 0 20px 0;
margin: 0;
text-align: center;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: {{ header_font }};
color: #444;
font-size: 21px;
font-weight: normal;
margin: 16px 0 0 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 18px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: {{ base_font }};
font-size: 1em;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: {{ link_color }};
text-decoration: underline;
}
a:hover {
color: {{ link_hover_color }};
text-decoration: underline;
}
a.reference.internal em {
font-style: normal;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: {{ header_font }};
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
{% if theme_index_logo %}
div.indexwrapper h1 {
text-indent: -999999px;
background: url({{ theme_index_logo }}) no-repeat center center;
height: {{ theme_index_logo_height }};
}
{% else %}
div.indexwrapper div.body h1 {
font-size: 200%;
}
{% endif %}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #ddd;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
ul.simple li {
margin-bottom: 0.5em;
}
div.topic ul.simple li {
margin-bottom: 0;
}
div.topic li > p:first-child {
margin-top: 0;
margin-bottom: 0;
}
div.admonition {
background: #fafafa;
padding: 10px 20px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition tt.xref, div.admonition a tt {
border-bottom: 1px solid #fafafa;
}
div.admonition p.admonition-title {
font-family: {{ header_font }};
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition :last-child {
margin-bottom: 0;
}
div.highlight {
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note, div.warning {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.topic a {
text-decoration: none;
border-bottom: none;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt, code {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em;
background: #eee;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
background: #fdfdfd;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td.label {
width: 0px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul, ol {
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #eee;
padding: 7px 12px;
line-height: 1.3em;
}
tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background-color: #FBFBFB;
border-bottom: 1px solid white;
}
a.reference {
text-decoration: none;
border-bottom: 1px dotted {{ link_color }};
}
a.reference:hover {
border-bottom: 1px solid {{ link_hover_color }};
}
li.toctree-l1 a.reference,
li.toctree-l2 a.reference,
li.toctree-l3 a.reference,
li.toctree-l4 a.reference {
border-bottom: none;
}
li.toctree-l1 a.reference:hover,
li.toctree-l2 a.reference:hover,
li.toctree-l3 a.reference:hover,
li.toctree-l4 a.reference:hover {
border-bottom: 1px solid {{ link_hover_color }};
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dotted {{ link_color }};
}
a.footnote-reference:hover {
border-bottom: 1px solid {{ link_hover_color }};
}
a:hover tt {
background: #EEE;
}
#reference div.section h2 {
/* separate code elements in the reference section */
border-top: 2px solid #ccc;
padding-top: 0.5em;
}
#reference div.section h3 {
/* separate code elements in the reference section */
border-top: 1px solid #ccc;
padding-top: 0.5em;
}
dl.class, dl.function {
margin-top: 1em;
margin-bottom: 1em;
}
dl.class > dd {
border-left: 3px solid #ccc;
margin-left: 0px;
padding-left: 30px;
}
dl.field-list {
flex-direction: column;
}
dl.field-list dd {
padding-left: 4em;
border-left: 3px solid #ccc;
margin-bottom: 0.5em;
}
dl.field-list dd > ul {
list-style: none;
padding-left: 0px;
}
dl.field-list dd > ul > li li :first-child {
text-indent: 0;
}
dl.field-list dd > ul > li :first-child {
text-indent: -2em;
padding-left: 0px;
}
dl.field-list dd > p:first-child {
text-indent: -2em;
}
@media screen and (max-width: 870px) {
div.sphinxsidebar {
display: none;
}
div.document {
width: 100%;
}
div.documentwrapper {
margin-left: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
}
div.bodywrapper {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
ul {
margin-left: 0;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.bodywrapper {
margin: 0;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
@media screen and (max-width: 875px) {
body {
margin: 0;
padding: 20px 30px;
}
div.documentwrapper {
float: none;
background: white;
}
div.sphinxsidebar {
display: block;
float: none;
width: 102.5%;
margin: 50px -30px -20px -30px;
padding: 10px 20px;
background: #333;
color: white;
}
div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
div.sphinxsidebar h3 a, div.sphinxsidebar ul {
color: white;
}
div.sphinxsidebar a {
color: #aaa;
}
div.sphinxsidebar p.logo {
display: none;
}
div.document {
width: 100%;
margin: 0;
}
div.related {
display: block;
margin: 0;
padding: 10px 0 20px 0;
}
div.related ul,
div.related ul li {
margin: 0;
padding: 0;
}
div.footer {
display: none;
}
div.bodywrapper {
margin: 0;
}
div.body {
min-height: 0;
padding: 0;
}
.rtd_doc_footer {
display: none;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
/* misc. */
.revsys-inline {
display: none!important;
}

View File

@@ -1,9 +0,0 @@
[theme]
inherit = basic
stylesheet = flasky.css
pygments_style = flask_theme_support.FlaskyStyle
[options]
index_logo = ''
index_logo_height = 120px
touch_icon =

View File

@@ -1,87 +0,0 @@
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Comment
from pygments.token import Error
from pygments.token import Generic
from pygments.token import Keyword
from pygments.token import Literal
from pygments.token import Name
from pygments.token import Number
from pygments.token import Operator
from pygments.token import Other
from pygments.token import Punctuation
from pygments.token import String
from pygments.token import Whitespace
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
styles = {
# No corresponding class for the following:
# Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment.Preproc: "noitalic", # class: 'cp'
Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Type: "bold #004461", # class: 'kt'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
String: "#4e9a06", # class: 's'
String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Double: "#4e9a06", # class: 's2'
String.Escape: "#4e9a06", # class: 'se'
String.Heredoc: "#4e9a06", # class: 'sh'
String.Interpol: "#4e9a06", # class: 'si'
String.Other: "#4e9a06", # class: 'sx'
String.Regex: "#4e9a06", # class: 'sr'
String.Single: "#4e9a06", # class: 's1'
String.Symbol: "#4e9a06", # class: 'ss'
Generic: "#000000", # class: 'g'
Generic.Deleted: "#a40000", # class: 'gd'
Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic.Heading: "bold #000080", # class: 'gh'
Generic.Inserted: "#00A000", # class: 'gi'
Generic.Output: "#888", # class: 'go'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
}

View File

@@ -45,7 +45,7 @@ Partner projects, sign up here! (by 22 March)
What does it mean to "adopt pytest"?
-----------------------------------------
There can be many different definitions of "success". Pytest can run many `nose and unittest`_ tests by default, so using pytest as your testrunner may be possible from day 1. Job done, right?
There can be many different definitions of "success". Pytest can run many nose_ and unittest_ tests by default, so using pytest as your testrunner may be possible from day 1. Job done, right?
Progressive success might look like:
@@ -63,7 +63,8 @@ Progressive success might look like:
It may be after the month is up, the partner project decides that pytest is not right for it. That's okay - hopefully the pytest team will also learn something about its weaknesses or deficiencies.
.. _`nose and unittest`: faq.html#how-does-pytest-relate-to-nose-and-unittest
.. _nose: nose.html
.. _unittest: unittest.html
.. _assert: assert.html
.. _pycmd: https://bitbucket.org/hpk42/pycmd/overview
.. _`setUp/tearDown methods`: xunit_setup.html

View File

@@ -6,6 +6,27 @@ Release announcements
:maxdepth: 2
release-6.2.4
release-6.2.3
release-6.2.2
release-6.2.1
release-6.2.0
release-6.1.2
release-6.1.1
release-6.1.0
release-6.0.2
release-6.0.1
release-6.0.0
release-6.0.0rc1
release-5.4.3
release-5.4.2
release-5.4.1
release-5.4.0
release-5.3.5
release-5.3.4
release-5.3.3
release-5.3.2
release-5.3.1
release-5.3.0
release-5.2.4
release-5.2.3
@@ -18,6 +39,10 @@ Release announcements
release-5.1.0
release-5.0.1
release-5.0.0
release-4.6.9
release-4.6.8
release-4.6.7
release-4.6.6
release-4.6.5
release-4.6.4
release-4.6.3

View File

@@ -7,7 +7,7 @@ see below for summary and detailed lists. A lot of long-deprecated code
has been removed, resulting in a much smaller and cleaner
implementation. See the new docs with examples here:
http://pytest.org/2.0.0/index.html
http://pytest.org/en/stable/index.html
A note on packaging: pytest used to part of the "py" distribution up
until version py-1.3.4 but this has changed now: pytest-2.0.0 only
@@ -36,12 +36,12 @@ New Features
import pytest ; pytest.main(arglist, pluginlist)
see http://pytest.org/2.0.0/usage.html for details.
see http://pytest.org/en/stable/usage.html for details.
- new and better reporting information in assert expressions
if comparing lists, sequences or strings.
see http://pytest.org/2.0.0/assert.html#newreport
see http://pytest.org/en/stable/assert.html#newreport
- new configuration through ini-files (setup.cfg or tox.ini recognized),
for example::
@@ -50,7 +50,7 @@ New Features
norecursedirs = .hg data* # don't ever recurse in such dirs
addopts = -x --pyargs # add these command line options by default
see http://pytest.org/2.0.0/customize.html
see http://pytest.org/en/stable/customize.html
- improved standard unittest support. In general py.test should now
better be able to run custom unittest.TestCases like twisted trial

View File

@@ -57,7 +57,7 @@ Changes between 2.0.0 and 2.0.1
- refinements to "collecting" output on non-ttys
- refine internal plugin registration and --traceconfig output
- introduce a mechanism to prevent/unregister plugins from the
command line, see http://pytest.org/latest/plugins.html#cmdunregister
command line, see http://pytest.org/en/stable/plugins.html#cmdunregister
- activate resultlog plugin by default
- fix regression wrt yielded tests which due to the
collection-before-running semantics were not

View File

@@ -12,7 +12,7 @@ courtesy of Benjamin Peterson. You can now safely use ``assert``
statements in test modules without having to worry about side effects
or python optimization ("-OO") options. This is achieved by rewriting
assert statements in test modules upon import, using a PEP302 hook.
See https://docs.pytest.org/en/latest/assert.html for
See https://docs.pytest.org/en/stable/assert.html for
detailed information. The work has been partly sponsored by my company,
merlinux GmbH.
@@ -24,7 +24,7 @@ If you want to install or upgrade pytest, just type one of::
easy_install -U pytest
best,
holger krekel / http://merlinux.eu
holger krekel / https://merlinux.eu/
Changes between 2.0.3 and 2.1.0
----------------------------------------------

View File

@@ -20,7 +20,7 @@ If you want to install or upgrade pytest, just type one of::
easy_install -U pytest
best,
holger krekel / http://merlinux.eu
holger krekel / https://merlinux.eu/
Changes between 2.1.0 and 2.1.1
----------------------------------------------

View File

@@ -19,7 +19,7 @@ If you want to install or upgrade pytest, just type one of::
easy_install -U pytest
best,
holger krekel / http://merlinux.eu
holger krekel / https://merlinux.eu/
Changes between 2.1.1 and 2.1.2
----------------------------------------

View File

@@ -9,7 +9,7 @@ with these improvements:
- new @pytest.mark.parametrize decorator to run tests with different arguments
- new metafunc.parametrize() API for parametrizing arguments independently
- see examples at http://pytest.org/latest/example/parametrize.html
- see examples at http://pytest.org/en/stable/example/parametrize.html
- NOTE that parametrize() related APIs are still a bit experimental
and might change in future releases.
@@ -18,7 +18,7 @@ with these improvements:
- "-m markexpr" option for selecting tests according to their mark
- a new "markers" ini-variable for registering test markers for your project
- the new "--strict" bails out with an error if using unregistered markers.
- see examples at http://pytest.org/latest/example/markers.html
- see examples at http://pytest.org/en/stable/example/markers.html
* duration profiling: new "--duration=N" option showing the N slowest test
execution or setup/teardown calls. This is most useful if you want to
@@ -78,7 +78,7 @@ Changes between 2.1.3 and 2.2.0
or through plugin hooks. Also introduce a "--strict" option which
will treat unregistered markers as errors
allowing to avoid typos and maintain a well described set of markers
for your test suite. See examples at http://pytest.org/latest/mark.html
for your test suite. See examples at http://pytest.org/en/stable/mark.html
and its links.
- issue50: introduce "-m marker" option to select tests based on markers
(this is a stricter and more predictable version of "-k" in that "-m"

View File

@@ -3,22 +3,22 @@ pytest-2.3: improved fixtures / better unittest integration
pytest-2.3 comes with many major improvements for fixture/funcarg management
and parametrized testing in Python. It is now easier, more efficient and
more predicatable to re-run the same tests with different fixture
more predictable to re-run the same tests with different fixture
instances. Also, you can directly declare the caching "scope" of
fixtures so that dependent tests throughout your whole test suite can
re-use database or other expensive fixture objects with ease. Lastly,
it's possible for fixture functions (formerly known as funcarg
factories) to use other fixtures, allowing for a completely modular and
re-useable fixture design.
re-usable fixture design.
For detailed info and tutorial-style examples, see:
http://pytest.org/latest/fixture.html
http://pytest.org/en/stable/fixture.html
Moreover, there is now support for using pytest fixtures/funcargs with
unittest-style suites, see here for examples:
http://pytest.org/latest/unittest.html
http://pytest.org/en/stable/unittest.html
Besides, more unittest-test suites are now expected to "simply work"
with pytest.
@@ -29,11 +29,11 @@ pytest-2.2.4.
If you are interested in the precise reasoning (including examples) of the
pytest-2.3 fixture evolution, please consult
http://pytest.org/latest/funcarg_compare.html
http://pytest.org/en/stable/funcarg_compare.html
For general info on installation and getting started:
http://pytest.org/latest/getting-started.html
http://pytest.org/en/stable/getting-started.html
Docs and PDF access as usual at:
@@ -94,7 +94,7 @@ Changes between 2.2.4 and 2.3.0
- pluginmanager.register(...) now raises ValueError if the
plugin has been already registered or the name is taken
- fix issue159: improve http://pytest.org/latest/faq.html
- fix issue159: improve https://docs.pytest.org/en/6.0.1/faq.html
especially with respect to the "magic" history, also mention
pytest-django, trial and unittest integration.

View File

@@ -16,7 +16,7 @@ comes with the following fixes and features:
- yielded test functions will now have autouse-fixtures active but
cannot accept fixtures as funcargs - it's anyway recommended to
rather use the post-2.0 parametrize features instead of yield, see:
http://pytest.org/latest/example/parametrize.html
http://pytest.org/en/stable/example/parametrize.html
- fix autouse-issue where autouse-fixtures would not be discovered
if defined in an a/conftest.py file and tests in a/tests/test_some.py
- fix issue226 - LIFO ordering for fixture teardowns

View File

@@ -46,7 +46,7 @@ Changes between 2.3.4 and 2.3.5
- Issue 265 - integrate nose setup/teardown with setupstate
so it doesn't try to teardown if it did not setup
- issue 271 - don't write junitxml on slave nodes
- issue 271 - don't write junitxml on worker nodes
- Issue 274 - don't try to show full doctest example
when doctest does not know the example location

View File

@@ -7,7 +7,7 @@ from a few supposedly very minor incompatibilities. See below for
a full list of details. A few feature highlights:
- new yield-style fixtures `pytest.yield_fixture
<http://pytest.org/latest/yieldfixture.html>`_, allowing to use
<http://pytest.org/en/stable/yieldfixture.html>`_, allowing to use
existing with-style context managers in fixture functions.
- improved pdb support: ``import pdb ; pdb.set_trace()`` now works

View File

@@ -91,7 +91,7 @@ holger krekel
it might be the cause for other finalizers to fail.
- fix ordering when mock.patch or other standard decorator-wrappings
are used with test methods. This fixues issue346 and should
are used with test methods. This fixes issue346 and should
help with random "xdist" collection failures. Thanks to
Ronny Pfannschmidt and Donald Stufft for helping to isolate it.

View File

@@ -1,7 +1,7 @@
pytest-2.5.1: fixes and new home page styling
===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests
pytest is a mature Python testing tool with more than 1000 tests
against itself, passing on many different interpreters and platforms.
The 2.5.1 release maintains the "zero-reported-bugs" promise by fixing

View File

@@ -1,7 +1,7 @@
pytest-2.5.2: fixes
===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests
pytest is a mature Python testing tool with more than 1000 tests
against itself, passing on many different interpreters and platforms.
The 2.5.2 release fixes a few bugs with two maybe-bugs remaining and

View File

@@ -1,7 +1,7 @@
pytest-2.6.0: shorter tracebacks, new warning system, test runner compat
===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests
pytest is a mature Python testing tool with more than 1000 tests
against itself, passing on many different interpreters and platforms.
The 2.6.0 release should be drop-in backward compatible to 2.5.2 and

View File

@@ -1,7 +1,7 @@
pytest-2.6.1: fixes and new xfail feature
===========================================================================
pytest is a mature Python testing tool with more than a 1100 tests
pytest is a mature Python testing tool with more than 1100 tests
against itself, passing on many different interpreters and platforms.
The 2.6.1 release is drop-in compatible to 2.5.2 and actually fixes some
regressions introduced with 2.6.0. It also brings a little feature
@@ -32,7 +32,7 @@ Changes 2.6.1
purely the nodeid. The line number is still shown in failure reports.
Thanks Floris Bruynooghe.
- fix issue437 where assertion rewriting could cause pytest-xdist slaves
- fix issue437 where assertion rewriting could cause pytest-xdist worker nodes
to collect different tests. Thanks Bruno Oliveira.
- fix issue555: add "errors" attribute to capture-streams to satisfy

View File

@@ -1,7 +1,7 @@
pytest-2.6.2: few fixes and cx_freeze support
===========================================================================
pytest is a mature Python testing tool with more than a 1100 tests
pytest is a mature Python testing tool with more than 1100 tests
against itself, passing on many different interpreters and platforms.
This release is drop-in compatible to 2.5.2 and 2.6.X. It also
brings support for including pytest with cx_freeze or similar

View File

@@ -1,7 +1,7 @@
pytest-2.6.3: fixes and little improvements
===========================================================================
pytest is a mature Python testing tool with more than a 1100 tests
pytest is a mature Python testing tool with more than 1100 tests
against itself, passing on many different interpreters and platforms.
This release is drop-in compatible to 2.5.2 and 2.6.X.
See below for the changes and see docs at:

View File

@@ -1,7 +1,7 @@
pytest-2.7.0: fixes, features, speed improvements
===========================================================================
pytest is a mature Python testing tool with more than a 1100 tests
pytest is a mature Python testing tool with more than 1100 tests
against itself, passing on many different interpreters and platforms.
This release is supposed to be drop-in compatible to 2.6.X.
@@ -35,7 +35,7 @@ holger krekel
- fix issue435: make reload() work when assert rewriting is active.
Thanks Daniel Hahler.
- fix issue616: conftest.py files and their contained fixutres are now
- fix issue616: conftest.py files and their contained fixtures are now
properly considered for visibility, independently from the exact
current working directory and test arguments that are used.
Many thanks to Eric Siegerman and his PR235 which contains
@@ -52,7 +52,7 @@ holger krekel
- add ability to set command line options by environment variable PYTEST_ADDOPTS.
- added documentation on the new pytest-dev teams on bitbucket and
github. See https://pytest.org/latest/contributing.html .
github. See https://pytest.org/en/stable/contributing.html .
Thanks to Anatoly for pushing and initial work on this.
- fix issue650: new option ``--docttest-ignore-import-errors`` which

View File

@@ -1,7 +1,7 @@
pytest-2.7.1: bug fixes
=======================
pytest is a mature Python testing tool with more than a 1100 tests
pytest is a mature Python testing tool with more than 1100 tests
against itself, passing on many different interpreters and platforms.
This release is supposed to be drop-in compatible to 2.7.0.

View File

@@ -1,7 +1,7 @@
pytest-2.7.2: bug fixes
=======================
pytest is a mature Python testing tool with more than a 1100 tests
pytest is a mature Python testing tool with more than 1100 tests
against itself, passing on many different interpreters and platforms.
This release is supposed to be drop-in compatible to 2.7.1.

Some files were not shown because too many files have changed in this diff Show More