Compare commits

..

1231 Commits
3.2.2 ... 3.6.2

Author SHA1 Message Date
Bruno Oliveira
46aa18dfa7 Lint regendoc changes 2018-06-19 21:34:03 -03:00
Bruno Oliveira
617a5fcf98 Preparing release version 3.6.2 2018-06-20 00:29:58 +00:00
Bruno Oliveira
19ba243cae Merge pull request #3600 from RonnyPfannschmidt/pyproject-compliance
add build-system section to pyproject.toml
2018-06-19 06:58:28 -03:00
Ronny Pfannschmidt
af5d41fdfd add build-system section to pyproject.toml
this makes the file valid and prepares for https://github.com/pypa/pip/issues/5416 and https://github.com/pypa/pip/pull/5512
2018-06-19 10:41:04 +02:00
Bruno Oliveira
85be8bdf49 Merge pull request #3599 from pytest-dev/asottile-patch-1
Use --show-diff-on-failure for pre-commit CI invocation
2018-06-18 23:31:01 -03:00
Anthony Sottile
8e9f1d2417 Use --show-diff-on-failure for pre-commit CI invocation 2018-06-18 18:27:48 -07:00
Bruno Oliveira
2925f3057f Merge pull request #3584 from jwodder/fix-3583
Fix encoding error with `print` statements in doctests
2018-06-18 08:03:07 -03:00
Anthony Sottile
a93ad1fb77 Merge pull request #3590 from alexbarbato/3525_typo_fixture_docs
3525 typo fixture docs
2018-06-16 13:28:21 -07:00
Alex Barbato
561db95521 Add changelog file. 2018-06-16 12:44:19 -04:00
Alex Barbato
9408291c50 Fixing parens typo in fixture.rst 2018-06-16 12:40:25 -04:00
Ronny Pfannschmidt
4dc7b4ace6 Merge pull request #3589 from hynek/master
Fix 2 DeprecationWarnings about invalid escape seq
2018-06-16 11:56:35 +02:00
Hynek Schlawack
acb8f23311 Fix 2 DeprecationWarnings about invalid escape seq 2018-06-16 10:37:33 +02:00
Anthony Sottile
b285078db4 Merge pull request #3535 from RonnyPfannschmidt/config-split
begin to turn config into package
2018-06-15 10:28:06 -07:00
John T. Wodder II
d382f3e77f [#3583] Fix encoding error with print statements in doctests
This fix was suggested by Stack Overflow user phd in
<https://stackoverflow.com/a/50863820/744178>.
2018-06-15 17:23:54 +00:00
John T. Wodder II
5221a14764 Failing test case for #3583 2018-06-15 17:23:49 +00:00
Bruno Oliveira
4d0297b413 Merge pull request #3577 from RonnyPfannschmidt/addmarker-fix
fix addmarker - extract mark from markdecorator
2018-06-13 07:30:22 -03:00
Bruno Oliveira
88ae21f2cc Add mock dependency to py27-nobyte 2018-06-12 18:07:40 -03:00
Ronny Pfannschmidt
321f66f711 mark test_wrapped_getfuncargnames_patching as xfail 2018-06-12 22:25:05 +02:00
Ronny Pfannschmidt
52c4279918 Merge pull request #3572 from nicoddemus/remove-unused-scripts
Remove unused scripts and old docs
2018-06-12 21:57:51 +02:00
Bruno Oliveira
077c44cf69 Merge pull request #3578 from BartoszCki/master
Fix three spaces instead of four in docs
2018-06-12 15:17:40 -03:00
Bartosz Cierocki
f786534173 Fix three spaces instead of four in docs 2018-06-12 19:39:51 +02:00
Ronny Pfannschmidt
b0ec442d24 rework Node.add_marker parameter list and docstring 2018-06-12 17:55:58 +02:00
Bruno Oliveira
9a7c3a65f4 Improve CHANGELOG formatting 2018-06-12 11:07:42 -03:00
Ronny Pfannschmidt
37793d4cdb fix addmarker - extract mark from markdecorator 2018-06-12 15:50:58 +02:00
Ronny Pfannschmidt
1b5322da1b Merge pull request #3571 from nicoddemus/pre-commit-contributors-guide
Improve contributing instructions regarding black/linting
2018-06-12 06:37:18 +02:00
Bruno Oliveira
d6e7b1a21b Remove obsolete doc/en/test directory
Apparently this was an old version of the docs, which has long been superseded
2018-06-11 23:33:09 -03:00
Bruno Oliveira
4983de60d3 Remove unused scripts from docs 2018-06-11 23:32:49 -03:00
Bruno Oliveira
e0a1da4eb9 Remove changelog for #3554
This entry was removed in #3562
2018-06-11 23:17:11 -03:00
Anthony Sottile
ef88251573 Merge pull request #3570 from sangongs/fix_stack_finalizer
Continue to call finalizers in the stack when a finalizer raises an exception
2018-06-11 19:07:59 -07:00
Bruno Oliveira
f300f7fa24 Improve contributing instructions regarding black/linting 2018-06-11 20:49:25 -03:00
Bruno Oliveira
41125968d9 Check the exception matches the message for completeness 2018-06-11 20:33:13 -03:00
Bruno Oliveira
4fd66e8a42 Run black on test file 2018-06-11 20:32:08 -03:00
Guoqiang Zhang
a888bf182e Continue to call finalizers in the stack when a finalizer in a former scope raises an exception 2018-06-11 18:01:18 -04:00
Bruno Oliveira
04b65cfba0 Merge pull request #3565 from nicoddemus/xfail-test-request-garbage
Attempt to fix test_request_garbage on Windows
2018-06-11 15:23:47 -03:00
Ronny Pfannschmidt
61471df8da Merge pull request #3562 from nicoddemus/revert-callinfo-result
Revert change of Callinfo.result default value
2018-06-11 19:03:01 +02:00
Ronny Pfannschmidt
1aba123ac5 fix doc build 2018-06-11 16:20:24 +02:00
Bruno Oliveira
efc9a0ecb5 Merge pull request #3567 from michael-k/doc-typo
Fix typo in documentation
2018-06-11 09:09:53 -03:00
Michael Käufl
4a78711067 Fix typo in documentation 2018-06-11 13:28:09 +02:00
Bruno Oliveira
5ea647a245 Attempt to fix flaky test_request_garbage on Windows
Fix #3564
2018-06-10 19:18:44 -03:00
Bruno Oliveira
11705040ac Merge pull request #3563 from asottile/undetermined_location_none
Print <undetermined location> instead of None for warnings
2018-06-10 16:19:50 -03:00
Anthony Sottile
fe81de6150 git mv changelog/3554.bugfix{,.rst} 2018-06-10 10:53:15 -07:00
Anthony Sottile
49f621de76 Print <undetermined location> instead of None for warnings 2018-06-10 10:51:36 -07:00
Bruno Oliveira
10b0b81346 Revert change of Callinfo.result default value
As discussed in #3560, this should not go to master because this breaks
the API.

Reverts commits:

1a7dcd73cf
198e993969
2018-06-10 11:47:58 -03:00
Alan Velasco
80f8a3ad7c Merge pull request #3560 from alanbato/fix_callinfo_rrp
Add a default value to CallInfo.result
2018-06-09 21:20:56 -07:00
Bruno Oliveira
198e993969 Format CHANGELOG 2018-06-09 21:31:32 -03:00
Alan Velasco
1a7dcd73cf Add a default value to CallInfo.result 2018-06-09 16:58:23 -07:00
Bruno Oliveira
7c8d072241 Merge pull request #3558 from nicoddemus/doc-strict
Add documentation blurb for --strict
2018-06-09 19:38:31 -03:00
Bruno Oliveira
c4f72e4d13 Apply code review changes 2018-06-09 12:40:39 -03:00
Bruno Oliveira
3667a52ba2 Remove Mark api from mark.rst
Feels out of place in there, plus the reference documentation
already contains the reference API to all mark-related classes
2018-06-09 12:02:28 -03:00
Bruno Oliveira
97d48ba60d Add documentation blurb for --strict
Fix #3549
2018-06-09 12:02:21 -03:00
Bruno Oliveira
55bbd3e3e2 Merge pull request #3553 from asottile/changelog_3552
Add changelog entry for #3552
2018-06-09 10:31:54 -03:00
Anthony Sottile
4c01dd651e Add changelog entry for #3552 2018-06-08 06:20:57 -07:00
Bruno Oliveira
472354c714 Merge pull request #3552 from asottile/remove_setup_py_test
Remove setup.py test now that it's broken
2018-06-08 08:28:18 -03:00
Anthony Sottile
c1d9ca81df Remove setup.py test now that it's broken 2018-06-07 22:01:14 -07:00
Bruno Oliveira
f389a4e91f Merge pull request #3545 from blueyed/int
Improve display of hint about --fulltrace with KeyboardInterrupt
2018-06-07 20:03:06 -03:00
Bruno Oliveira
942d363c03 Improve changelog formatting 2018-06-07 18:55:50 -03:00
Daniel Hahler
c30c137a95 Improve display of hint about --fulltrace with KeyboardInterrupt
- display the location first
- display hint about --fulltrace in parenthesis
2018-06-07 23:50:24 +02:00
Anthony Sottile
18157659ca Merge pull request #3544 from asottile/correct_changelot
Correct issue number in changelog
2018-06-06 14:06:13 -07:00
Anthony Sottile
60b34ec7ec Correct issue number in changelog 2018-06-06 13:27:59 -07:00
Bruno Oliveira
60273d7e99 Merge pull request #3541 from samueldg/docs/fix-plugin-list
Fix typo in plugin list example
2018-06-05 20:28:24 -03:00
Samuel Dion-Girardeau
d694290626 Fix typo in plugin list example 2018-06-05 18:27:59 -04:00
Bruno Oliveira
56b3a9eb8f Merge pull request #3534 from nicoddemus/release-3.6.1
Release 3.6.1
2018-06-05 14:45:00 -03:00
Ronny Pfannschmidt
464117b472 fix imports in tests 2018-06-05 10:20:36 +02:00
Ronny Pfannschmidt
1459cbe01f put config path finding and exceptions into own modules 2018-06-05 10:07:02 +02:00
Ronny Pfannschmidt
c9df77cbd6 move argument parser to own file 2018-06-05 09:55:28 +02:00
Ronny Pfannschmidt
026cd36237 make builtin plugins a list 2018-06-05 09:40:50 +02:00
Ronny Pfannschmidt
bc2247219f turn config into package
this prepares the splitting
2018-06-05 09:08:53 +02:00
Bruno Oliveira
2a79f58ba3 Fix linting 2018-06-04 22:14:04 -03:00
Bruno Oliveira
66ec0a50b6 Preparing release version 3.6.1 2018-06-05 01:11:27 +00:00
Bruno Oliveira
c58b67c540 Configure towncrier to use src directory 2018-06-05 01:10:36 +00:00
Bruno Oliveira
cc793a8575 Merge pull request #3522 from NiklasMM/fix/3461_factory-fixture-doc
Add factory fixture example to documentation.
2018-06-04 22:09:50 -03:00
Ronny Pfannschmidt
7f5cb46835 Merge pull request #3531 from hroncok/370b5
Module docstrings in 3.7 are not part of Module node anymore
2018-06-05 01:16:14 +02:00
Ronny Pfannschmidt
a7f9e8382b Merge pull request #3529 from asottile/unpy25
Remove some python2.5 compatibility code
2018-06-04 16:25:00 +02:00
Miro Hrončok
39ebdab1bc DRY in TestAssertionRewrite 2018-06-04 14:03:13 +02:00
Miro Hrončok
9a6fa33c69 Module docstrings in 3.7 are not part of Module node anymore
Fixes https://github.com/pytest-dev/pytest/issues/3530
2018-06-04 13:58:35 +02:00
Anthony Sottile
2f6555dfd3 Add changelog entry 2018-06-03 13:12:49 -07:00
Anthony Sottile
ff19f273a9 Use six to import queue instead of py.builtin._tryimport 2018-06-03 13:12:49 -07:00
Anthony Sottile
04f08b67a4 __code__ and __self__ are attributes in python2.6+ 2018-06-03 13:12:46 -07:00
Anthony Sottile
3d0717813a bytes() is a builtin in python2.6+ 2018-06-03 11:54:36 -07:00
Ronny Pfannschmidt
d609b635f4 Merge pull request #3528 from asottile/blacken_docs
blacken docs
2018-06-03 18:40:11 +02:00
Anthony Sottile
0f2d7dc73c blacken docs 2018-06-03 07:58:46 -07:00
Anthony Sottile
5c878001ea Manual docs changes so syntax is parseable 2018-06-02 20:19:17 -07:00
Bruno Oliveira
4dc5f7897d Fix typo in marks.rst 2018-05-31 12:43:48 -03:00
Niklas Meinzer
08de3dad33 Add factory fixture example to documentation.
Close https://github.com/pytest-dev/pytest/issues/3461
2018-05-31 11:21:10 +02:00
Bruno Oliveira
5748c5ce8f Fix default cache directory to .pytest_cache 2018-05-30 08:24:10 -03:00
Bruno Oliveira
b6a302d0a8 Merge pull request #3516 from RonnyPfannschmidt/travis-optimize
enable pip/pre-commit caching on travis and appveyor
2018-05-27 12:51:51 -03:00
Ronny Pfannschmidt
130f76f66e enable pip/pre-commit caching on travis and appveyor 2018-05-27 13:05:10 +02:00
Bruno Oliveira
075faa5e2b Merge pull request #3513 from RonnyPfannschmidt/src-layout
switch to src layout
2018-05-26 10:36:23 -03:00
Ronny Pfannschmidt
eaa882f3d5 switch to src layout 2018-05-26 09:10:38 +02:00
Ronny Pfannschmidt
ee6c54904b Merge pull request #3512 from asottile/rst_via_pre_commit
Call rst-lint directly with pre-commit
2018-05-26 08:09:11 +02:00
Anthony Sottile
2a8463c745 Call rst-lint directly with pre-commit 2018-05-25 18:16:54 -07:00
Bruno Oliveira
1d451c786d Merge pull request #3509 from nicoddemus/marshal-3503
Write rewritten code using file.write(marshal.dumps())
2018-05-25 21:24:45 -03:00
Bruno Oliveira
a36bab448f Merge pull request #3485 from RonnyPfannschmidt/pre-commit-hook
adapt Pre commit hook and black
2018-05-25 19:03:45 -03:00
Bruno Oliveira
437a6fb224 Add "black code-style" badge 2018-05-25 18:23:59 -03:00
Bruno Oliveira
1b16d649f9 Fix formatting of merged files 2018-05-25 18:21:48 -03:00
Bruno Oliveira
6f8547cc1a Merge branch 'master' into pre-commit-hook 2018-05-25 18:14:43 -03:00
Bruno Oliveira
b5a94d8e6c Write rewritten code using file.write(marshal.dumps())
This works around the fact that some libraries might monkey patch
the file object, so the previous approach of marshal.dump(co, file)
breaks because file is not a built-in file object anymore.

Fix #3503
2018-05-25 17:24:23 -03:00
Bruno Oliveira
65bc43dc56 Merge pull request #3505 from Avira/tox-lowercase
Fix tox spelling (all lower case).
2018-05-25 17:07:12 -03:00
Oliver Bestwalter
c55635d42a Fix tox spelling (all lower case). 2018-05-25 09:54:03 +02:00
Bruno Oliveira
93fdad28aa Merge pull request #3499 from jeffreyrack/3491-junit-logging
3491 - Fixed a bug where stdout and stderr were logged twice by junitxml for xfail tests.
2018-05-24 20:50:16 -03:00
Bruno Oliveira
48215fdcb9 Merge pull request #3500 from RonnyPfannschmidt/fix-3498-unittest-marks
fix #3498 - correctly consider marks on unittest classes
2018-05-24 13:51:17 -03:00
Ronny Pfannschmidt
5a6a580765 clean env for the linting stage 2018-05-24 14:18:34 +02:00
Ronny Pfannschmidt
df17bb2bd3 switch linting tox env to use pre-commit, clean out travis linting env as unneeded 2018-05-24 14:17:09 +02:00
Ronny Pfannschmidt
6eb7af5a4e experimentally add pre-commit for linting in travis 2018-05-24 13:51:15 +02:00
Bruno Oliveira
bc25d51b2f Re-word changelog 2018-05-24 07:27:40 -03:00
Ronny Pfannschmidt
9ed1289b01 run black on test_source_multiline_block.py 2018-05-24 12:12:12 +02:00
Ronny Pfannschmidt
5a0c9aca63 correctly instantiate fixtureinfo for unittest tests, fixes #3498 2018-05-24 10:29:42 +02:00
Ronny Pfannschmidt
da2c2e8492 more debugging for #3498 2018-05-24 09:58:36 +02:00
Ronny Pfannschmidt
74cfdc5feb add failing test for #3498 2018-05-24 07:30:38 +02:00
Jeffrey Rackauckas
b4e0265622 Removed whitespace from empty line. 2018-05-23 20:15:28 -07:00
Jeffrey Rackauckas
210ad22dbe Updating changelog text 2018-05-23 19:43:06 -07:00
Jeffrey Rackauckas
6c519b1280 Fixed a bug where stdout and stderr were logged twice by junitxml. 2018-05-23 19:34:45 -07:00
Ronny Pfannschmidt
57a55cd0a3 restore formatting of test_source_multiline_block 2018-05-23 20:26:13 +02:00
Ronny Pfannschmidt
d4bf2ff8f5 fix test_source 2018-05-23 18:22:18 +02:00
Ronny Pfannschmidt
3e08c4ee64 sort out flake8 issues and unicode name usage 2018-05-23 18:12:04 +02:00
Ronny Pfannschmidt
703e4b11ba run black 2018-05-23 16:48:46 +02:00
Ronny Pfannschmidt
3e1590bcfc sort out pyupgrade fallout 2018-05-23 16:45:58 +02:00
Ronny Pfannschmidt
86fc31db8d apply most other hooks and opt out of black reformating 2018-05-23 16:45:58 +02:00
Ronny Pfannschmidt
b60376dc28 add pre-commit to CONTRIBUTING.txt 2018-05-23 16:45:23 +02:00
Ronny Pfannschmidt
3b9e063fe8 fix line endings 2018-05-23 16:45:23 +02:00
Ronny Pfannschmidt
9aacb4635e run pyupgrade 2018-05-23 16:45:09 +02:00
Ronny Pfannschmidt
d41119ed04 add the config 2018-05-23 16:45:09 +02:00
Bruno Oliveira
afde9f07f7 Update number of tests in email template 2018-05-23 08:06:27 -03:00
Bruno Oliveira
b4cd010d71 Merge pull request #3495 from nicoddemus/release-3.6.0
Release 3.6.0
2018-05-23 07:51:30 -03:00
Bruno Oliveira
45e7703133 Move mark revamp note to the top of the CHANGELOG 2018-05-22 21:12:51 -03:00
Bruno Oliveira
d70e910b65 Preparing release version 3.6.0 2018-05-23 00:07:48 +00:00
Bruno Oliveira
c55db1faac Merge remote-tracking branch 'upstream/master' into release-3.6.0 2018-05-23 00:03:58 +00:00
Bruno Oliveira
16583a6d43 Add missing libs to tasks/requirements.txt 2018-05-23 00:03:47 +00:00
Bruno Oliveira
7985eff5b4 Merge pull request #3497 from hroncok/approx_compat_import
Import Mapping and Sequence from compat in python_api::approx
2018-05-22 20:57:29 -03:00
Miro Hrončok
5072226f69 Import Mapping and Sequence from compat in python_api::approx
Related to https://github.com/pytest-dev/pytest/issues/3339

Fixes a DeprecationWarning on Python 3.7

Adds Mapping to compat
2018-05-22 22:25:15 +02:00
Ronny Pfannschmidt
6c8d46d8ea Merge pull request #3487 from tgoodlet/detect_pytest_hook_prefix
Detect `pytest_` prefixed hooks
2018-05-22 21:36:58 +02:00
Bruno Oliveira
7d0c9837ce Merge pull request #3459 from RonnyPfannschmidt/mark-iter-name-filter
introduce name filtering for marker iteration again
2018-05-21 13:24:39 -03:00
Bruno Oliveira
8e17e32253 Merge pull request #3492 from timhughes/patch-1
fix typo in docs
2018-05-20 15:51:03 -03:00
Tim Hughes
f0b855369c fix typo 2018-05-20 19:14:06 +01:00
Ronny Pfannschmidt
4aa7ebaf52 Merge pull request #3490 from nicoddemus/merge-master-into-features
Merge master into features
2018-05-19 11:36:11 +02:00
Tyler Goodlet
486b786cb2 Add trivial changelog entry 2018-05-18 12:02:50 -04:00
Bruno Oliveira
674879976f Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-05-18 12:30:08 -03:00
Tyler Goodlet
d4065a9166 Detect pytest_ prefixed hooks
`pluggy` is deprecating the `implprefix` argument in the next major
release so implement this detection in our derived plugin manager.

Relates to pytest-dev/pluggy#145
2018-05-17 20:38:54 -04:00
Bruno Oliveira
e7f75f69f2 Small grammar fix in CHANGELOG 2018-05-17 21:20:43 -03:00
Bruno Oliveira
5be85a1f55 Merge changelog marks refactoring changelog entries as discussed in review 2018-05-17 21:18:12 -03:00
Bruno Oliveira
bb626fe8a7 Fix typo in mark.rst 2018-05-17 16:06:00 -03:00
Ronny Pfannschmidt
45faaeca7a Merge pull request #3480 from nicoddemus/deprecated-deadlne-hypothesis
Attempt to fix CI problems related to Hypothesis
2018-05-17 20:18:27 +02:00
Bruno Oliveira
11fb384efb Fix link to skipif tutorial in ref docs 2018-05-17 10:15:47 -03:00
Bruno Oliveira
5edad01d4e Merge pull request #3476 from avirlrma/master
change doc copyright year to range and auto update year
2018-05-16 17:53:23 -03:00
Bruno Oliveira
f5361a302c Use a more recent hypothesis version on CI 2018-05-16 07:35:02 -03:00
Bruno Oliveira
94e62dfc50 Increase hypothesis deadline
The value is pretty close to the new default that will come out in
future hypothesis versions, which is generating a deprecation error
on CI.

Using a loose deadline because CI boxes are not reliable in how much
CPU power they have available
2018-05-16 07:34:53 -03:00
Bruno Oliveira
afe4800daf Fix deprecation notice in Node.get_marker 2018-05-15 21:47:40 -03:00
Bruno Oliveira
2cd159e8c5 Add section on how to update marks and add ref to the deprecation notice 2018-05-15 21:35:27 -03:00
Bruno Oliveira
718ba83600 Small adjustment to the CHANGELOG 2018-05-15 21:02:05 -03:00
Bruno Oliveira
1b2f4f4483 Small rewording to the CHANGELOG 2018-05-15 21:01:37 -03:00
Bruno Oliveira
f68bab06b4 Reword the changelog 2018-05-15 18:24:14 -03:00
Bruno Oliveira
a4425cb4af Merge pull request #3469 from scop/dropthedot
#dropthedot
2018-05-15 08:00:28 -03:00
Bruno Oliveira
01d2d81d1f Merge pull request #3468 from scop/spelling
Spelling and grammar fixes
2018-05-15 07:59:56 -03:00
aviral1701
f14e097635 added changelog and added my name to the authors 2018-05-15 12:54:48 +05:30
aviral1701
a59f677d93 change doc copyright year to range and auto update year 2018-05-15 12:48:04 +05:30
Bruno Oliveira
36614b0a3d Fix formatting in CHANGELOG entry 2018-05-14 09:56:36 -03:00
Ville Skyttä
b4370c08b9 #dropthedot 2018-05-13 12:09:47 +02:00
Ville Skyttä
aa51fcb2b6 Spelling and grammar fixes 2018-05-13 12:06:09 +02:00
Ronny Pfannschmidt
4914135fdf introduce name filtering for marker iteration again 2018-05-11 21:48:15 +02:00
Ronny Pfannschmidt
84b37e1b57 Merge pull request #3452 from nicoddemus/fix-flaky-xdist-test
Attempt to fix flaky test on Python 2
2018-05-05 20:18:06 +02:00
Bruno Oliveira
fa76a5c8fe Attempt to fix flaky test on Python 2
This test sometimes fails on AppVeyor with:

```
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <listiterator object at 0x0549DC50>
    leaked_types = sum(1 for _ in gc.garbage
>                   if 'PseudoFixtureDef' in str(_))
E   UnicodeEncodeError: 'ascii' codec can't encode character u'\u263a' in position 23: ordinal not in range(128)
test_request_garbage.py:19: UnicodeEncodeError
====================== 1 passed, 1 error in 1.39 seconds ======================
```

Use our internal "safe_repr" function to handle Encode errors: who knows
what objects are in garbage after all.
2018-05-04 17:56:51 -03:00
Ronny Pfannschmidt
27651f4032 Merge pull request #3444 from nicoddemus/escape-whitespace-diffs
Escape whitespace only strings when diffing them on failed assertions
2018-05-04 18:14:35 +02:00
Bruno Oliveira
413b1aa4e9 Rename internal function as suggested during review 2018-05-04 11:08:35 -03:00
Bruno Oliveira
dca77b2273 Escape whitespace only strings when diffing them on failed assertions
Fix #3443
2018-05-03 20:38:00 -03:00
Bruno Oliveira
35f53a7353 Merge pull request #3442 from RonnyPfannschmidt/fix-3441-markexpr-markstorage
Fix #3441 let mark expressions be populated from the modern marker storage
2018-05-03 19:27:07 -03:00
Ronny Pfannschmidt
e6a86e0f4c add tests for #3441 2018-05-03 17:33:59 +02:00
Bruno Oliveira
b03b387861 Merge pull request #3436 from brianmaissy/feature/enter_pdb_on_keyboard_interrupt
--pdb treats KeyboardInterrupt as exception
2018-05-03 12:20:43 -03:00
Ronny Pfannschmidt
a5cf55dd4a fix test_mark_option_custom - it used the legacy keyword storage for addign markers 2018-05-03 16:33:16 +02:00
Ronny Pfannschmidt
63ef46dd91 fix #3441 - use iter-marks to populate markexpr namespace 2018-05-03 16:28:47 +02:00
Ronny Pfannschmidt
7834b45002 Merge pull request #3437 from nicoddemus/mark-changelog
Improve changelog note about markers
2018-05-02 06:45:39 +02:00
Bruno Oliveira
ccaa979f27 Improve changelog note about markers
Also changed the title in the docs because the previous title had
the same level as the title, making it appear in a separate entry
in `contents.rst`
2018-05-01 19:27:53 -03:00
Bruno Oliveira
1a880be85b Remove unused import to fix linting 2018-05-01 19:08:29 -03:00
Brian Maissy
c258fe1459 --pdb treats KeyboardInterrupt as exception 2018-05-02 00:58:35 +03:00
Ronny Pfannschmidt
08aed1a6bf Merge pull request #3433 from nicoddemus/conda-forge-badge
Use conda-forge badge instead of anaconda's
2018-04-27 16:11:58 +02:00
Bruno Oliveira
b49e9191ac Use conda-forge badge instead of anaconda's
Just noticed that conda-forge has its own badge so let's use that
2018-04-27 10:23:28 -03:00
Bruno Oliveira
febccae037 Merge pull request #3431 from jdufresne/pypi
Update all pypi.python.org URLs to pypi.org
2018-04-26 13:15:46 -03:00
Jon Dufresne
d2bf0bf9bb Update all pypi.python.org URLs to pypi.org
For details on the new PyPI, see the blog post:

https://pythoninsider.blogspot.ca/2018/04/new-pypi-launched-legacy-pypi-shutting.html
2018-04-26 06:49:33 -07:00
Ronny Pfannschmidt
5ba0663827 Merge pull request #3428 from nicoddemus/merge-master-into-features
Merge master into features
2018-04-25 14:04:41 +02:00
Bruno Oliveira
63368e07ea Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-04-24 21:26:45 -03:00
Bruno Oliveira
0b2b73c36a Remove CHANGELOG entries left by old bug in towncrier 2018-04-24 21:25:13 -03:00
Bruno Oliveira
69b1c2d4f6 Merge pull request #3424 from nicoddemus/release-3.5.1
Preparing release version 3.5.1
2018-04-24 19:30:54 -03:00
Bruno Oliveira
4a92011e6e Fix note about importing from collections.abc 2018-04-24 07:06:52 -03:00
Ronny Pfannschmidt
6e62fc98ff Merge pull request #2849 from ApaDoctor/disable-repeated-fixture
provide error fixture applied to the same func
2018-04-24 06:36:54 +02:00
Bruno Oliveira
132fb61eba Merge remote-tracking branch 'upstream/features' into ApaDoctor/disable-repeated-fixture 2018-04-23 22:24:53 -03:00
Bruno Oliveira
03850cf962 Add test for applying fixture twice
Fix #2334
2018-04-23 22:17:46 -03:00
Bruno Oliveira
f05230c679 Move #3221 to trivial section in the CHANGELOG 2018-04-23 19:27:07 -03:00
Bruno Oliveira
d61a7670a1 Merge pull request #3422 from rachel1792/master
updated doc to delete deprecated hook: Issue #3417
2018-04-23 19:24:52 -03:00
Bruno Oliveira
8d56641590 Preparing release version 3.5.1 2018-04-23 22:24:21 +00:00
Bruno Oliveira
2a480c59ae Merge pull request #3367 from brianmaissy/feature/indicative_error_for_parametrize_with_default_argument
added indicative error when parametrizing an argument with a default …
2018-04-23 11:04:36 -03:00
Rachel Kogan
6ea4c12da7 updated doc to delete deprecated hook 2018-04-22 21:56:18 -04:00
Bruno Oliveira
f0084608cc Merge pull request #3407 from rachel1792/master
Fix typo in caplog fixture documentation: Issue #3406
2018-04-20 17:41:04 -03:00
Bruno Oliveira
cefeba33ef Update changelog formatting 2018-04-20 17:40:19 -03:00
Bruno Oliveira
3318e53d01 Merge pull request #3382 from feuillemorte/3290-improve-monkeypatch
#3290 improve monkeypatch
2018-04-19 17:05:52 -03:00
Ronny Pfannschmidt
1cc79ffc10 Merge pull request #3408 from MarSoft/patch-2
Fix typo in the comment
2018-04-19 09:21:11 +02:00
Семён Марьясин
d8015764e6 Fix typo in the comment 2018-04-18 12:47:52 +03:00
Rachel Kogan
48c99f62e3 add changelog 2018-04-17 16:24:32 -04:00
Rachel Kogan
8ff8a82c51 Merge branch 'master' of github.com:pytest-dev/pytest 2018-04-17 16:21:04 -04:00
Rachel Kogan
bb8984f5ed fix error in caplog docs. 2018-04-17 16:17:29 -04:00
Bruno Oliveira
159cd39777 Merge pull request #3401 from kohr-h/underscore_fixtures
Mention omission of fixtures with leading '_', closes #3398
2018-04-16 13:25:10 -03:00
Brian Maissy
857098fe0f added indicative error when parametrizing an argument with a default value 2018-04-15 20:52:57 +03:00
feuillemorte
283ac8bbf4 #3290 Fix doc 2018-04-14 21:06:58 +03:00
Holger Kohr
6626d2aef9 Mention omission of fixtures with leading '_', closes #3398 2018-04-14 11:04:00 +02:00
feuillemorte
ba7cad3962 #3290 Fix comments 2018-04-13 16:00:07 +03:00
Ronny Pfannschmidt
36f6687b70 Merge pull request #3397 from darrenburns/patch-2
Fix some mistakes in contributing.rst
2018-04-13 13:20:31 +02:00
Darren Burns
86def48b25 Fix some mistakes in contributing.rst 2018-04-13 11:33:58 +01:00
Bruno Oliveira
0024b71f1c Merge pull request #3395 from darrenburns/patch-1
Update CONTRIBUTING.rst
2018-04-12 18:42:33 -03:00
Ronny Pfannschmidt
17a43dc4a5 firther enhance the links in contributing.rst 2018-04-12 22:06:06 +02:00
Darren Burns
958f146125 Update CONTRIBUTING.rst
Fixes a broken link in CONTRIBUTING.rst
2018-04-12 20:54:32 +01:00
Ronny Pfannschmidt
13a6f63cd9 Merge pull request #3390 from nicoddemus/atomic-pyc-writes
Attempt to solve race-condition which corrupts .pyc files on Windows
2018-04-12 13:57:39 +02:00
Bruno Oliveira
aa95a425d7 Attempt to solve race-condition which corrupts .pyc files on Windows
This uses of the `atomicwrites` library.

This is very hard to create a reliable test for.

Fix #3008
2018-04-12 08:19:28 -03:00
Bruno Oliveira
015626ce69 Merge pull request #3384 from nicoddemus/leak-frame
Reset reference to failed test frame before each test executes
2018-04-12 07:53:34 -03:00
Ronny Pfannschmidt
f9a908abb8 Merge pull request #3388 from nicoddemus/simplify-tox
Simplify tox to avoid repetition
2018-04-12 11:32:48 +02:00
Ronny Pfannschmidt
160c309371 Merge pull request #3391 from nicoddemus/project-urls
Add additional project urls to setup.py
2018-04-12 08:54:12 +02:00
Ronny Pfannschmidt
f79b0324fe Merge pull request #3387 from nicoddemus/merge-master-into-features
Merge master into features
2018-04-12 08:39:22 +02:00
Bruno Oliveira
37ee4fbc48 Add additional project urls to setup.py
According to:

https://packaging.python.org/tutorials/distributing-packages/#project-urls

Those URLs are displayed in the project page in Warehouse (new PyPI).
2018-04-11 23:46:17 -03:00
Bruno Oliveira
888fcbc4b4 Simplify tox to avoid repetition
Also took the opportunity to:

* Use more cores for py*-xdist environments
* Update freeze test to use py36
2018-04-11 18:30:15 -03:00
Bruno Oliveira
10a7160549 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-04-11 18:07:47 -03:00
feuillemorte
a4daac7eb0 #3290 Fix doc 2018-04-11 12:46:02 +03:00
feuillemorte
97be076f29 #3290 Added changelog file 2018-04-11 12:45:46 +03:00
feuillemorte
3d60f955f0 #3290 Added test 2018-04-11 12:45:37 +03:00
feuillemorte
659c044372 #3290 Improved monkeypatch to support some form of with statement 2018-04-11 12:45:26 +03:00
Bruno Oliveira
6e8e3c967a Add changelog entry for #2798 2018-04-10 21:09:57 -03:00
Bruno Oliveira
78c900448e Add acceptance test for #2798 2018-04-10 21:04:30 -03:00
Ronny Pfannschmidt
372bcdba0c Merge pull request #3380 from nicoddemus/marks-fixes
Add the list of issues fixed by the new marker implementation to the docs
2018-04-10 14:33:58 +02:00
Bruno Oliveira
d1ba19acad Add the list of issues fixed by the new marker implementation to the docs
This will help make users more understanding if their code breaks under the
new implementation.
2018-04-10 08:00:32 -03:00
Ronny Pfannschmidt
2241c98b18 Merge pull request #3331 from tonybaloney/breakpoint_support
Support for the new builtin breakpoint function in Python 3.7
2018-04-10 07:15:29 +02:00
Bruno Oliveira
715337011b Merge pull request #3317 from RonnyPfannschmidt/marker-pristine-node-storage
introduce a distinct searchable non-broken storage for markers
2018-04-09 19:40:12 -03:00
Bruno Oliveira
e012dbe346 Merge pull request #3373 from backbord/master
Fix issue #3372
2018-04-06 22:10:57 -03:00
Tim Strazny
5bd8561016 linting: unfortunate dedent be gone. 2018-04-06 17:36:35 +02:00
Tim Strazny
846d91fb95 Follow Ronny's advice and use `type in base_type`. 2018-04-06 16:23:04 +02:00
Tim Strazny
0cd74dc324 Ensure object is class before calling issubclass. 2018-04-06 14:40:30 +02:00
Tim Strazny
ec2d8223cf Fix issue #3372 2018-04-06 14:16:12 +02:00
Ronny Pfannschmidt
4df8f2b153 fix doc build, use noindex on the mark reference 2018-04-06 08:13:28 +02:00
Ronny Pfannschmidt
5d4fe87b72 Merge pull request #3371 from nicoddemus/remove-labels-descriptions
Remove label descriptions from development guide
2018-04-06 07:39:15 +02:00
Bruno Oliveira
f17dfa4292 Remove label descriptions from development guide
The descriptions have been moved directly to GitHub's new label description
slot.
2018-04-05 20:55:08 -03:00
Bruno Oliveira
ab91771efc Merge pull request #3370 from dchudz/patch-1
no-capture in sample code demo'ing plugin
2018-04-05 20:25:04 -03:00
Bruno Oliveira
ef34de960c Merge pull request #3360 from RonnyPfannschmidt/xml_property_yay
record_property is no longer experimental
2018-04-05 20:03:22 -03:00
David Chudzicki
db24723b61 no-capture in sample code demo'ing plugin 2018-04-05 20:34:26 +02:00
Bruno Oliveira
e534cc81a3 Fix typos in docs 2018-04-05 14:45:30 -03:00
Ronny Pfannschmidt
3582e1f6be include more detail on the marker api issues 2018-04-05 18:46:33 +02:00
Ronny Pfannschmidt
a8ad89cdb3 fix documentation references 2018-04-05 18:39:57 +02:00
Bruno Oliveira
48bcc3419f Reword the docs on markers a bit 2018-04-05 12:39:21 -03:00
Ronny Pfannschmidt
1fcadeb2ce extend marker docs with reasons on marker iteration 2018-04-05 15:30:31 +02:00
Ronny Pfannschmidt
2018cf12b1 fix the record_property test 2018-04-05 14:05:26 +02:00
Bruno Oliveira
ba407b5eb6 Clear sys.last_* attributes before running an item
Otherwise we will keep the last failed exception around forever

Related to #2798
2018-04-04 20:36:07 -03:00
Ronny Pfannschmidt
ad0b4330e7 Merge pull request #3364 from sscherfke/more-itertools
Use correct spelling for "more-itertools"
2018-04-03 21:30:42 +02:00
Stefan Scherfke
9aa2a83785 Use correct spelling for "more-itertools" 2018-04-03 16:48:32 +02:00
Bruno Oliveira
0762666bd1 Remove unused pytestPDB import 2018-04-03 08:58:40 -03:00
Ronny Pfannschmidt
7c0c91a7a2 fix record_property test 2018-04-03 08:00:57 +02:00
Ronny Pfannschmidt
9326759a63 Merge pull request #3357 from nicoddemus/session-hooks-ref
Add reference docs for pytest_sessionstart/finish and update their docstrings
2018-04-03 07:08:47 +02:00
Anthony Shaw
4d847593b3 remove a test that would fail because pytest is being used to test itself 2018-04-03 10:40:56 +10:00
Bruno Oliveira
9a62ebf490 Merge pull request #3355 from irmen/py37deprfixes
change collections.abc import to fix deprecation warnings on python 3.7
2018-04-02 20:31:26 -03:00
Ronny Pfannschmidt
211f3c47b5 record_property is no longer experimental 2018-04-01 15:39:43 +02:00
Ronny Pfannschmidt
a2974dd067 fix doc building 2018-03-30 16:48:27 +02:00
Floris Bruynooghe
77128ee2dc Merge pull request #3356 from nicoddemus/remove-stale-changelog-entries
Remove stale CHANGELOG entries
2018-03-30 14:19:38 +02:00
Ronny Pfannschmidt
7454a381e2 update configuration examples to new mark api 2018-03-30 08:36:58 +02:00
Ronny Pfannschmidt
e4a52c1795 prevent doubleing of function level marks 2018-03-30 08:19:45 +02:00
Ronny Pfannschmidt
802da781c6 fix method reference to iter_markers in warning 2018-03-30 07:50:12 +02:00
Bruno Oliveira
3fc2c94b5e Switch imports based on python versions, my bad 2018-03-29 23:15:03 -03:00
Bruno Oliveira
daf1de0fed Add reference docs for pytest_sessionstart/finish and update their docstrings 2018-03-29 19:48:48 -03:00
Bruno Oliveira
e5eba8419a Remove stale CHANGELOG entries
Those were not removed in the last release because of a bug in
towncrier; I was about to fallback to don't use the .rst extension
for entries but just noticed that this was fixed in towncrier 17.8.0
so it should no longer be a problem.
2018-03-29 19:21:59 -03:00
Bruno Oliveira
6a81aae4f2 Move compatibility imports to compat.py and fix linting 2018-03-29 19:05:15 -03:00
Bruno Oliveira
8ca9321940 Move compatibility imports to compat.py and fix linting 2018-03-29 19:02:35 -03:00
Irmen de Jong
faded25ee8 chage collections.abc import to fix deprecation warnings on python 3.7 2018-03-29 20:02:00 +02:00
Ronny Pfannschmidt
dbb1b5a227 remove NodeMarkers, turn own_markers into a list and use iter_markers api exclusively 2018-03-29 18:24:10 +02:00
Ronny Pfannschmidt
8805036fd8 add node iteration apis
TODO: add tests
2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
ee51fa5881 add api to iterate over all marerks of a node 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
2cb7e725ce document the hack used to avoid duplicate markers due Instance collectors 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
02315c0489 remove unnecessary of in the code figuring the fixture names 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
a92a51b01b clarify find_markers return value 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
159ea9b7c0 turn Markinfo into atts clsas, and return correct instances of it from node.get_marker 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
775fb96ac3 first changelog entry 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
ced1316bc8 add docstrings for nodemarkers 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
5e56e9b4f6 refactor node markers, remove need to be aware of nodes 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
2d06ae0f65 base metafunc fixtureinfo on the functiondefinition to caputure its marks 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
99015bfc86 fix most of metafunc tests by mocking 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
180ae09202 deprecate markinfo and fix up most marker scoping access while completely breaking metafunc testing 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
e8feee0612 fix up the mark evaluator validity check 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
f1a1695aaa enable deep merging test - new structure fixed it 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
2707221559 port mark evaluation to the new storage and fix a bug in evaluation 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
360d608da4 introduce a own storage for markers 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt
f1c9efc358 Merge pull request #3353 from nicoddemus/fixture-param-marks-docs
Add docs about using pytest.param in parametrized fixtures
2018-03-29 10:57:28 +02:00
Bruno Oliveira
804392e5f2 Fix tests that check that breakpoint function is configured/restored
* Execute pytest in a subprocess in cases of tests which change global
  state
* Parametrize with --pdb and without the flag
2018-03-28 20:19:28 -03:00
Bruno Oliveira
0a3cd881f6 Add docs about using pytest.param in parametrized fixtures 2018-03-28 19:35:10 -03:00
Anthony Shaw
09e5a226dc add broken test 2018-03-29 09:03:20 +11:00
Ronny Pfannschmidt
2efaf39ed8 Merge pull request #3349 from jeffreyrack/3348-unknown-argument
3348: raise error on unknown arguments to raises
2018-03-28 21:45:59 +02:00
Bruno Oliveira
7656581302 Update changelog formatting 2018-03-28 07:31:26 -03:00
Bruno Oliveira
bfe773bfc8 Use shorter 'if kwargs' check as requested during review 2018-03-28 07:30:14 -03:00
Jeffrey Rackauckas
a5d9fbe2b0 Change pytest.raises to use match instead of matches 2018-03-27 20:24:15 -07:00
Jeffrey Rackauckas
34afded06d Update pytest.raises to raise a TypeError when an invalid keyword argument is passed. 2018-03-27 19:57:15 -07:00
Anthony Shaw
3998b70ff6 add test for custom environment variable 2018-03-28 09:02:37 +11:00
Bruno Oliveira
060f047a7e Use full link in CHANGELOG
Our rst-linter unfortunately doesn't accept `ref` directives in the CHANGELOG files
2018-03-27 18:35:47 -03:00
Bruno Oliveira
2962c7367c Merge pull request #3307 from KKoukiou/rhv-qe-fix
logging.py: Don't change log level of the root logger to bigger numeric value
2018-03-27 18:03:22 -03:00
Bruno Oliveira
0a4200bbb3 Improve docs formatting 2018-03-27 07:40:52 -03:00
Anthony Shaw
b45006e9a3 fix syntax 2018-03-27 21:26:55 +11:00
Anthony Shaw
671ab5a36c update documentation for new feature 2018-03-27 21:02:43 +11:00
Anthony Shaw
f1f4c8c104 updates for code review recommendations 2018-03-27 17:38:17 +11:00
Bruno Oliveira
6cfed00a61 Tweak changelog entry 2018-03-26 20:48:05 -03:00
Bruno Oliveira
ff3d13ed0e Update typo in fixture.rst 2018-03-26 11:20:33 -03:00
Katerina Koukiou
d895f5d6fc logging.py: Don't change log level of the root logger to bigger numeric value 2018-03-26 10:11:49 +02:00
Anthony Shaw
e97bd87ee2 fix assertion when hypothesis is installed (which is should be for developing in pytest) 2018-03-23 16:24:15 +11:00
Anthony Shaw
242fb7852b linting and removed double test 2018-03-23 15:39:34 +11:00
Anthony Shaw
1ec99132e6 add myself to authors 2018-03-23 15:31:57 +11:00
Anthony Shaw
dcbba381d4 add changelog entry 2018-03-23 15:31:16 +11:00
Anthony Shaw
db581eabcb add tests to validate that --pdbcls custom debugger classes will be called when breakpoint() is used 2018-03-23 15:30:05 +11:00
Anthony Shaw
0e83e4f292 conditional for resetting of sys.breakpointhook for cleanup where breakpoint() not supported 2018-03-23 14:26:16 +11:00
Anthony Shaw
21ada0fa23 add check for support of breakpoint() and use Custom Pdb class when system default is set 2018-03-23 14:20:10 +11:00
Anthony Shaw
a1ff758d0d "Added acceptance tests for configuration of sys.breakpointhook and resetting back when system default (pdb) is used"" 2018-03-23 14:18:56 +11:00
Bruno Oliveira
ed118d7f20 Merge remote-tracking branch 'upstream/features' 2018-03-22 21:06:09 -03:00
Bruno Oliveira
5ecff65285 Merge pull request #3327 from nicoddemus/release-3.5.0
Release 3.5.0
2018-03-22 20:58:15 -03:00
Ronny Pfannschmidt
fc4f769888 Merge pull request #3336 from nicoddemus/filter-warnings-ref-doc
Add missing reference doc for filterwarnings mark
2018-03-22 18:43:17 +01:00
Bruno Oliveira
f78953fd81 Add missing reference doc for filterwarnings mark 2018-03-22 13:02:30 -03:00
Ronny Pfannschmidt
d7d4afea17 Merge pull request #3330 from nicoddemus/remove-custom-flatten
Remove terminal.flatten function in favor of collapse from more_itertools
2018-03-22 14:22:47 +01:00
Anthony Shaw
5a53b9aabb move tests to test_pdb 2018-03-22 20:40:35 +11:00
Anthony Shaw
91d99affb7 assert that custom PDB class is used as breakpoint hook where supported 2018-03-22 17:40:14 +11:00
Anthony Shaw
3bca983a95 add a module global for whether the current runtime supports the builtin breakpoint function 2018-03-22 17:27:28 +11:00
Anthony Shaw
9edcb7edc6 start acceptance testing 2018-03-22 17:25:27 +11:00
Bruno Oliveira
6c2739d1e6 Add CHANGELOG for #3330 2018-03-21 20:23:17 -03:00
Bruno Oliveira
4e717eb626 Remove terminal.flatten function in favor of collapse from more_itertools 2018-03-21 20:20:46 -03:00
Bruno Oliveira
beacecf29b Preparing release version 3.5.0 2018-03-21 20:46:07 +00:00
Bruno Oliveira
b148770066 Fix example in usage.rst 2018-03-21 20:45:28 +00:00
Bruno Oliveira
f3c87a77a7 Merge remote-tracking branch 'upstream/master' into release-3.5.0 2018-03-21 20:39:44 +00:00
Bruno Oliveira
6f95189cf7 Merge pull request #3306 from nicoddemus/2405-scope-fixture-order
Instantiate fixtures by scope order in test function requests
2018-03-21 17:37:05 -03:00
Ronny Pfannschmidt
add5ce0fb8 Merge pull request #3230 from brianmaissy/features
deprecate pytest_plugins in non-top-level conftest
2018-03-21 07:44:34 +01:00
Bruno Oliveira
59e7fd478e Sort fixtures by scope when determining fixture closure
Fix #2405
2018-03-20 20:10:53 -03:00
Bruno Oliveira
9e24b09a9f Use re_match_lines in test_class_ordering
"[1-a]" works fine using fnmatch_lines, but "[a-1]" breaks horribly
inside `re`.
2018-03-20 20:10:52 -03:00
Bruno Oliveira
d03e38941b Merge pull request #3295 from brianmaissy/feature/last-failed-no-failures-behavior
implemented --last-failed-no-failures
2018-03-20 19:17:25 -03:00
Bruno Oliveira
672239b149 Merge pull request #3321 from jeffreyrack/'test_from_base_fix'
3245: Fix tests to not fail when running from base directory
2018-03-20 18:45:56 -03:00
Jeffrey Rackauckas
9b449eee15 Add self to authors 2018-03-18 21:28:20 -07:00
Jeffrey Rackauckas
c1d73bb535 Modifying changelog to reflect new changes for 3245 2018-03-18 21:27:48 -07:00
Jeffrey Rackauckas
a4cf380343 Fix tests to not fail when running from root. 2018-03-18 21:23:39 -07:00
Ronny Pfannschmidt
f61d0525a5 Merge pull request #3318 from nicoddemus/merge-master-into-features
Merge master into features
2018-03-17 09:40:32 +01:00
Kale Kundert
86d6804e60 Merge pull request #3313 from tadeu/approx-array-scalar
Add support for `pytest.approx` comparisons between array and scalar
2018-03-16 23:29:46 -07:00
Bruno Oliveira
1fff81e21d Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-03-16 18:15:28 -03:00
Bruno Oliveira
93847bfeb4 Merge pull request #3315 from pytest-dev/issue/3314
Allow DontReadFromInput to produce iterator without error.
2018-03-16 10:05:54 -03:00
Tadeu Manoel
a754f00ae7 Improve numpy.approx array-scalar comparisons
So that `self.expected` in ApproxNumpy is always a numpy array.
2018-03-16 09:01:18 -03:00
Bruno Oliveira
278d8ac74e Fix caplog docstring: indentation caused errors during docs build 2018-03-16 00:06:15 -03:00
Bruno Oliveira
17468fc99c Fix caplog docstring: indentation caused errors during docs build 2018-03-16 00:04:28 -03:00
Jason R. Coombs
b66019202e Fix test failure on Python 2. Ref #3314. 2018-03-15 21:33:58 -04:00
Jason R. Coombs
965a030564 Add changelog. Ref #3314. 2018-03-15 21:31:12 -04:00
Jason R. Coombs
2f47624b19 Allow DontReadFromInput to produce iterator without error. Fixes #3314. 2018-03-15 21:26:40 -04:00
Jason R. Coombs
3c3fc3bb9d Add test capturing new expectation. Ref #3314. 2018-03-15 21:25:50 -04:00
Tadeu Manoel
42c84f4f30 Add fixes to numpy.approx array-scalar comparisons (from PR suggestions) 2018-03-15 13:41:58 -03:00
Bruno Oliveira
fbcf1a90c9 Merge pull request #3193 from pytest-dev/ref-docs
Reference docs
2018-03-15 12:04:34 -03:00
Tadeu Manoel
97f9a8bfdf Add fixes to make numpy.approx array-scalar comparisons work with older numpy versions 2018-03-14 17:10:35 -03:00
Tadeu Manoel
161d4e5fe4 Add support for pytest.approx comparisons between scalar and array (inverted order) 2018-03-14 16:29:04 -03:00
Tadeu Manoel
c34dde7a3f Add support for pytest.approx comparisons between array and scalar 2018-03-14 15:47:21 -03:00
Ronny Pfannschmidt
1b535387bf Merge pull request #3309 from tareqalayan/issue-3308
issue #3308: fix example in documentation
2018-03-14 15:52:55 +01:00
Tareq Alayan
7e53f9432c issue #3308: fix example in documentation
https://github.com/pytest-dev/pytest/issues/3308
2018-03-14 15:44:43 +02:00
Ronny Pfannschmidt
b2b629f462 Merge pull request #3305 from nicoddemus/2370-tmpfile-close-py27
Suppress ``IOError`` when closing the temporary file used for capturing streams in Python 2.7
2018-03-14 06:42:06 +01:00
Bruno Oliveira
cbb2c55dea Merge pull request #3304 from RonnyPfannschmidt/cmdoptions-removal
remove CmdOptions since we can use argparse.Namespace()
2018-03-13 17:48:21 -03:00
Bruno Oliveira
9517c3a2aa Suppress `IOError` when closing the temporary file used for capturing streams in Python 2.7.
Fix #2370
2018-03-13 17:41:42 -03:00
Bruno Oliveira
4175ed8b43 Merge pull request #3296 from RonnyPfannschmidt/verbosity-actions
unify cli verbosity handling
2018-03-13 17:38:41 -03:00
Ronny Pfannschmidt
87f2003245 remove CmdOptions since we can use argparse.Namespace() 2018-03-13 18:13:56 +01:00
Ronny Pfannschmidt
2612d967f8 Merge pull request #3301 from ankostis/caplog_clear_text
Fix #3297 where caplog.clear() did not clear text, just records
2018-03-13 16:39:53 +01:00
Ronny Pfannschmidt
37a52607c2 unify cli verbosity handling
based on https://github.com/pytest-dev/pytest/issues/3294#issuecomment-372190084

we really shouldnt have N options we post mortem hack together to determine verbosity
this change starts by unifying the data, we still need to handle deprecation/removal of config.quiet
2018-03-13 07:05:22 +01:00
Bruno Oliveira
51c0256cd4 Remove :py:mod: ref from changelog: fails our linting check 2018-03-12 20:57:51 -03:00
Bruno Oliveira
f8791c9246 Merge pull request #3292 from RonnyPfannschmidt/exception-attrs
internal refactor port exc FOrmattedExcinfo to attrs, remove old code
2018-03-12 20:54:52 -03:00
Kostis Anagnostopoulos
02bec7a3bb Add changelog & myself (ankostis) to authors 2018-03-13 01:46:44 +02:00
Bruno Oliveira
4459aa3d8b Remove redundant "# content of pytest.ini" headers from examples 2018-03-12 20:09:31 -03:00
Bruno Oliveira
2e347643a3 Add ini options for logging 2018-03-12 20:09:05 -03:00
Bruno Oliveira
8629ef6a78 Add missing ini options: markers, usefixtures and xfail_strict 2018-03-12 19:43:31 -03:00
Thomas Hisch
5e92644f94 Properly reset LogCaptureHandler in caplog
Closes #3297
2018-03-13 00:36:51 +02:00
Bruno Oliveira
3198596f8a Sort ini options 2018-03-12 19:33:34 -03:00
Kostis Anagnostopoulos
68375513f3 Add TC to demonstrate #3297 that caplog.clear() does not clean text 2018-03-13 00:28:47 +02:00
Bruno Oliveira
61b8ea8656 Add doctest_encoding and junit_suite_name ini options 2018-03-12 19:27:17 -03:00
Bruno Oliveira
0557ab431f Merge pull request #3291 from RonnyPfannschmidt/small-moves
move some code and make nodeid computed early
2018-03-12 18:49:13 -03:00
Bruno Oliveira
8035f6cced Fix typo in docs 2018-03-12 18:32:51 -03:00
Bruno Oliveira
0302622310 Improve CHANGELOG entry a bit 2018-03-12 18:22:12 -03:00
Bruno Oliveira
3909225bf9 Merge pull request #3300 from JulienPalard/typo
Typo in example, os.getcwd does not take any parameter.
2018-03-12 12:16:18 -03:00
Julien Palard
e71d907d34 Typo in example, os.getcwd does not take any parameter. 2018-03-12 15:19:26 +01:00
Brian Maissy
d2e533b8a3 implemented --last-failed-no-failures 2018-03-10 22:45:45 +02:00
Brian Maissy
54b15f5826 deprecated pytest_plugins in non-top-level conftest 2018-03-10 21:20:12 +02:00
Bruno Oliveira
d2dbbd4caa Add CHANGELOG entry 2018-03-09 17:46:44 -03:00
Bruno Oliveira
5f9bc557ea Fix linting 2018-03-09 17:44:39 -03:00
Ronny Pfannschmidt
543bac925a fix if-chain in _code.source 2018-03-09 16:50:46 +01:00
Ronny Pfannschmidt
2fe56b97c9 remove unused assertion parameter in source and minor cleanups 2018-03-09 15:03:57 +01:00
Ronny Pfannschmidt
3284d575e8 readline generator no longer needs to yield empty strings 2018-03-09 14:58:11 +01:00
Ronny Pfannschmidt
a406ca14d6 remove getstatementrange_old - its documented for python <= 2.4 2018-03-09 14:48:28 +01:00
Ronny Pfannschmidt
2e5337f5e3 makr strutures: lint fixings, removal of shadowing 2018-03-09 14:39:54 +01:00
Ronny Pfannschmidt
74884b1901 turn FormattedExcinfo into a attrs class 2018-03-09 14:21:56 +01:00
Ronny Pfannschmidt
c67f45b716 simplify a few imports in _pytest._code.source 2018-03-09 12:06:50 +01:00
Ronny Pfannschmidt
50e682d2db add changelog 2018-03-09 11:06:26 +01:00
Ronny Pfannschmidt
5e5935759e make nodeids precalculated, there is no sane reason to commpute lazyly 2018-03-09 10:52:59 +01:00
Ronny Pfannschmidt
45b6b7df92 move nodekeywords to the mark structures 2018-03-09 10:23:18 +01:00
Ronny Pfannschmidt
c9b9d796e6 remove dead code 2018-03-09 10:22:43 +01:00
Ronny Pfannschmidt
09ce84e64e remove unneeded commas 2018-03-09 10:21:42 +01:00
Bruno Oliveira
8243900960 Move definition of ini options to reference 2018-03-07 20:45:41 -03:00
Bruno Oliveira
c0fe4d483d Add environment variables 2018-03-06 20:41:21 -03:00
Bruno Oliveira
18a47bfd22 Add docs for CaptureFixture 2018-03-06 20:41:21 -03:00
Bruno Oliveira
3979f9ba3a Add pytest_plugins and pytestmark special variables 2018-03-06 20:41:21 -03:00
Bruno Oliveira
443888248a Improve fixture reference a bit 2018-03-06 20:41:21 -03:00
Bruno Oliveira
69d49f18e9 Add pytest_addhooks 2018-03-06 20:41:21 -03:00
Bruno Oliveira
8b7e6df73d Add register_assert_rewrite and improve signature of other functions 2018-03-06 20:41:21 -03:00
Bruno Oliveira
9c2203d381 Reorder top level: functions, marks, fixtures, hooks and objects 2018-03-06 20:41:21 -03:00
Bruno Oliveira
df3a4111a9 Sort objects by name 2018-03-06 20:41:20 -03:00
Bruno Oliveira
988ace9eb2 Add documentation for marks 2018-03-06 20:41:20 -03:00
Bruno Oliveira
ed8b1efc16 Add a CHANGELOG entry for the reference docs
Fix #1713
2018-03-06 20:41:20 -03:00
Bruno Oliveira
f7178654e5 Add recwarn and tmpdir fixtures to the reference docs 2018-03-06 20:41:20 -03:00
Bruno Oliveira
f1df6c5a60 Add testdir fixture to reference 2018-03-06 20:41:20 -03:00
Bruno Oliveira
66009b0f91 Add tutorial links to all references 2018-03-06 20:41:20 -03:00
Bruno Oliveira
215c6b281e Add Monkeypatch and tutorial links for logging 2018-03-06 20:41:20 -03:00
Bruno Oliveira
adcb28f61b Add caplog to reference 2018-03-06 20:41:20 -03:00
Bruno Oliveira
111c6d6a22 Improve pytestconfig and add record_xml_property 2018-03-06 20:41:20 -03:00
Bruno Oliveira
7ba8a4ee75 Use `pytest.` prefix for outcomes 2018-03-06 20:41:20 -03:00
Bruno Oliveira
400558cc9c Add pytestconfig fixture 2018-03-06 20:41:20 -03:00
Bruno Oliveira
918dffba96 Add :with: modifier to raises() and deprecated_call() 2018-03-06 20:41:20 -03:00
Bruno Oliveira
44e2715529 Add sections to pytest's builtin API 2018-03-06 20:41:20 -03:00
Bruno Oliveira
b53c4246ef Move most of 'builtin' to 'reference' 2018-03-06 20:41:19 -03:00
Bruno Oliveira
e73d4f4e1f Add local table of contents in reference.rst 2018-03-06 20:41:19 -03:00
Bruno Oliveira
e7bce90d29 Remove basepython from testenv:docs so it can be built with Python 3 2018-03-06 20:41:19 -03:00
Bruno Oliveira
623bab4447 Use :no-auto-options: in capsys fixtures
Otherwise they are recognized as iterators
2018-03-06 20:41:19 -03:00
Bruno Oliveira
70f93263e9 Add reference docs to doctest_namespace 2018-03-06 20:41:19 -03:00
Bruno Oliveira
749288dcb6 Add reference docs to cache and capture fixtures 2018-03-06 20:41:19 -03:00
Bruno Oliveira
6fa9768545 Use sphinxcontrib-trio extension
This adds some more capabilities to sphinx, like marking
functions as decorators or with contexts
2018-03-06 20:41:19 -03:00
Bruno Oliveira
6b4565f8d1 Reorder the global toc and include 'contributing' section 2018-03-06 20:41:19 -03:00
Bruno Oliveira
6d4e72e1eb Cleanup the links section to only external links
Internal links should be displayed in the side-bar
2018-03-06 20:41:19 -03:00
Bruno Oliveira
162557c2b2 Remove internal plugin list
This gets out of sync and shows internal plugins which don't make
much sense
2018-03-06 20:41:19 -03:00
Bruno Oliveira
d4c3850231 Create reference and moved Objects and Hooks reference from writing_plugins 2018-03-06 20:40:55 -03:00
Bruno Oliveira
28df322500 Merge pull request #3283 from jeffreyrack/3245-doc-test-failures
3245: Add doc to norecursedirs in tox.ini
2018-03-06 19:22:55 -03:00
Bruno Oliveira
d6ddeb395b Merge pull request #3285 from RonnyPfannschmidt/minor-refactor
Minor refactors
2018-03-06 19:22:48 -03:00
Ronny Pfannschmidt
c4430e4354 extract _warn_about_missing_assertion into freestanding function 2018-03-06 10:32:41 +01:00
Ronny Pfannschmidt
fbf01bd31a enhance skip except clause by directly using the Skipped exception 2018-03-06 10:29:26 +01:00
Jeffrey Rackauckas
e42fe5f0f9 Add doc to norecursedirs in tox.ini 2018-03-05 19:35:41 -08:00
Bruno Oliveira
ade7ad25c7 Merge remote-tracking branch 'upstream/master' into features 2018-03-05 19:48:25 -03:00
Bruno Oliveira
27c4de242f Merge pull request #3281 from nicoddemus/release-3.4.2
Preparing release version 3.4.2
2018-03-05 19:42:59 -03:00
Bruno Oliveira
e8368e6c2e Fix duplicated link in CHANGELOG 2018-03-05 07:26:38 -03:00
Bruno Oliveira
fac8208e8f Preparing release version 3.4.2 2018-03-04 19:37:49 +00:00
Bruno Oliveira
9879ac5911 Merge pull request #3279 from nicoddemus/introduce-more_itertools
Re-Introduce more_itertools
2018-03-04 16:33:58 -03:00
Bruno Oliveira
51abdb80db Merge pull request #3278 from nicoddemus/revert-more_itertools-master
Revert introduction of more_itertools on master
2018-03-04 16:33:31 -03:00
Bruno Oliveira
25399da904 Reintroduce more_itertools dependency
Reintroduce more_itertools that was added in #3265, now in the features branch
2018-03-04 10:59:46 -03:00
Bruno Oliveira
54884b8c87 Merge branch 'revert-more_itertools-master' into introduce-more_itertools 2018-03-04 10:58:52 -03:00
Bruno Oliveira
65534682aa Revert introduction of more_itertools
This was merged on master but really should be on features: we should not
add new dependencies in bug-fix releases

This reverts commits:

* cfaf3600c1
* 14a9b1ec83
2018-03-04 10:56:24 -03:00
Bruno Oliveira
e980fbbe39 Merge pull request #3277 from maiksensi/bug/3241-check-if-dir-exists
Use `isdir` instead of `exists`
2018-03-04 10:49:25 -03:00
Bruno Oliveira
07e768ab68 Merge pull request #3275 from maiksensi/docs/3209-add-logging-plugin
Add logging plugin to plugins list
2018-03-03 23:17:05 -03:00
Bruno Oliveira
9a2e0c061d Update 3241.bugfix.rst 2018-03-03 23:14:57 -03:00
Maik Figura
056d9e8dc2 Use isdir instead of exists 2018-03-04 00:55:04 +01:00
Maik Figura
46f5d7a1bb Add filetype to changelog fragment 2018-03-04 00:52:27 +01:00
Maik Figura
30453057e8 Add logging plugin to plugins list 2018-03-03 23:50:13 +01:00
Bruno Oliveira
08831396a5 Merge pull request #3218 from feuillemorte/3034-new-tests-first
#3034 Added new option "--new-first"
2018-03-02 18:33:25 -03:00
Bruno Oliveira
1549d61379 Merge pull request #3274 from feuillemorte/3268-add-deprecation
Added warning when "[pytest]" section is used in a ".cfg" file passed with "-c"
2018-03-02 16:34:31 -03:00
feuillemorte
f501d0021c #3268 Fix warning variable 2018-03-02 11:28:30 +03:00
feuillemorte
a506052d12 #3268 Added changelog file 2018-03-02 10:54:31 +03:00
feuillemorte
99aab2c3f5 #3268 Added deprecation to custom configs 2018-03-02 10:52:38 +03:00
Ronny Pfannschmidt
3b757b1b8c Merge pull request #3265 from pytest-dev/feature/always-iterable-refactor
Consolidate behavior by using filterfalse and always_iterable
2018-03-01 08:51:44 +01:00
Bruno Oliveira
14a9b1ec83 Add CHANGELOG for #3265 2018-02-28 17:31:11 -03:00
Bruno Oliveira
ea854086e1 Rename 3236.trivial.rst to 3236.feature.rst 2018-02-27 22:46:12 -03:00
Bruno Oliveira
0a5a6c19be Merge pull request #3269 from nicoddemus/merge-master-into-features
Merge master into features
2018-02-27 22:42:08 -03:00
Bruno Oliveira
90638b661d Merge pull request #3270 from pytest-dev/blueyed-patch-1
Fix typo with test_summary_list_after_errors
2018-02-27 18:27:31 -03:00
Daniel Hahler
8239103aa9 Fix typo with test_summary_list_after_errors 2018-02-27 21:07:00 +01:00
Bruno Oliveira
a2a64546eb Merge remote-tracking branch 'upstream/master' into features 2018-02-27 16:43:45 -03:00
Bruno Oliveira
9fcbf57163 Merge pull request #3267 from feuillemorte/3260-fix-pytest-section
#3260 fix pytest section
2018-02-27 16:41:45 -03:00
Bruno Oliveira
dab96cbf27 Merge pull request #3255 from nicoddemus/post-summary
Show "short test summary info" after tracebacks and warnings
2018-02-27 16:36:13 -03:00
Bruno Oliveira
1fb2457018 Adjust CHANGELOG 2018-02-27 14:58:27 -03:00
feuillemorte
92219e576b #3260 Remove deprecation 2018-02-27 20:00:46 +03:00
feuillemorte
143ac5af99 #3260 Fix config.py for py27 2018-02-27 19:26:35 +03:00
feuillemorte
409b919fc0 #3260 Added test 2018-02-27 19:16:45 +03:00
feuillemorte
eadd15fe45 #3260 Added changelog file 2018-02-27 19:05:53 +03:00
feuillemorte
3f7223af44 #3260 Fix pytest section in setup ini file 2018-02-27 19:02:49 +03:00
Bruno Oliveira
a968c0fa05 Merge pull request #3264 from jeffreyrack/3236-skipif-using-platform
#3236 Use platform module in pytest.mark
2018-02-27 09:44:52 -03:00
Bruno Oliveira
5cb72b6188 Merge pull request #3257 from will133/continue-on-failure
Continue on doctest failure
2018-02-27 07:45:41 -03:00
Bruno Oliveira
20085542e2 Merge pull request #3263 from feuillemorte/3203-remove-statistic-indicator
#3203 Remove progress when no-capture
2018-02-27 07:33:45 -03:00
Bruno Oliveira
94050a8aaf Remove config paramter from pytest_terminal_summary as discussed during review 2018-02-27 07:26:25 -03:00
Bruno Oliveira
9479bda392 Adjust the CHANGELOG 2018-02-27 07:03:20 -03:00
Jason R. Coombs
cfaf3600c1 Consolidate behavior by using filterfalse and always_iterable 2018-02-27 03:38:56 -05:00
Jeffrey Rackauckas
f6ad25928e Fixing grammar. 2018-02-26 19:15:10 -08:00
Jeffrey Rackauckas
a6762f7328 Update test_skipping to test that platform can be used in xfail 2018-02-26 19:11:13 -08:00
Bruno Oliveira
4e405dd9f9 Show "short test summary info" after tracebacks and warnings 2018-02-26 21:12:33 -03:00
Bruno Oliveira
d196ab45d3 Change 1642 entry from "trivial" to "feature" 2018-02-26 19:56:53 -03:00
Bruno Oliveira
188df8100c Small adjustment to the CHANGELOG 2018-02-26 17:14:28 -03:00
Bruno Oliveira
e8f9a91056 Small adjustment to CHANGELOG entry 2018-02-26 17:10:59 -03:00
Bruno Oliveira
44fa5a77d4 Merge pull request #3262 from nicoddemus/fix-tmpdir-docs
Fix broken links in getting-started
2018-02-26 16:49:15 -03:00
feuillemorte
31476c69ab #3203 Fix tests 2018-02-26 17:39:32 +03:00
feuillemorte
6200920dc3 #3203 Added changelog file 2018-02-26 17:24:16 +03:00
feuillemorte
46c5d5355e #3203 Remove progress when no-capture 2018-02-26 17:19:58 +03:00
Bruno Oliveira
39024a7536 Fix broken links in getting-started
Fix #3256
2018-02-26 10:56:27 -03:00
Jeffrey Rackauckas
307cd6630f Add the ability to use platform in pytest.mark.skipif 2018-02-25 22:38:25 -08:00
Florian Bruhin
ae62ced080 Merge pull request #3259 from joshm91/fix_typo
Fix minor typo in fixture.rst
2018-02-24 21:37:40 +01:00
joshm91
6166151ee4 Fix minor typo in fixture.rst 2018-02-24 19:12:40 +00:00
Ronny Pfannschmidt
da3f4045e7 Merge pull request #3250 from RonnyPfannschmidt/mark-package
Mark package
2018-02-24 18:19:27 +01:00
William Lee
c21eb72924 Added documentation for the continue-on-failure flag 2018-02-23 22:42:22 -06:00
William Lee
f4cc45bb41 Turn on the continue on failure only when the flag is given 2018-02-23 22:31:11 -06:00
William Lee
7f2dd74ae9 Fixed test for the continue run 2018-02-23 21:20:14 -06:00
feuillemorte
c032d4c5d5 Merge branch 'features' of https://github.com/feuillemorte/pytest into 3034-new-tests-first 2018-02-23 23:55:28 +03:00
feuillemorte
e865f2a235 #3034 Fix comments 2018-02-23 22:49:17 +03:00
William Lee
8d90591b33 Merge remote-tracking branch 'upstream/features' into continue-on-failure 2018-02-22 21:01:31 -06:00
William Lee
14cd1e9d94 Added the feature in change log for #3149 2018-02-22 21:01:19 -06:00
William Lee
fbc45be83f Fixed #3149 where doctest does not continue to run when there is a failure 2018-02-22 21:00:54 -06:00
Bruno Oliveira
0a3c80e959 Merge pull request #3253 from thisch/nolooggingtest
Add pdb test with disabled logging plugin
2018-02-22 22:19:47 -03:00
Bruno Oliveira
bedceaacc4 Merge pull request #3249 from a-feld/request-fixture-reference-cycle
Fix PseudoFixtureDef reference cycle.
2018-02-22 19:23:56 -03:00
Bruno Oliveira
1127d519db Merge pull request #3254 from altendky/patch-1
Correct docs to config.pluginmanager.get_plugin()
2018-02-22 19:14:47 -03:00
Bruno Oliveira
9959164c9a Add CHANGELOG entry for #3250 2018-02-22 18:55:25 -03:00
Bruno Oliveira
60358b6db8 Fix linting 2018-02-22 18:49:20 -03:00
Kyle Altendorf
b5ac61657a Correct docs to config.pluginmanager.get_plugin()
`getplugin()` is deprecated in favor of `get_plugin()`.

dd97c94035/_pytest/config.py (L261)
2018-02-22 13:48:59 -05:00
Thomas Hisch
0f58fc881b Add pdb test with disabled logging plugin
Implement the test from #3210, which was not merged yet, because the PR was
abandoned in favor or #3234.
2018-02-22 19:26:46 +01:00
Ronny Pfannschmidt
2cd69cf632 sort out import misstake 2018-02-22 15:18:17 +01:00
Ronny Pfannschmidt
935dd3aaa5 simplify complexyity in mark plugin modifyitems 2018-02-22 15:11:55 +01:00
Ronny Pfannschmidt
c8d24739ed move current mark datastructures to own module 2018-02-22 14:43:01 +01:00
Ronny Pfannschmidt
be2e3a973e remove complexity from match_keywords 2018-02-22 14:30:32 +01:00
Ronny Pfannschmidt
cef0423b27 move the keyword/mark matching to the "legacy" module 2018-02-22 14:26:22 +01:00
Ronny Pfannschmidt
de2de00de9 update setup.py for the mark package 2018-02-22 14:19:31 +01:00
Ronny Pfannschmidt
25a3e9296a reduce the complexity of skipping terminal summary 2018-02-22 14:18:49 +01:00
Ronny Pfannschmidt
cf40c0743c move mark evaluator into mark package 2018-02-22 14:05:10 +01:00
Ronny Pfannschmidt
c31e1a3797 turn mark into a package 2018-02-22 13:36:33 +01:00
Allan Feldman
48548767fc Use a frozen attr class for PseudoFixtureDef. 2018-02-21 23:15:39 -08:00
Allan Feldman
7536e949b1 Add changelog entry. 2018-02-21 22:42:44 -08:00
Allan Feldman
287c003cfd Add myself to AUTHORS. 2018-02-21 22:42:44 -08:00
Allan Feldman
aa53e37fa2 Add a test to expose leaked PseudoFixtureDef types. 2018-02-21 22:42:44 -08:00
Ronny Pfannschmidt
54e63b7dd5 Merge pull request #2770 from HPENetworking/master
Make record_xml_property generic and compatible with xdist and markers.
2018-02-22 07:38:55 +01:00
Ronny Pfannschmidt
dd97c94035 Merge pull request #3240 from codetriage-readme-bot/codetriage-badge
Add CodeTriage badge to pytest-dev/pytest
2018-02-22 07:38:31 +01:00
Ronny Pfannschmidt
264e455410 Merge pull request #3248 from durocher/master
Fix approx default tolerances for Decimal
2018-02-22 07:35:56 +01:00
Allan Feldman
75f11f0b65 Fix reference cycle caused by PseudoFixtureDef.
Python types have reference cycles to themselves when they are created. This is
partially caused by descriptors which get / set values from the __dict__
attribute for getattr / setattr on classes.

This is not normally an issue since types tend to remain referenced for the
lifetime of the Python process (and thus never become garbage).

However, in the case of PseudoFixtureDef, the class is generated in
_get_active_fixturedef and later discarded when pytest_fixture_setup returns.
As a result, the generated PseudoFixtureDef type becomes garbage.

This is not really a performance issue but it can lead to some problems when
making tests and assertions about garbage when using pytest.

This garbage creation problem can be rectified by returning a namedtuple
instance which is functionally the same. In the modified code, the namedtuple
is allocated / deallocated using reference counting rather than having to use
the garbage collector.
2018-02-21 21:40:54 -08:00
Bruno Oliveira
45d0a21294 Fix README because of code triage badge 2018-02-21 20:42:09 -03:00
Bruno Oliveira
147b43f832 Small changelog tweak 2018-02-21 20:31:33 -03:00
Bruno Oliveira
7336dbb979 Merge pull request #3246 from RonnyPfannschmidt/remove-addcall-in-tests
remove addcall in the terminal tests
2018-02-21 19:42:53 -03:00
mike
6e14585ca2 Fix approx default tolerances for Decimal 2018-02-21 23:08:23 +01:00
Bruno Oliveira
567b1ea7a1 Move user_properties to the end of parameter list for backward compatibility 2018-02-21 17:56:49 -03:00
Bruno Oliveira
d838193d2d Add note about deprecating record_xml_property
Also make record_xml_property return record_property directly
2018-02-21 17:45:52 -03:00
Bruno Oliveira
d844ad18c2 Fix formatting of CHANGELOG entry 2018-02-21 15:40:25 -03:00
Ronny Pfannschmidt
3d4d0a2614 remove addcall in the terminal tests 2018-02-21 18:56:20 +01:00
Bruno Oliveira
7a62619a75 Merge remote-tracking branch 'upstream/master' into features 2018-02-21 10:39:55 -03:00
Bruno Oliveira
dae74b674e Merge pull request #3242 from nicoddemus/delete-changelog-3.4.1
Delete changelog entries for 3.4.1 release
2018-02-21 10:38:53 -03:00
Bruno Oliveira
2a99e5dd2a Delete changelog entries for 3.4.1 release
Unfortunately due to hawkowl/towncrier#99 those news fragments were
not deleted at the time of CHANGELOG generation.
2018-02-20 23:45:21 -03:00
Carlos Jenkins
8b49ddfa58 Renamed the fixture record_xml_property to record_property and adapted logic so that the properties are passed to the TestReport object and thus allow compatibility with pytest-xdist. 2018-02-20 15:46:26 -06:00
Bruno Oliveira
9361d48b61 Merge pull request #3239 from nicoddemus/release-3.4.1
Release 3.4.1
2018-02-20 18:08:47 -03:00
codetriage-readme-bot
ebddac6a5c Add CodeTriage badge to pytest-dev/pytest
Adds a badge showing the number of people helping this repo on CodeTriage.

[![Open Source Helpers](https://www.codetriage.com/pytest-dev/pytest/badges/users.svg)](https://www.codetriage.com/pytest-dev/pytest)

## What is CodeTriage?

CodeTriage is an Open Source app that is designed to make contributing to Open Source projects easier. It works by sending subscribers a few open issues in their inbox. If subscribers get busy, there is an algorithm that backs off issue load so they do not get overwhelmed

[Read more about the CodeTriage project](https://www.codetriage.com/what).

## Why am I getting this PR?

Your project was picked by the human, @schneems. They selected it from the projects submitted to https://www.codetriage.com and hand edited the PR. How did your project get added to [CodeTriage](https://www.codetriage.com/what)? Roughly 11 months ago, [cacoze](https://github.com/cacoze) added this project to CodeTriage in order to start contributing. Since then, 32 people have subscribed to help this repo.

## What does adding a badge accomplish?

Adding a badge invites people to help contribute to your project. It also lets developers know that others are invested in the longterm success and maintainability of the project.

You can see an example of a CodeTriage badge on these popular OSS READMEs:

- [![](https://www.codetriage.com/rails/rails/badges/users.svg)](https://www.codetriage.com/rails/rails) https://github.com/rails/rails
- [![](https://www.codetriage.com/crystal-lang/crystal/badges/users.svg)](https://www.codetriage.com/crystal-lang/crystal) https://github.com/crystal-lang/crystal

## Have a question or comment?

While I am a bot, this PR was manually reviewed and monitored by a human - @schneems. My job is writing commit messages and handling PR logistics.

If you have any questions, you can reply back to this PR and they will be answered by @schneems. If you do not want a badge right now, no worries, close the PR, you will not hear from me again.

Thanks for making your project Open Source! Any feedback is greatly appreciated.
2018-02-20 10:51:51 -06:00
Bruno Oliveira
b319375592 Preparing release version 3.4.1 2018-02-20 01:43:59 +00:00
Bruno Oliveira
f8fdf0ae91 Add --yes to towncrier to automatically remove files 2018-02-20 01:43:20 +00:00
Bruno Oliveira
053fc118b7 Merge pull request #3199 from nicoddemus/publish-tag-3060
Implement deploying to PyPI by pushing a tag
2018-02-19 22:34:35 -03:00
Bruno Oliveira
97bb6abcfa Merge pull request #3234 from thisch/showcapture_log_support
Add captured-log support to --show-capture
2018-02-19 20:46:50 -03:00
Thomas Hisch
acda6c46fb Partially revert "Remove --no-print-logs option"
We'll deprecate --no-print-logs beginning with pytest-4.0.

This reverts commit ac7eb63a6b.
2018-02-19 20:34:11 +01:00
Thomas Hisch
ac7eb63a6b Remove --no-print-logs option
This option is superseded by the --show-capture option. With --no-print-logs
it was possible to only disable the reporting of captured logs, which is no
longer possible with --show-capture. If --show-capture=no is used, no
captured content (stdout, stderr and logs) is reported for failed tests.
2018-02-18 20:48:07 +01:00
Thomas Hisch
51ece00923 Add captured-log support to --show-capture
Fixes: #3233
2018-02-18 20:18:37 +01:00
Bruno Oliveira
b486e1294b Merge pull request #3222 from The-Compiler/match-msg
Remove "matching '...'" part from the pytest.raises message
2018-02-17 21:18:05 -02:00
Bruno Oliveira
3bc8b50a0d Merge pull request #3228 from thisch/update_attr
Update minimal attrs library to v17.4.0
2018-02-17 20:19:07 -02:00
Bruno Oliveira
81fa547fa8 Add CHANGELOG entry about changed attrs req 2018-02-17 20:18:32 -02:00
Bruno Oliveira
9d879bee36 Merge pull request #3215 from pytest-dev/bugfix/985/disable-output-capturing-in-doctest
Disable output capturing in doctest
2018-02-17 18:39:32 -02:00
Brian Maissy
069f32a8c4 print captured logs before entering pdb 2018-02-17 20:32:49 +02:00
Jason R. Coombs
4131d3f300 Probably it's best to write the err stream to stderr. 2018-02-17 12:13:33 -05:00
Jason R. Coombs
254e357076 Correct the broken indentation. 2018-02-17 12:10:29 -05:00
Bruno Oliveira
f263932883 Merge pull request #3232 from nicoddemus/merge-upstream
Merge master into features
2018-02-17 12:59:55 -02:00
Bruno Oliveira
0f6879bf5e Small update to changelog/README.rst 2018-02-17 10:20:41 -02:00
Bruno Oliveira
bfe2cbe875 Implement publishing to PyPI by pushing a tag
Fix #3060
2018-02-17 10:13:25 -02:00
Bruno Oliveira
69d608aec3 Merge remote-tracking branch 'upstream/master' into merge-upstream 2018-02-17 09:38:06 -02:00
Bruno Oliveira
dfbaa20240 Bring test_live_logs_unknown_sections directly due to merge conflicts 2018-02-17 09:36:46 -02:00
Bruno Oliveira
fa8354e872 Merge pull request #3213 from thisch/collection_deselection
Show deselection count before tests are executed
2018-02-17 09:03:26 -02:00
Bruno Oliveira
00d3001138 Merge pull request #3188 from s0undt3ch/issues/3184
Don't traceback on unkown sections.
2018-02-17 09:02:44 -02:00
Bruno Oliveira
05faa69c37 Merge pull request #3194 from s0undt3ch/feature/logstart-logfinish
Fix issue where a new line was always written for the live log finish section
2018-02-16 21:19:38 -02:00
Bruno Oliveira
b1abe5db23 Merge pull request #3201 from uSpike/deselect_cli
Add "--deselect" command line option
2018-02-16 20:50:22 -02:00
Jordan Speicher
774c539f1a Add --deselect command line option
Fixes #3198
2018-02-16 08:17:37 -06:00
Bruno Oliveira
df2f019997 Slight rewording in the CHANGELOG 2018-02-15 19:45:05 -02:00
Bruno Oliveira
6bc45d158d Merge pull request #3186 from brianmaissy/bugfix/print_captured_stdout_before_entering_pdb
Added printing of captured stdout before entering pdb
2018-02-15 19:38:23 -02:00
Bruno Oliveira
371eb8c6af Merge pull request #3206 from mbachry/fix-unittest-mock
Fix mock patchings detection when both mock and unittest.mock are present
2018-02-15 19:35:44 -02:00
Thomas Hisch
82cdc487ce Fix raised warning when attrs 17.4.0 is used
Related: #3223
2018-02-15 21:09:44 +01:00
Jason R. Coombs
435b8ddc7c Rename method for additional clarity. 2018-02-15 09:17:33 -05:00
Florian Bruhin
3cbf0c8ec0 Raise unexpected exceptions with pytest.raises() using match= 2018-02-15 12:11:56 +01:00
Florian Bruhin
9849022eb2 Remove "matching '...'" part from the pytest.raises message
When a test with pytest.raises(ValueError, match='foo') doesn't raise, the
following error is printed:

    Failed: DID NOT RAISE <class 'ValueError'> matching 'foo'

This error message is confusing as it implies a ValueError was raised, but the
message wasn't matching 'foo'.

I first considered rewording it somehow to preserve the match pattern in it, but
I don't think that's worthwhile as the pattern should usually be apparent from
the stacktrace anyways (hard-coded, as parametrization, or with --showlocals for
more sophisticated cases).
2018-02-14 19:20:00 +01:00
Jason R. Coombs
18c84a1904 Restrict fix to macOS only. Ref #3215. 2018-02-13 17:51:20 -05:00
Thomas Hisch
6496131b79 Show deselection count before tests are exectued
Fixes #1527
2018-02-13 22:27:02 +01:00
feuillemorte
dff0500114 #3034 Added new option "--new-first" 2018-02-13 22:49:28 +03:00
Jason R. Coombs
247cdb835a Remove xfail; tests now pass on macOS. Ref #985. 2018-02-13 12:41:19 -05:00
Jason R. Coombs
ce1872e7e8 Merge branch 'master' into bugfix/985/disable-output-capturing-in-doctest 2018-02-13 12:33:07 -05:00
Jason R. Coombs
d845af7b24 Add changelog. Ref #985. 2018-02-13 12:32:00 -05:00
Jason R. Coombs
391553887b Disable output capturing in doctest to avoid losing reference to stdout. Fixes #985. 2018-02-13 12:08:39 -05:00
Brian Maissy
7656fc8320 Added printing of captured stdout and stderr before entering pdb 2018-02-12 23:17:51 +02:00
Marcin Bachry
b6166dccb4 Fix mock patchings detection when both mock and unittest.mock are present 2018-02-12 20:29:37 +01:00
Bruno Oliveira
e7bcc854d9 Merge pull request #3202 from rouge8/pytest-raises-sphinx-parameters
Add Sphinx parameter docs for `match` and `message` args to `pytest.raises()`
2018-02-10 02:32:56 -02:00
Bruno Oliveira
ffee213c85 Update and rename 3202.trivial.rst to 3202.doc.rst 2018-02-09 22:51:15 -02:00
Andy Freeland
e5b527d0e3 Add Sphinx parameter docs for match and message args to pytest.raises() 2018-02-09 16:28:17 -08:00
Bruno Oliveira
063e2da967 Merge pull request #3176 from feuillemorte/1478_no_stdout_option
#1478 Added --no-stdout option
2018-02-09 18:36:36 -02:00
feuillemorte
da5882c2d5 #1478 Add doc and remove print 2018-02-09 21:36:48 +03:00
Bruno Oliveira
c04e248de5 Rename 3161.bugfix to 3161.bugfix.rst 2018-02-09 14:06:24 -02:00
Pedro Algarvio
d776e5610e Fix issue where a new line was always written for the live log finish section 2018-02-09 11:17:01 +00:00
Bruno Oliveira
bba258aa5e Merge pull request #3190 from s0undt3ch/feature/logs-stream
Expose `log_cli` as a CLI parser option.
2018-02-08 17:07:48 -02:00
Florian Bruhin
3685c1bc01 Merge pull request #3192 from nicoddemus/pr-template
Add changelog/README.rst and streamline our PR template text
2018-02-08 19:20:54 +01:00
Bruno Oliveira
a4cbd03535 Fix linting 2018-02-08 13:22:32 -02:00
feuillemorte
71367881ed #1478 Added --show-capture=both option (fix comments) 2018-02-08 16:21:22 +03:00
Bruno Oliveira
ad7d63df97 Rename _stream_logs_enabled to _log_cli_enabled and remove _stream_logs 2018-02-08 09:48:51 -02:00
Bruno Oliveira
eea169e515 Code review suggestions 2018-02-08 08:03:14 -02:00
Pedro Algarvio
0b71255dda Expose log_cli as a CLI parser option. 2018-02-08 09:42:53 +00:00
Bruno Oliveira
ce0a9aadec Merge pull request #3127 from feuillemorte/1642-add-rootdir-option
#1642 add rootdir option
2018-02-07 18:18:59 -02:00
Bruno Oliveira
16c52f05f1 Merge pull request #3177 from nicoddemus/mention-force-result
Mention outcome.force_result() and add link to pluggy's docs
2018-02-07 18:16:16 -02:00
Bruno Oliveira
f72182977d Merge pull request #3183 from cheezman34/master
Fix ordering of tests to minimize fixture creating
2018-02-07 18:15:41 -02:00
Bruno Oliveira
ed12cf3fb3 Merge pull request #3189 from s0undt3ch/feature/logstart-logfinish
Additionally handle logstart and logfinish hooks
2018-02-07 18:09:45 -02:00
Bruno Oliveira
40d0ade2d9 Add changelog/README.rst and streamline our PR template text
This streamlines the PR template text and adds a more in-depth explanation
about how the changelog entries work because this topic is a common source of
confusion:

- How to name the files.
- Which formatting to use (people in general assume it is Markdown).
- Recommend adding `.rst` extension to changelog files to help with the
  above (`towncrier` doesn't care).

This was heavily inspired by the excellent python-trio/trio docs.
2018-02-06 22:20:39 -02:00
Bruno Oliveira
29a074eae3 Merge pull request #3156 from thisch/junit_xml_log_fix
Add captured log msgs to junit xml file
2018-02-06 21:42:11 -02:00
feuillemorte
1a650a9eb9 #1478 Added --show-capture option 2018-02-06 23:38:51 +03:00
Bruno Oliveira
ea06c1345f Update changelog wording slightly 2018-02-06 15:45:37 +00:00
Pedro Algarvio
00d8787bb8 Add name to AUTHORS 2018-02-06 15:45:37 +00:00
Pedro Algarvio
67558e0e22 Additionally handle logstart and logfinish hooks 2018-02-06 15:45:36 +00:00
Bruno Oliveira
7152707280 Update changelog entry to "trivial" as it is a temporary workaround
I think this is a more appropriate category given that the underlying problem still exists
2018-02-06 08:54:44 -02:00
Bruno Oliveira
2d0c1e941e Fix versionadded tag in caplog function 2018-02-05 20:22:21 -02:00
Bruno Oliveira
42c1f85257 Update CHANGELOG 2018-02-05 20:07:42 -02:00
Pedro Algarvio
0d15a46863 Don't traceback on unkown sections. 2018-02-05 19:09:38 +00:00
Ronny Pfannschmidt
570edb466b Merge pull request #3185 from nicoddemus/remove-ignore-py37
Support py37 officially
2018-02-05 10:04:34 +01:00
Ronny Pfannschmidt
7c80c81433 Merge pull request #3152 from brianmaissy/silently_fail_to_import_during_postmortem
If we fail to import doctest.UnexpectedException during postmortem, fail quietly
2018-02-05 10:04:00 +01:00
Bruno Oliveira
9202ba91cf Merge pull request #3187 from brianmaissy/bugfix/skip_failing_pdb_doctest_test_on_mac
skip failing pdb/doctest test on mac
2018-02-03 23:35:39 -02:00
Bruno Oliveira
ea8997a108 Update wording in CHANGELOG 2018-02-03 20:21:06 -02:00
Brian Maissy
867344d0d7 move import to top 2018-02-04 00:03:17 +02:00
Brian Maissy
e64feaba7a xfail is better than skip 2018-02-03 23:28:37 +02:00
Brian Maissy
74633815aa skip failing pdb/doctest test on mac 2018-02-03 23:24:11 +02:00
Thomas Hisch
c0ef4a4d35 Add captured log msgs to junit xml file
For each test this adds the captured log msgs to a system-* tag in the junit
xml output file. The destination of the system-* tag is specified by
junit_logging ini option.
2018-02-03 09:39:29 +01:00
Bruno Oliveira
e289c60c3a Support py37 officially
Python 3.7.0b1 has been released:

	https://www.python.org/downloads/release/python-370b1/

Fix #3168
2018-02-02 17:15:16 -02:00
Bruno Oliveira
8c81722a0c Merge pull request #3167 from nicoddemus/fix-py37
Fix test for py37
2018-02-02 17:13:00 -02:00
Bruno Oliveira
3425edd2a5 Reword changelog a bit 2018-02-01 19:54:51 -02:00
Bruno Oliveira
37d836d754 Reword docs slightly 2018-02-01 19:34:15 -02:00
Aaron
4458e65fe7 Fix ordering of tests to minimize fixture creating 2018-02-01 13:07:45 -08:00
feuillemorte
3eb6cad222 #1642 Fix comments 2018-02-01 11:20:37 +03:00
feuillemorte
936651702b #1642 Fix tests 2018-02-01 00:27:48 +03:00
feuillemorte
9f1772e679 #1642 Resolve conflicts 2018-02-01 00:18:28 +03:00
feuillemorte
741b571f3b #1642 fix tests and config.py 2018-02-01 00:03:24 +03:00
Bruno Oliveira
653abad27b Mention outcome.force_result() and add link to pluggy's docs
Related to #3169
2018-01-31 18:18:15 -02:00
feuillemorte
949a620d3a #1478 Added --no-stdout option 2018-01-31 22:36:28 +03:00
Bruno Oliveira
89a55d85a9 Merge pull request #3166 from alanbato/typo_for_parametrize
Switch `for_parameterize` to `for_parametrize`
2018-01-30 21:41:14 -02:00
Bruno Oliveira
ef7df8f167 Small update to CHANGELOG 2018-01-30 21:40:14 -02:00
Bruno Oliveira
90a8faabba Fix test for py37
In previous Python versions, the list of warnigns appears like:

	... list of emitted warnings is: [UserWarning('user',)].

In Python 3.7 apparently the string representation has been improved to:

	... list of emitted warnings is: [UserWarning('user')].

Fix #3011
2018-01-30 20:33:07 -02:00
Alan Velasco
e12a588c39 Merge branch 'master' into typo_for_parametrize 2018-01-30 16:22:54 -06:00
Alan Velasco
547070e2d8 Switch for_parameterize to for_parametrize 2018-01-30 16:20:43 -06:00
Bruno Oliveira
f2fb841b29 Merge remote-tracking branch 'upstream/master' into features 2018-01-30 20:12:14 -02:00
Bruno Oliveira
3256fa9ee9 Add devpi-client to tasks requirements 2018-01-30 20:10:40 -02:00
Bruno Oliveira
dc9a9ec4c2 Merge pull request #3162 from nicoddemus/release-3.4.0
Release 3.4.0
2018-01-30 20:08:36 -02:00
Bruno Oliveira
527845ef29 Changelog adjustments suggested during review 2018-01-30 19:49:08 +00:00
Bruno Oliveira
489e638b4e Preparing release version 3.4.0 2018-01-30 19:47:56 +00:00
Bruno Oliveira
13ee1cffed Suggest to update all dependencies when preparing releases 2018-01-30 19:44:06 +00:00
Bruno Oliveira
4c148bd0ef Fix imports in failure_demo.py 2018-01-30 19:44:06 +00:00
Bruno Oliveira
71a7b3c062 Merge pull request #3142 from thisch/only_colorize_levelname
Colorize live-log levelnames
2018-01-30 17:41:18 -02:00
Thomas Hisch
ebab1b6c69 live-logging: Colorize levelname 2018-01-30 18:21:12 +01:00
Bruno Oliveira
49773b573f Merge pull request #3132 from raphaelcastaneda/feature/add-record-xml-attribute
implement #3130 - add record_xml_attribute fixture
2018-01-29 15:42:55 -02:00
Ronny Pfannschmidt
32979def7d Merge pull request #3158 from nicoddemus/cache-getvalue
Replace deprecated option.getvalue by option.getoption in cache plugin
2018-01-29 13:57:45 +01:00
Bruno Oliveira
ab00c3e911 Add .pytest_cache directory to gitignore 2018-01-29 08:44:11 -02:00
Bruno Oliveira
6e4efccc38 Rename test_cache to test_cacheprovider for consistency with cacheprovider 2018-01-29 08:40:29 -02:00
Bruno Oliveira
269eeec702 Replace deprecated option.getvalue by option.getoption in cacheprovider 2018-01-29 08:40:29 -02:00
Bruno Oliveira
0e1be01b7a Merge pull request #3108 from cheezman34/features
Optimize reorder_items in fixtures.py
2018-01-27 23:21:09 -02:00
Bruno Oliveira
aff463a3c4 Merge remote-tracking branch 'upstream/master' into features 2018-01-27 12:28:43 -02:00
Bruno Oliveira
b3247c1d03 Merge pull request #3044 from RonnyPfannschmidt/parameterset-empty-enable-xfail
empty parameterset - enable opt to xfail
2018-01-27 12:23:49 -02:00
Bruno Oliveira
169635e889 Move example of empty_parameter_set_mark closer to the options 2018-01-27 11:02:32 -02:00
Bruno Oliveira
cd0b2ace67 Merge pull request #3150 from alanbato/pytest_cache
Change cache directory structure to include `pytest`
2018-01-27 10:08:56 -02:00
Ronny Pfannschmidt
17a1ed5edf use a constant to sort out repeated use of the EMPTY_PARAMETERSET_OPTION 2018-01-26 12:12:26 +01:00
Ronny Pfannschmidt
a54cd4c2fd correct testing and usage of the empty_parameter_set_mark config option 2018-01-26 12:05:52 +01:00
Ronny Pfannschmidt
77de45cce3 enhance docs for empty_parameter_set_mark according to review comments 2018-01-26 12:01:27 +01:00
Ronny Pfannschmidt
d550c33cd0 s/empty_parameterset/empty_parameter_set_mark 2018-01-26 11:56:24 +01:00
Bruno Oliveira
a58099022a Merge pull request #3124 from nicoddemus/logging-3013
Changes in the logging plugin for 3.4
2018-01-26 08:52:43 -02:00
Ronny Pfannschmidt
3bc7ced97a Merge pull request #3153 from brianmaissy/document_not_to_call_main_multiple_times
Added note that calling pytest.main multiple times from the same process is not recommended because of import caching
2018-01-26 11:47:16 +01:00
Ronny Pfannschmidt
8979b2a9d7 document empty_parameterset in customize.rst 2018-01-26 11:26:48 +01:00
Ronny Pfannschmidt
d4c11e58aa exted empty parameterset check with reason test 2018-01-26 11:18:50 +01:00
Ronny Pfannschmidt
7f83605c81 fix empty parameterset tests by mocking a config object 2018-01-26 11:10:00 +01:00
Ronny Pfannschmidt
37b41de779 fix #2527 - introduce a option to pic the empty parameterset action 2018-01-26 11:10:00 +01:00
Ronny Pfannschmidt
bf2c10c810 parameterset: refactor marking empty parametersets 2018-01-26 11:10:00 +01:00
Brian Maissy
4285325cb8 Added note that calling pytest.main multiple times from the same process is not recommended because of import caching 2018-01-25 23:07:34 +02:00
Brian Maissy
2a1b1107c5 If we fail to import doctest.UnexpectedException during postmortem, fail quietly and continue 2018-01-25 22:28:27 +02:00
Bruno Oliveira
cbbd606b6c Reword changelog 2018-01-25 17:21:54 -02:00
feuillemorte
ace772c743 Merge branch '1642-add-rootdir-option' of github.com:feuillemorte/pytest into 1642-add-rootdir-option 2018-01-25 19:46:43 +03:00
feuillemorte
3a004a4507 added rootdir description to customize.rst 2018-01-25 19:46:22 +03:00
Alan Velasco
a24ca9872f Change cache directory name to include pytest 2018-01-25 07:50:08 -06:00
feuillemorte
503e00f7ff #1642 Remove adding rootdir to sys path 2018-01-25 15:57:29 +03:00
feuillemorte
0cfa975930 #1642 Fix tests 2018-01-25 15:57:04 +03:00
Bruno Oliveira
b8be339632 Merge pull request #3148 from nicoddemus/deprecate-old-style-classes-2147
All classes now subclass object for better py3 compatibility
2018-01-25 10:41:28 -02:00
Bruno Oliveira
2aad8c0fce Merge pull request #3147 from nicoddemus/issue-3103
'-o' option no longer swallows all other non-options after it
2018-01-25 10:41:18 -02:00
Bruno Oliveira
15cbd61159 Change caplog.get_handler(when) to caplog.get_records(when)
While updating the docs I noticed that caplog.get_handler() exposes
the underlying Handler object, which I think it is a bit too much
detail at this stage. Update to return the records directly instead.
2018-01-24 19:08:49 -02:00
Bruno Oliveira
2f955e0c99 Update documentation: rewording and move things for better reading flow 2018-01-24 18:42:59 -02:00
Bruno Oliveira
af37778b0d All classes now subclass object for better py3 compatibility
Fix #2147
2018-01-24 18:23:42 -02:00
Bruno Oliveira
3f5e9ea71e Fix -o behavior to no longer swallow all remaining options
The current behavior was too error-prone because a "-o" option would
swallow all the following non-option parameters:

  pytest -o foo=bar path/to/test.py

path/to/test.py would be captured by the -o option, and would fail
because "path/to/test.py" is not in the format "key=value".
2018-01-23 21:19:16 -02:00
Bruno Oliveira
443275f025 Reword changelog a bit 2018-01-23 21:19:04 -02:00
Bruno Oliveira
8426c57a9e Ensure changes in the message in the future do not make the test pass by accident 2018-01-23 21:18:59 -02:00
Aron Coyle
30ca9f9d38 Add endline 2018-01-23 21:18:51 -02:00
Aron Coyle
46d87deb5d Add changelog update authors 2018-01-23 21:18:45 -02:00
Aron Coyle
203508d9f3 cleanup test cases 2018-01-23 21:18:37 -02:00
Andrew Toolan
2c7f94fdb9 Added basic fix and test 2018-01-23 21:18:10 -02:00
Bruno Oliveira
ff90c9e237 Merge pull request #3116 from brianmaissy/pexpect_test_hangs_on_mac
use flush in order to avoid hanging on mac
2018-01-23 19:32:19 -02:00
Bruno Oliveira
b4e8861aa5 Fix typos 2018-01-23 19:02:32 -02:00
Bruno Oliveira
baa189f5a3 Merge pull request #3131 from soyrice/master
Improve readability of Getting Started guide
2018-01-23 17:48:11 -02:00
Bruno Oliveira
a7066ba837 Update formatting in the CHANGELOG 2018-01-23 17:31:07 -02:00
Bruno Oliveira
113bfb6be8 Report 'call' phase as 'live log call'
As commented in review, this makes it consistent with the headers shown
by stdout/stderr capturing ("Captured log call")
2018-01-22 21:43:35 -02:00
Bruno Oliveira
9f4688e549 Remove unnecessary -s from test_log_cli_enabled_disabled 2018-01-22 21:26:14 -02:00
Bruno Oliveira
3a9d0b26d5 Use pytest_runtest_logstart to signal the start of a new test
This also simplifies the code a bit because we don't need to keep
a set of ids anymore
2018-01-22 21:20:48 -02:00
Raphael Castaneda
a5e60b6a2d implement #3130 - adding record_xml_attribute fixture
update incorrect expected attribute value in test_record_attribute

attr names must be strings

Update CHANGELOG formatting

update usage documentation

Fix versionadded for record_xml_attribute

Indent the xml schema properly inside the warning box in the docs
2018-01-22 15:14:53 -08:00
Bruno Oliveira
0df42b4426 Show a header for each testing phase during live logging
As suggested during review
2018-01-22 21:00:52 -02:00
Bruno Oliveira
0d96a5bf90 Merge pull request #3135 from brianmaissy/doc/clarify_pytest_fixture_setup_with_fixture_that_returns_None
Clarify a possible confusion when using pytest_fixture_setup with fixture functions that return None
2018-01-22 18:02:33 -02:00
Bruno Oliveira
060f68bd90 Merge pull request #3137 from brianmaissy/doc/note_that_certain_hooks_cant_be_used_with_hookwrapper
Document hooks (defined with historic=True) which cannot be used with hookwrapper=True
2018-01-22 18:00:35 -02:00
Bruno Oliveira
e5739a3115 Merge pull request #3136 from brianmaissy/doc/document_warning_filtering_behavior
Clarify that warning capturing doesn't change the warning filter by d…
2018-01-22 17:45:36 -02:00
Bruno Oliveira
8a8797df80 Small changelog formatting 2018-01-21 23:21:21 -02:00
Brian Maissy
8994603d46 Document hooks (defined with historic=True) which cannot be used with hookwrapper=True 2018-01-21 23:17:16 +02:00
Brian Maissy
5c0b340a4b Clarify that warning capturing doesn't change the warning filter by default 2018-01-21 22:43:00 +02:00
Brian Maissy
196dcc37a8 Clarify a possible confusion when using pytest_fixture_setup with fixture functions that return None 2018-01-21 21:50:26 +02:00
feuillemorte
83034bbd48 #1642 Fix rootdir option 2018-01-20 22:30:01 +03:00
Cyrus Maden
0ab57c4139 Typo fix: "handeling" --> "handling" 2018-01-20 11:12:59 -08:00
Bruno Oliveira
29a7b5e064 Initialize log_cli_handler to None during LoggingPlugin init
Some of testdir's functionality bypasses pytest_runtestloop so this
attribute needs to be set early
2018-01-20 14:19:45 -02:00
Bruno Oliveira
27ae270159 Mention in docs that log messages of level WARNING or above are captured 2018-01-20 12:08:51 -02:00
Bruno Oliveira
2e40a8b3ca Fix test_caplog_captures_for_all_stages by setting log level 2018-01-20 12:04:28 -02:00
Bruno Oliveira
18e053546c Use six.StringIO and __name__ in test_live_logging_suspends_capture 2018-01-20 12:02:55 -02:00
Bruno Oliveira
9dbcac9af3 Suspend stdout/stderr capturing when emitting live logging messages 2018-01-20 12:02:55 -02:00
Bruno Oliveira
4a436572a8 Simplify test assertions a bit 2018-01-20 12:02:55 -02:00
Bruno Oliveira
97a4967b03 Improve code formatting 2018-01-20 12:02:55 -02:00
Bruno Oliveira
8f6a5928f7 Add newline before log messages and enable -v output when log_cli is enabled 2018-01-20 12:02:55 -02:00
Bruno Oliveira
5d89a93977 Small improvements to tests suggested during review 2018-01-20 12:02:54 -02:00
Bruno Oliveira
c53b72fd7b Add CHANGELOG for 3013 2018-01-20 12:02:54 -02:00
Bruno Oliveira
6bb739516f Update logging docs with the new changes in 3.4
Ref: #3013
2018-01-20 12:02:54 -02:00
Bruno Oliveira
8d735f3e1d Live log option now writes to the terminal reporter
Ref: #3013
2018-01-20 12:01:42 -02:00
Bruno Oliveira
aca1b06747 Undo log level set by caplog.set_level at the end of the test
Otherwise this leaks the log level information to other tests

Ref: #3013
2018-01-20 12:01:42 -02:00
Bruno Oliveira
8dcd2718aa No longer change the level of any logger unless requested explicitly
Ref: #3013
2018-01-20 12:01:42 -02:00
Bruno Oliveira
5ad1313b8a log_cli must now be enabled explicitly
Ref: #3013
2018-01-20 12:00:46 -02:00
Bruno Oliveira
3b3d237f07 Merge pull request #3117 from boxed/access_logs_in_teardown
Access captures logs in teardown
2018-01-20 11:21:17 -02:00
Bruno Oliveira
c4c968fe69 Reword CHANGELOG after introduction of caplog.get_handler() 2018-01-20 11:14:09 -02:00
Cyrus Maden
0b6df94b12 Delete .DS_Store 2018-01-19 18:45:02 -08:00
Cyrus Maden
c3d420bf75 Delete .DS_Store 2018-01-19 18:44:46 -08:00
Cyrus Maden
ebb4c47155 Delete .DS_Store 2018-01-19 18:44:33 -08:00
Anders Hovmöller
7ea5a22657 Access captures logs in teardown 2018-01-19 12:42:35 +01:00
Cyrus Maden
cd76366d87 Rename pr.doc to 3131.doc 2018-01-18 15:59:37 -08:00
Cyrus Maden
931e8830ba Update changelog
Not issue ID. Will update with pr ID after submitting pr
2018-01-18 15:54:31 -08:00
Bruno Oliveira
621374679b Merge pull request #3129 from kimberlythegeek/typo_in_logging_doc
Typo in logging doc
2018-01-18 16:40:09 -02:00
Bruno Oliveira
8be1136d03 Small changelog formatting 2018-01-18 16:40:00 -02:00
Kimberly
e0b63e34fa fixed typo in logging doc and added fix to changelog 2018-01-18 10:40:18 -07:00
feuillemorte
a7c39c894b #1642 fix flake8 2018-01-17 23:48:04 +03:00
feuillemorte
4a18d76160 #1642 remove print 2018-01-17 23:14:40 +03:00
feuillemorte
86f01967e1 #1642 Added changelog entry 2018-01-17 23:05:22 +03:00
feuillemorte
d784155fd2 #1642 Add rootdir option 2018-01-17 23:02:31 +03:00
Florian Bruhin
1fd67c9000 Merge pull request #3121 from feuillemorte/2953-keyword-expressions-error
#2953 show a simple and easy error when keyword expressions trigger a syntax error
2018-01-17 19:00:22 +01:00
Bruno Oliveira
e3406e0818 Show usage errors in red 2018-01-16 19:35:32 -02:00
feuillemorte
dc79116de3 Merge branch '2953-keyword-expressions-error' of github.com:feuillemorte/pytest into 2953-keyword-expressions-error 2018-01-16 23:36:40 +03:00
feuillemorte
8433e2ba04 #2953 fix comments: fix exception type 2018-01-16 23:35:57 +03:00
Bruno Oliveira
86e1b44230 Improve changelog formatting 2018-01-16 18:10:15 -02:00
feuillemorte
5d3f7d7142 Merge branch '2953-keyword-expressions-error' of github.com:feuillemorte/pytest into 2953-keyword-expressions-error 2018-01-16 22:56:23 +03:00
feuillemorte
648d5d0c6b #2953 fix comments: use keyword module 2018-01-16 22:55:24 +03:00
feuillemorte
dff597dcd0 Add changelog entry 2018-01-16 21:34:13 +03:00
feuillemorte
076fb56f85 show a simple and easy error when keyword expressions trigger a syntax error 2018-01-16 21:30:44 +03:00
Bruno Oliveira
150537d5e0 Merge pull request #3119 from PoppyBagel/fix-formatting
[doc] Fix wrong formatting in parametrize.rst
2018-01-16 08:33:48 -02:00
Kate
d8c23fd39b Fix wrong formatting 2018-01-16 12:36:28 +03:00
Cyrus Maden
b748576358 Add name 2018-01-15 13:36:44 -08:00
Cyrus Maden
f555a3a76c Update getting started guide
Proofread; added intro paragraph under first header to orient new users; fixed grammar errors (switched to active voice, actionable directions, etc) to improve readability
2018-01-15 13:27:10 -08:00
Cyrus Maden
1f4831a23f Update getting-started.rst 2018-01-15 12:28:21 -08:00
Brian Maissy
0a0d97aeb5 added changelog news fragment 2018-01-14 23:14:59 +02:00
Brian Maissy
4a3863c2e2 use flush in order to avoid hanging on mac 2018-01-14 23:00:23 +02:00
Aaron
d314691fd3 more descriptive changelog message 2018-01-12 10:29:18 -08:00
Ronny Pfannschmidt
01e37fe892 Merge pull request #3110 from nicoddemus/progress-teardown-3088
Fix progress report when tests fail during teardown
2018-01-12 11:09:01 +01:00
Bruno Oliveira
abbdb60051 Move logic determining if progress should be displayed to a function 2018-01-12 07:04:43 -02:00
Bruno Oliveira
5939b336cd Fix progress report when tests fail during teardown
Fix #3088
2018-01-11 20:42:05 -02:00
Aaron
3d289b803d update AUTHORS and changelog 2018-01-11 12:25:41 -08:00
Aaron
4a704bbb55 fix reorder_items_atscope ordering 2018-01-11 11:30:52 -08:00
Aaron
ee6c9f50a2 optimize fixtures.reorder_items 2018-01-11 11:30:52 -08:00
Bruno Oliveira
3181718fe0 Merge pull request #3087 from nicoddemus/deprecation-roadmap
Update deprecation/removal docs to point to labels/milestones instead
2018-01-11 11:14:47 -02:00
Bruno Oliveira
2674f352e8 Merge pull request #3091 from nicoddemus/conftest-hooks
Document bootstrap and initialization hooks
2018-01-11 11:14:20 -02:00
Bruno Oliveira
6fb46a0e79 Merge pull request #3104 from pbrod/patch-1
Update Freezing pytest description in simple.rst
2018-01-10 14:19:25 -02:00
Per A. Brodtkorb
820ea6d68f Update Freezing pytest description in simple.rst
I have trouble using third party plugins in my frozen program and discovered 
that other people have experienced it as well:

    https://mail.python.org/pipermail//pytest-dev/2015-June/003015.html

The problem is that the mechanism for plugin discovery used by pytest
(setupttools entry points) doesn't work with frozen executables so pytest
can't find any plugins. The solution seems to be to import the third party 
plugins explicitly as shown here:

    https://mail.python.org/pipermail//pytest-dev/2015-June/003018.html

This is not mentioned anywhere in the documentaion.
2018-01-10 16:44:26 +01:00
Ronny Pfannschmidt
b0032ba2b3 Merge pull request #3102 from nicoddemus/logfinish-hook-3101
Add new pytest_runtest_logfinish hook
2018-01-10 07:57:35 +01:00
Ronny Pfannschmidt
cf9b31bd5a Merge pull request #3068 from asottile/pystd
Replace py.std with stdlib imports
2018-01-10 07:52:55 +01:00
Bruno Oliveira
b68b80aec9 Add new pytest_runtest_logfinish hook
Fix #3101
2018-01-09 22:17:39 -02:00
Anthony Sottile
bd1d17e8de Replace py.std with stdlib imports 2018-01-09 12:44:10 -08:00
Bruno Oliveira
93306f6a5e Merge remote-tracking branch 'upstream/master' into features 2018-01-09 18:41:00 -02:00
Bruno Oliveira
962aede290 Merge pull request #3096 from nicoddemus/import-warnings
Ignore ImportWarnings regarding package resolution
2018-01-09 18:40:33 -02:00
Ronny Pfannschmidt
a8d3d329ec Merge pull request #3098 from uranusjr/pep426-setuptools-36.2.1
Add support for new environment marker usages
2018-01-09 18:21:06 +01:00
Tzu-ping Chung
b256cd2a6a Add support for new environment marker usages 2018-01-09 21:34:11 +08:00
Bruno Oliveira
b6b36bc167 Handle pluggy package or module for traceback filtering
Since 0.6.1 pluggy has been turned into a package
2018-01-08 21:29:15 -02:00
Bruno Oliveira
3dd24f8d21 Ignore ImportWarnings regarding package resolution
The problem is described/discussed in #3061

Ideally this should be a temporary solution until we find a proper one
which gets rid of the warning
2018-01-08 21:11:08 -02:00
Bruno Oliveira
794fb193ba Merge pull request #3093 from cryvate/fix-issue-2985-blurb
Fix issue 2985 blurb in changelog
2018-01-07 01:18:18 -02:00
Henk-Jaap Wagenaar
d7e1f037d9 Fix issue 2985 blurb in changelog 2018-01-06 22:15:06 +00:00
Bruno Oliveira
29ff9301d8 Merge pull request #3092 from jdufresne/readthedocs
Prefer https://*.readthedocs.io over http://*.rtfd.org
2018-01-06 15:53:10 -02:00
Bruno Oliveira
f3c666db3c Small formatting update in CHANGELOG 2018-01-06 14:08:15 -02:00
Jon Dufresne
b93aa5e35f Prefer https://*.readthedocs.io over http://*.rtfd.org
- Requests URL using https instead of http
- Avoids unnecessary redirect of *.rtfd.org -> *.readthedocs.io

*.rtfd.org exists as a means for pasting short URLs, which doesn't much
 apply for links in documentation.
2018-01-06 08:05:42 -08:00
Bruno Oliveira
bc66f7e43f Merge pull request #3075 from elliterate/bugs/fix-skipping-plugin-reporting
Assume not skipped by mark if attribute missing
2018-01-06 13:56:07 -02:00
Bruno Oliveira
cb6b851780 Update deprecation/removal docs to point to labels/milestones instead
Using milestones and proper issues are a much saner way to handle these topics
than keeping them in sync in a separate document
2018-01-06 13:48:39 -02:00
Bruno Oliveira
afb8a4e35d Document bootstrap and initialization hooks
Fix #2616
2018-01-06 13:31:38 -02:00
Bruno Oliveira
06a182386b Merge pull request #3073 from nicoddemus/pytest_runtestloop-docs
Add pytest_runtestloop to the docs
2018-01-05 20:35:51 -02:00
Bruno Oliveira
fac07c1b3f Merge pull request #3076 from pafonta/patch-1
[doc] Reword strange sentence on doctest flags
2018-01-05 09:49:54 -02:00
Bruno Oliveira
e8c0ca4f08 Merge pull request #3064 from nicoddemus/release-3.3.2
Preparing release version 3.3.2
2018-01-04 20:42:51 -02:00
Pierre-Alexandre Fonta
ac6f257efc Create news fragment for the pull request 2018-01-04 14:58:30 +01:00
Pierre-Alexandre Fonta
554cb8d09c Reword strange sentence on doctest flags 2018-01-04 14:47:05 +01:00
Ian Lesperance
25b504b4f0 Add self to authors list 2018-01-03 18:54:49 -05:00
Ian Lesperance
0a6e086f9d Add changelog entry 2018-01-03 18:53:32 -05:00
Ian Lesperance
f24c470403 Assume not skipped by mark if attribute missing
Fixes #3074.
2018-01-03 18:47:18 -05:00
Bruno Oliveira
52a7ccef57 Add pytest_runtestloop to the docs 2018-01-03 16:58:57 -02:00
Bruno Oliveira
bd2d0d2c3c Preparing release version 3.3.2 2017-12-25 20:38:27 +00:00
Bruno Oliveira
08997279f4 Merge pull request #3059 from asottile/yesqa
Remove unnecessary `# noqa` comments.
2017-12-22 17:03:02 -02:00
Anthony Sottile
205e29d843 Remove unnecessary # noqa comments.
Commit automated with https://github.com/asottile/yesqa
2017-12-22 08:29:48 -08:00
Ronny Pfannschmidt
672c901c70 Merge pull request #2784 from RonnyPfannschmidt/fix-fdleaks
pytester: ignore files used to obtain current user metadata
2017-12-19 17:08:53 +01:00
Bruno Oliveira
c70efaa0fb Merge pull request #3047 from RonnyPfannschmidt/mark-newapi
move node base classes from main to nodes
2017-12-19 07:59:25 -02:00
Ronny Pfannschmidt
d370e7788d Merge pull request #2068 from flub/commitaccess
[proposal] Add section about how you become a committer
2017-12-18 18:20:49 +01:00
Ronny Pfannschmidt
0d83dd1b31 Merge pull request #3016 from jurko-gospodnetic/clean-up-state-after-in-process-pytest-runs
Clean up state after in process pytest runs
2017-12-18 17:56:24 +01:00
Ronny Pfannschmidt
ed293ec3e9 pytester: no ignore files used to obtain current user metadata in the fd leak detector 2017-12-18 17:52:55 +01:00
Ronny Pfannschmidt
2f8427bb4e Merge pull request #3043 from awbdallas/parameterize_documentation_fix
Parameterize documentation fix
2017-12-18 17:48:41 +01:00
Ronny Pfannschmidt
94608c6110 port _Compatproperty to attrs 2017-12-18 11:08:20 +01:00
Ronny Pfannschmidt
afc607cfd8 move node base classes from main to nodes 2017-12-18 11:08:20 +01:00
Florian Bruhin
30729b7c3c Merge pull request #3045 from thisch/revert_accidental_push
Revert accidental push
2017-12-17 22:06:38 +01:00
Thomas Hisch
dfc5399cd7 Revert "WIP #3013"
This reverts commit 28a93b9eeb.
2017-12-17 21:50:17 +01:00
Thomas Hisch
76489d30f7 Revert "WIP"
This reverts commit d6f75d2836.
2017-12-17 21:49:57 +01:00
Thomas Hisch
d6f75d2836 WIP 2017-12-17 20:11:24 +01:00
Jurko Gospodnetić
d85a3ca19a add changelog entry 2017-12-17 12:47:50 +01:00
Jurko Gospodnetić
f3c9c6e8a8 fix restoring Python state after in-process pytest runs
Now each in-process pytest run saves a snapshot of important global Python
state and restores it after the test completes, including the list of loaded
modules & the Python path settings.

Previously only the loaded package data was getting restored, but that was
also reverting any loaded package changes done in the test triggering the
pytest runs, and not only those done by the pytest runs themselves.

Updated acceptance tests broken by this change, which were only passing before
by accident as they were making multiple pytest runs with later ones depending
on sys.path changes left behind by the initial one.
2017-12-17 12:47:50 +01:00
Jurko Gospodnetić
67bd60d5c6 clean up Testdir taking snapshots & restoring global Python state
Now extracted to new CwdSnapshot, SysModulesSnapshot & SysPathsSnapshot
classes, each saving the state they are interested in on instantiation
and restoring it in its `restore()` method.
2017-12-17 12:47:50 +01:00
Thomas Hisch
28a93b9eeb WIP #3013 2017-12-17 06:54:57 +01:00
Austin
70461d1ead Update parametrize.rst 2017-12-16 09:31:48 -06:00
Austin
73eccb4c36 Adding news fragment 2017-12-16 09:21:27 -06:00
Austin
d7a76a4d07 Updated for more clarity
- Changed original wording for parameterize. Should help be a little more clear
2017-12-16 09:04:18 -06:00
Bruno Oliveira
924b5e2e3d Merge pull request #3031 from nicoddemus/symlink-privileges
Check if symlink does have privileges on Windows for test_cmdline_python_package_symlink
2017-12-16 12:36:11 -02:00
Bruno Oliveira
d87279115d Merge pull request #3041 from segevfiner/capture-no-disable-progress
Use classic console output when -s is used
2017-12-16 12:34:34 -02:00
Bruno Oliveira
0a2735a275 Reword changelog entry 2017-12-16 12:33:34 -02:00
Austin
c90e76c371 Clarifiyng documentation for parameterize
- Added snippet dealing with parameterize run order of tests
2017-12-16 08:25:02 -06:00
Segev Finer
370daf0441 Use classic console output when -s is used
Fixes #3038
2017-12-16 15:00:23 +02:00
Bruno Oliveira
586ecea6f2 Check if symlink does not privileges on Windows for test_cmdline_python_package_symlink
os.symlink might fail on Windows because users require a special policy
to create symlinks (argh).

This is not a problem on AppVeyor because it is logged in as an admin,
but would be surprising for Windows users running pytest's test
suite on their computer.
2017-12-14 19:23:15 -02:00
Bruno Oliveira
db4df5833a Merge pull request #3030 from nicoddemus/leak
Fix memory leak caused by fixture values never been garbage collected
2017-12-14 19:20:34 -02:00
Bruno Oliveira
b17c6e5f89 Merge pull request #3028 from thisch/removelogger
Remove logger parameter from catching_logs
2017-12-13 20:56:48 -02:00
Bruno Oliveira
c3f63ac143 Fix memory leak caused by fixture values never been garbage collected
The leak was caused by the (unused) `FixtureRequest._fixture_values`
cache.

This was introduced because the `partial` object (created to call
FixtureDef.finish() bound with the Request) is kept alive
through the entire session when a function-scoped fixture depends
on a session-scoped (or higher) fixture because of the nested
`addfinalizer` calls.

FixtureDef.finish() started receiving a request object in order to
obtain the proper hook proxy object (#2127), but this does not seem
useful at all in practice because `pytest_fixture_post_finalizer`
will be called with the `request` object of the moment the fixture value
was *created*, not the request object active when the fixture value
is being destroyed. We should probably deprecate/remove the request
parameter from `pytest_fixture_post_finalizer`.

Fix #2981
2017-12-13 19:49:06 -02:00
Thomas Hisch
3862b0b28d Remove logger parameter from catching_logs
The logger parameter of catching_logs is not used anywhere. The main
motivation for removing the logger parameter is that it removes the

logger = logger or logging.getLogger(logger)

line. IMO there are too many occurences of the string 'logg' ;)
2017-12-13 21:13:59 +01:00
Ronny Pfannschmidt
476d4df1b7 Merge pull request #3010 from cryvate/fix-issue-2985
Improve handling of pyargs
2017-12-13 13:56:42 +01:00
Ronny Pfannschmidt
52449903c3 Merge pull request #3023 from nicoddemus/preparse-deprecated
Add param annotations and types to hookspec
2017-12-13 13:51:20 +01:00
Ronny Pfannschmidt
506c9c91c0 Merge pull request #3025 from anntzer/dont-rewrite-plugin
Respect PYTEST_DONT_REWRITE for plugins too.

closes #2995
2017-12-13 12:34:51 +01:00
Bruno Oliveira
38f34e2fa1 Merge pull request #3012 from thisch/merge_contextmanagers
Integrate logging_using_handler into catching_logs
2017-12-13 06:59:48 -02:00
Bruno Oliveira
ba41015ef6 Merge pull request #3021 from jurko-gospodnetic/cleanup
Code cleanup
2017-12-13 06:58:18 -02:00
Bruno Oliveira
ebfc1c49d1 Fix changelog formatting 2017-12-13 06:58:07 -02:00
Antony Lee
45e7734b1a Change set ops to use methods instead of operators. 2017-12-13 00:54:57 -08:00
Bruno Oliveira
8ce6e39b1c Small formatting to CHANGELOG 2017-12-13 06:52:37 -02:00
Antony Lee
c8e7d1ae34 Respect PYTEST_DONT_REWRITE for plugins too. 2017-12-12 17:43:17 -08:00
Bruno Oliveira
7b5d4d01ed Add param annotations and types to hookspec
Also mention which hook to use instead of the deprecated
pytest_cmdline_preparse

Fix #3022
2017-12-12 18:01:31 -02:00
Jurko Gospodnetić
a4f4579f19 add changelog entry 2017-12-12 13:41:31 +01:00
Jurko Gospodnetić
e4da9bacdf fix actial --> actual typo 2017-12-12 12:55:32 +01:00
Henk-Jaap Wagenaar
1e295535c3 Move _patched_find_module to module namespace. 2017-12-12 09:53:06 +00:00
Henk-Jaap Wagenaar
3ca1e4b7f0 Make patch for issue in pkgutil.ImpImporter local by using contextmanager. 2017-12-12 08:43:01 +00:00
Henk-Jaap Wagenaar
dc19624248 Improve testing comments and code of issue 2985 (symlink in pyargs). 2017-12-12 08:26:40 +00:00
Bruno Oliveira
f8f1a52ea0 Merge remote-tracking branch 'upstream/master' into features 2017-12-11 22:18:50 -02:00
Bruno Oliveira
5c6d7739bc Merge pull request #3015 from jurko-gospodnetic/code-cleanup
Code cleanup
2017-12-11 22:15:50 -02:00
Bruno Oliveira
771b5c8852 Merge pull request #3019 from srinivasreddy/rm_ast
remove '_ast' module; and redirect '_ast' references to 'ast'
2017-12-11 22:12:40 -02:00
Bruno Oliveira
fc5ec5807e Add changelog for 3018 2017-12-11 17:40:35 -02:00
Srinivas Reddy Thatiparthy
fc544dc660 remove redundant checking because
* isinstance([], Sequence) is True

* isinstance((), Sequence) is True
2017-12-12 00:10:59 +05:30
Srinivas Reddy Thatiparthy
7792587b3f remove unnecessary import 2017-12-12 00:03:38 +05:30
Srinivas Reddy Thatiparthy
c2cd239d35 remove _ast reference from test cases as well 2017-12-11 23:24:47 +05:30
Srinivas Reddy Thatiparthy
cb0ba18f53 remove '_ast' module; and redirect '_ast' references to 'ast' 2017-12-11 23:14:17 +05:30
Jurko Gospodnetić
3b85e0c3a9 simplify test_conftest_found_with_double_dash() test code 2017-12-11 15:10:04 +01:00
Jurko Gospodnetić
73bc6bacfa add changelog entry 2017-12-09 13:34:58 +01:00
Jurko Gospodnetić
8e8a953ac6 fix test name typo 2017-12-09 13:34:58 +01:00
Jurko Gospodnetić
852b96714e use spaces consistently instead of some of them being &nbsp; 2017-12-09 13:34:57 +01:00
Jurko Gospodnetić
dd64f1a4a9 fix tox.ini comment typos 2017-12-09 13:34:57 +01:00
Jurko Gospodnetić
41a6ec6f31 touch up test_cmdline_python_namespace_package() test code 2017-12-09 13:34:56 +01:00
Jurko Gospodnetić
7feab7391d simplify test_pdb_collection_failure_is_shown test data setup code 2017-12-09 13:34:56 +01:00
Jurko Gospodnetić
f0bfe9de3d shorten some test code 2017-12-09 13:34:56 +01:00
Jurko Gospodnetić
596937e610 remove extra whitespace 2017-12-09 13:34:55 +01:00
Jurko Gospodnetić
57fcd3f57e remove corpse code comments 2017-12-09 13:34:55 +01:00
Jurko Gospodnetić
65f5383106 fix comment & docstring typos, line wrapping & wording 2017-12-09 13:34:54 +01:00
Ronny Pfannschmidt
964c29cb93 Merge pull request #3014 from nicoddemus/cap-named-tuple
Change capture docs to use namedtuple
2017-12-09 09:38:39 +01:00
Bruno Oliveira
38fb6aae78 Change capture docs to use namedtuple 2017-12-08 18:34:29 -02:00
Bruno Oliveira
1c5b887dfd Fix spelling of pytest in CHANGELOG 2017-12-08 09:04:42 -02:00
Thomas Hisch
ba209b5230 Integrate logging_using_handler into catching_logs
logging_using_handler is only used in catching_logs. Therefore it makes
sense to remove one of the many context managers from the logging
plugin.
2017-12-07 16:34:53 +01:00
Henk-Jaap Wagenaar
b62fd79c0c Fix issue 2985. 2017-12-07 15:12:44 +00:00
Bruno Oliveira
655146e522 Merge remote-tracking branch 'upstream/master' into features 2017-12-05 22:30:35 -02:00
Bruno Oliveira
88f2cc9b64 Small formatting fixes in CHANGELOG 2017-12-05 22:28:56 -02:00
Bruno Oliveira
ed2bb9d723 Merge pull request #2997 from nicoddemus/release-3.3.1
Preparing release version 3.3.1
2017-12-05 22:21:41 -02:00
Bruno Oliveira
2a111ff700 Preparing release version 3.3.1 2017-12-05 20:41:57 +00:00
Bruno Oliveira
5c6758fde4 Merge pull request #3006 from The-Compiler/template-fix
Fix example in PR template
2017-12-05 18:35:42 -02:00
Bruno Oliveira
9bd8420a6b Merge pull request #3005 from The-Compiler/blacklist-catchlog
Also blacklist pytest-capturelog plugin
2017-12-05 18:35:09 -02:00
Florian Bruhin
cbdab02d05 Fix example in PR template 2017-12-05 20:05:35 +01:00
Florian Bruhin
ce30896cd2 Also blacklist pytest-capturelog plugin
This is the older plugin before pytest-catchlog was around. Apparently there are
people still using it.

Fixes #3004
2017-12-05 20:02:56 +01:00
Ronny Pfannschmidt
2e8b0a83fe Merge pull request #2989 from nicoddemus/bring-tr-writer-back-2984
Bring back TerminalReporter.writer as an alias to TerminalReporter._tw
2017-12-01 17:42:31 +01:00
Bruno Oliveira
369c711f14 Merge pull request #2971 from blueyed/fix-ZeroDivisionError
Fix ZeroDivisionError with 0 collected tests
2017-11-30 21:12:46 -02:00
Bruno Oliveira
cf0cac3b73 Bring back TerminalReporter.writer as an alias to TerminalReporter._tw
Fix #2984
2017-11-30 19:56:47 -02:00
Bruno Oliveira
a9dd37f429 Merge pull request #2980 from nicoddemus/immutable-fix-parameters
Add CHANGELOG entry about pytest.fixture "params" being now immutable
2017-11-30 19:56:03 -02:00
Bruno Oliveira
294729962d Merge pull request #2976 from st--/master
Extend _pytest.python._idval to return __name__ of functions as well
2017-11-30 18:01:21 -02:00
Ronny Pfannschmidt
4de433e280 Merge pull request #2983 from nicoddemus/improve-assert-2979
Improve getscopeitem assertion message
2017-11-30 16:58:29 +01:00
ST John
652936f47f make linter happier 2017-11-30 10:29:05 +00:00
ST John
1fe2e2cb03 Merge branch 'master' of https://github.com/st--/pytest 2017-11-30 10:19:38 +00:00
ST John
e66473853c add test 2017-11-30 10:19:29 +00:00
Bruno Oliveira
70f1e3b4b0 Improve getscopeitem assertion message
Fix #2979
2017-11-30 07:53:43 -02:00
Bruno Oliveira
fdd4abb88a Small rewording of the CHANGELOG 2017-11-29 21:11:34 -02:00
Bruno Oliveira
fdfc1946da Add CHANGELOG entry about pytest.fixture "params" being now immutable
Fix #2959
2017-11-29 18:56:57 -02:00
ST John
5085aa2bce add changelog file 2017-11-29 16:30:34 +00:00
ST John
912330a7e2 Extend _pytest.python._idval to return __name__ of functions as well, not just for classes 2017-11-29 16:17:49 +00:00
Florian Bruhin
88ed1ab648 Merge pull request #2964 from rpuntaie/master
fix issue #2920
2017-11-29 10:32:28 +01:00
Florian Bruhin
191e8c6d9b Merge pull request #2969 from nicoddemus/null-bytes-2957
Always escape null bytes when setting PYTEST_CURRENT_TEST
2017-11-29 06:57:48 +01:00
Bruno Oliveira
6bbd741039 Add test for #2971 2017-11-28 22:42:52 -02:00
Daniel Hahler
0f5fb7ed05 Fix ZeroDivisionError with 0 collected tests
This can easily happen with pytest-testmon.
2017-11-29 00:54:14 +01:00
Bruno Oliveira
5f1a7330b2 Small fixes in changelog items 2017-11-28 21:36:17 -02:00
Bruno Oliveira
2a75ae46c3 Improve test that blocks setuptools plugins from being loaded
Make it a parametrized test to ensure all the mocked mechanisms in
the test actually work as expected when we *do not* use "-p no:"
2017-11-28 21:29:58 -02:00
Bruno Oliveira
89cf943e04 Always escape null bytes when setting PYTEST_CURRENT_TEST
Fix #2957
2017-11-28 19:45:13 -02:00
Roland Puntaier
833f33fa0c removed comments 2017-11-28 17:38:49 +01:00
Roland Puntaier
3dbac17d75 Merge branch 'master' of https://github.com/rpuntaie/pytest 2017-11-28 17:30:54 +01:00
Roland Puntaier
6843d45c51 added test for #2920 fix 2017-11-28 17:29:52 +01:00
Bruno Oliveira
4a840a7c09 Fix formatting in CHANGELOG 2017-11-28 13:59:27 -02:00
Roland Puntaier
9b7e4ab0c6 prepare pull request for #2920 fix 2017-11-28 16:56:59 +01:00
Roland Puntaier
4ea7bbc197 fix issue #2920 2017-11-28 16:47:12 +01:00
Bruno Oliveira
4d2f05e4b9 Merge pull request #2962 from pytest-dev/fix-nbsp-in-changelog
replace non-breaking space with space
2017-11-28 09:51:26 -02:00
Florian Bruhin
454b60b6c5 Merge pull request #2963 from redtoad/patch-1
Fix broken link to project
2017-11-28 12:51:15 +01:00
Sebastian Rahlf
f6be23b68b Add changelog entry. 2017-11-28 12:31:34 +01:00
Sebastian Rahlf
644fdc5237 Fix broken link to project
The plugin has since moved to pytest-dev
2017-11-28 12:22:47 +01:00
Tom Viner
4b5f0d5ffa replace non-breaking space with space 2017-11-28 11:12:40 +00:00
Ronny Pfannschmidt
9f7ba00611 Merge pull request #2958 from nicoddemus/issue-2956
Only escape str-like arguments passed to warnings
2017-11-28 07:44:28 +01:00
Bruno Oliveira
796db80ca4 Only escape str-like arguments passed to warnings
Fix #2956
2017-11-27 23:17:15 -02:00
Bruno Oliveira
d95c8a2204 Fix link to #2636 in CHANGELOG 2017-11-27 19:51:41 -02:00
Bruno Oliveira
4678cbeb91 Merge remote-tracking branch 'upstream/features' 2017-11-27 19:37:58 -02:00
Bruno Oliveira
67ad0fa364 Merge pull request #2945 from nicoddemus/release-3.3.0
Release 3.3.0
2017-11-27 19:37:19 -02:00
Bruno Oliveira
6cdd851227 CHANGELOG and docs changes requested during review 2017-11-27 10:19:34 -02:00
Bruno Oliveira
c58715371c Merge pull request #2954 from blueyed/rewritten
Fix spelling: s/re-writ/rewrit/g
2017-11-26 18:12:30 -02:00
Daniel Hahler
d5f038e29a Fix spelling: s/re-writ/rewrit/g
This also fixes "can not" to "cannot" in the "Module already imported so
cannot be rewritten" assertion error.
2017-11-26 20:46:06 +01:00
Bruno Oliveira
6eeacaba3e Fix typos in CHANGELOG 2017-11-26 09:00:08 -02:00
Bruno Oliveira
6b90ad4d4b Merge pull request #2949 from eprikazc/master
Update github "bugs" link
2017-11-25 16:18:29 -02:00
Eugene Prikazchikov
e273f5399d Update github "bugs" link
Apparently, some time ago label was renamed from bug to "type:bug"
2017-11-25 17:44:58 +03:00
Bruno Oliveira
0de1a65644 Update pluggy pin to pluggy>=0.5,<0.7 after pluggy-0.6 release 2017-11-24 14:42:25 -02:00
Bruno Oliveira
95de11a44e Block pytest-catchlog and issue a warning
Trying to install pytest-3.3 and pytest-catchlog will result in an
option conflicts because both declare the same options.
2017-11-23 19:53:12 -02:00
Bruno Oliveira
05cfdcc8cb Revert making TerminalWriter public in TerminalReporter plugin
We eventually want to replace py.io.TerminalWriter (exposed as
"_tw" in TerminalReporter) by something else, so deprecating access
to "_tw" and making it public as "writer" is contrary to that.
2017-11-23 19:53:12 -02:00
Bruno Oliveira
0ddd3e2839 Fix linting in CHANGELOG 2017-11-23 19:02:13 -02:00
Bruno Oliveira
aa9a02ec44 Preparing release version 3.3.0 2017-11-23 20:25:36 +00:00
Bruno Oliveira
e97c774f8e Remove vendoring import from tasks/__init__ 2017-11-23 20:23:50 +00:00
Bruno Oliveira
f50ace7c0a Merge remote-tracking branch 'upstream/master' into release-3.3.0 2017-11-23 20:20:40 +00:00
Bruno Oliveira
49c0c599b0 Merge pull request #2944 from nicoddemus/regendoc-norm
Remove gendoc normalization for '=' and '_' headers
2017-11-23 16:31:09 -02:00
Bruno Oliveira
e0d236c031 Remove gendoc normalization for '=' and '_' headers
Using the default for non-atty terminals (80) so the new
progress indicator aligns correctly.
2017-11-23 15:33:41 +00:00
Ronny Pfannschmidt
b533c2600a Merge pull request #2858 from nicoddemus/console-progress-2657
Console progress output
2017-11-23 14:46:49 +01:00
Bruno Oliveira
dc574c60ef Use regex match-count syntax to improve test readability 2017-11-22 17:16:25 -02:00
Bruno Oliveira
1d26f3730f Fix docstrings in pytester 2017-11-22 17:15:59 -02:00
Bruno Oliveira
27935ebec9 Merge pull request #2943 from Perlence/fix-marks-without-description
Handle marks without description
2017-11-22 15:36:29 -02:00
Bruno Oliveira
378eb5d67b Minor formatting change in CHANGELOG 2017-11-22 11:24:48 -02:00
Sviatoslav Abakumov
5e71ffab87 Handle marks without description 2017-11-22 15:47:15 +03:00
Florian Bruhin
8df7ed12c1 Merge pull request #2940 from nicoddemus/rewrite-bug-2939
Fix assertion rewrite to match module names correctly
2017-11-22 06:57:55 +01:00
Bruno Oliveira
f05333ab75 Fix rewrite to not write past the edge of the screen 2017-11-22 00:00:02 -02:00
Bruno Oliveira
c8d52b633b Fix assertion rewrite to match module names correctly
Fix #2939
2017-11-21 23:06:47 -02:00
Bruno Oliveira
2455f8670e Add changelog 2017-11-21 21:01:51 -02:00
Bruno Oliveira
3a5dbabf60 Add tests for progress output and docs for `console_output_style`
Fix #2657
2017-11-21 21:01:51 -02:00
Bruno Oliveira
3441084bd2 Add progress output for verbose mode with xdist 2017-11-21 21:01:51 -02:00
Bruno Oliveira
8b92527d7d Add re_match_lines and re_match_lines_random to pytester fixture 2017-11-21 21:01:51 -02:00
Bruno Oliveira
dab889304e Implement progress percentage reporting while running tests
Fix #2657
2017-11-21 21:01:41 -02:00
Bruno Oliveira
7a7cb8c8c5 Require py>=1.5.0 2017-11-21 21:01:41 -02:00
Bruno Oliveira
77bd0aa02f Merge pull request #2931 from nicoddemus/deprecation-roadmap-docs
Add Deprecation Roadmap to backward compatibility document
2017-11-18 12:30:33 -02:00
Bruno Oliveira
b0f558da44 Add Future/Past Releases section 2017-11-18 11:57:00 -02:00
Ronny Pfannschmidt
ca1f4bc537 Merge pull request #2935 from asottile/capsysbinary
Add capsysbinary fixture
2017-11-17 21:30:14 +01:00
Anthony Sottile
219b758949 Add capsysbinary fixture
`capsysbinary` works like `capsys` but produces bytes for `readouterr()`.
2017-11-17 09:02:46 -08:00
Bruno Oliveira
6161bcff6e Merge pull request #2925 from asottile/capfdbinary
Add capfdbinary fixture
2017-11-17 08:00:10 -02:00
Ronny Pfannschmidt
99a4a93dbc Merge pull request #2932 from nicoddemus/deprecate-add-call
Deprecate metafunc.addcall
2017-11-16 07:15:25 +01:00
Bruno Oliveira
99ba3c9700 Add CHANGELOG entry for #2876 2017-11-15 22:02:47 -02:00
Bruno Oliveira
c19708b193 Merge pull request #2930 from nicoddemus/pin-pluggy-0.5
Update pluggy pin to 0.5.*
2017-11-15 21:59:53 -02:00
Bruno Oliveira
1f08d990d5 Deprecate metafunc.addcall
Fix #2876
2017-11-15 15:16:00 -02:00
Bruno Oliveira
e2c59d3282 Change pluggy._CallOutcome to pluggy._Result after update to pluggy-0.5 2017-11-15 14:08:11 -02:00
Bruno Oliveira
f9029f11af Add Deprecation Roadmap to backward compatibility document
We should replace the wiki document to a link to this document now
2017-11-15 13:53:43 -02:00
Bruno Oliveira
c7be83ac47 Update pluggy pin to 0.5.* 2017-11-15 13:00:29 -02:00
Bruno Oliveira
74aaf91653 Merge pull request #2927 from nicoddemus/release-3.2.5
Release 3.2.5
2017-11-15 09:22:48 -02:00
Florian Bruhin
1aeb58b531 Merge pull request #2928 from nicoddemus/python-requires
Prevent pip from installing pytest in unsupported Python versions
2017-11-15 09:46:04 +01:00
Ronny Pfannschmidt
7b3febd314 Merge pull request #2924 from nicoddemus/merge-master-into-features
Merge master into features
2017-11-15 09:36:31 +01:00
Bruno Oliveira
e87ff07370 Prevent pip from installing pytest in unsupported Python versions
Fix #2922
2017-11-14 22:27:15 -02:00
Bruno Oliveira
a220a40350 Preparing release version 3.2.5 2017-11-15 00:12:42 +00:00
Bruno Oliveira
dd6c534468 Remove py<1.5 restriction
Fix #2926
2017-11-14 22:08:03 -02:00
Bruno Oliveira
4a0aea2deb Add missing entry to CHANGELOG for 3.2.4 2017-11-14 22:05:48 -02:00
Anthony Sottile
8f90812481 Add capfdbinary fixture
`capfdbinary` works like `capfd` but produces bytes for `readouterr()`.
2017-11-14 14:50:00 -08:00
Bruno Oliveira
3b3bf9f53d Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-11-14 18:42:29 -02:00
Bruno Oliveira
54cea3d178 Small formatting changes in CHANGELOG 2017-11-14 18:33:46 -02:00
Bruno Oliveira
9628c71210 Merge pull request #2921 from nicoddemus/release-3.2.4
Preparing release version 3.2.4
2017-11-14 18:31:03 -02:00
Bruno Oliveira
a0ad9e31da Preparing release version 3.2.4 2017-11-13 20:01:17 +00:00
Bruno Oliveira
22cff038f8 Merge pull request #2916 from nicoddemus/bin-py-1.5
Pin py<1.5 as 1.5 drops py26 and py33 support
2017-11-13 17:56:52 -02:00
Bruno Oliveira
685387a43e Merge pull request #2127 from malinoff/fix-2124
Use session.config.hook instead of ihook. Fixes #2124
2017-11-12 21:57:41 -02:00
Bruno Oliveira
d26c1e3ad9 Pin py<1.5 as 1.5 drops py26 and py33 support 2017-11-12 21:50:11 -02:00
Bruno Oliveira
a6f2d2d2c9 Rename FixtureDef.finalizer to FixtureDef.finalizers 2017-11-12 11:35:46 -02:00
Bruno Oliveira
6d3fe0b826 Explicitly clear finalizers list in finalize to ensure cleanup 2017-11-12 11:28:57 -02:00
Bruno Oliveira
bdad345f99 Fix passing request to finish() in FixtureDef 2017-11-12 11:28:26 -02:00
Bruno Oliveira
063335a715 Add changelog entries for #2124 2017-11-12 11:19:25 -02:00
Bruno Oliveira
f074fd9ac6 Merge remote-tracking branch 'upstream/features' into malinoff/fix-2124 2017-11-12 11:16:08 -02:00
Bruno Oliveira
6550b9911b pytest_fixture_post_finalizer now receives a request argument 2017-11-12 11:14:55 -02:00
Bruno Oliveira
258031afe5 Merge remote-tracking branch 'upstream/master' into malinoff/fix-2124 2017-11-12 10:34:47 -02:00
Bruno Oliveira
259b86b6ab Merge pull request #2776 from cryporchild/fix-missing-nodeid-with-pyargs
Fix #2775 - running pytest with "--pyargs" will result in Items with …
2017-11-12 10:18:35 -02:00
Ronny Pfannschmidt
f0f2d2b861 Merge branch 'master' into fix-missing-nodeid-with-pyargs 2017-11-11 14:33:55 +01:00
Ronny Pfannschmidt
d1af369800 Merge pull request #2913 from nicoddemus/merge-master-into-features
Merge master into features
2017-11-11 10:09:49 +01:00
Ronny Pfannschmidt
b671c5a8bf Merge pull request #2914 from nicoddemus/addfinalizer-refactor
Make SubRequest.addfinalizer an explicit method
2017-11-11 09:26:24 +01:00
Bruno Oliveira
f320686fe0 Make SubRequest.addfinalizer an explicit method
This implicit definition really tripped me while debugging #2127,
unfortunately hidden as it was in the middle of all the variable
declarations.

I think the explicit definition is much easier for the eyes and IDEs
to find.
2017-11-11 03:07:34 -02:00
Bruno Oliveira
742f9cb825 Merge pull request #2911 from RonnyPfannschmidt/remove-nodeinfo
remove unused _pytest.runner.NodeInfo class
2017-11-10 18:57:14 -02:00
Bruno Oliveira
99496d9e5b Merge pull request #2910 from RonnyPfannschmidt/scopenode-sanitize-specials
switch a special case in scope node lookup to a general one
2017-11-10 18:49:35 -02:00
Bruno Oliveira
983a09a2d4 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-11-10 18:33:02 -02:00
Bruno Oliveira
66fbebfc26 Merge pull request #2894 from nicoddemus/fix-linting-errors
Fix linting errors
2017-11-10 18:15:53 -02:00
Bruno Oliveira
0108f262b1 Fix typo in CHANGELOG 2017-11-10 18:15:09 -02:00
Ronny Pfannschmidt
76f3be452a remove unused _pytest.runner.NodeInfo class 2017-11-10 17:48:52 +01:00
Ronny Pfannschmidt
c47dcaa713 switch a special case in scope node lookup to a general one 2017-11-10 17:35:42 +01:00
Ronny Pfannschmidt
b2b1eb262f Merge pull request #2906 from nicoddemus/larger-parametrize-section
Make the "examples" section more prominent in the docs for parametrize
2017-11-10 10:50:57 +01:00
Ronny Pfannschmidt
9fce430c89 Merge pull request #2907 from nicoddemus/lazy-fixture
Mention pytest-lazy-fixture plugin in the proposal for parametrize_with_fixtures
2017-11-10 10:48:48 +01:00
Bruno Oliveira
e114feb458 Mention pytest-lazy-fixture plugin in the proposal for parametrize_with_fixtures 2017-11-09 20:14:24 -02:00
Bruno Oliveira
c09f69df2a Make the "examples" section more prominent in the docs
I spent some time today figuring out why PR #2881 was not showing up
on doc/parametrize... then after some digging even on readthedocs
wondering if the last documentation build had failed, I realized the
docs I was looking for was in doc/example/parametrize instead.

The section that mentions this is very easy to miss, this makes it a
full fledged title and easier to find.
2017-11-09 19:25:30 -02:00
Bruno Oliveira
3900879a5c Mark test_py2_unicode as xfail in PyPy2 on Windows
#2905
2017-11-09 19:17:17 -02:00
Florian Bruhin
7b1cc55add Merge pull request #2903 from pagles/docs-3.6
List python 3.6 in the documented supported versions
2017-11-08 22:57:28 +01:00
Yorgos Pagles
d904981bf3 Rename 2903.trivial to 2903.doc 2017-11-08 18:20:50 +02:00
Yorgos Pagles
f13333afce Create changelog entry 2017-11-08 18:19:59 +02:00
Yorgos Pagles
fad1fbe381 List python 3.6 in the documented supported versions 2017-11-08 18:13:34 +02:00
Bruno Oliveira
c33074c8b9 Merge pull request #2641 from RonnyPfannschmidt/introduce-attrs
[RFC] Introduce attrs
2017-11-06 12:56:57 -02:00
Bruno Oliveira
b11640c1eb Fix linting E722: do not use bare except 2017-11-04 13:59:10 -02:00
Bruno Oliveira
03829fde8a Fix linting E741: ambiguous variable name 2017-11-04 13:59:10 -02:00
Bruno Oliveira
e351976ef4 Merge remote-tracking branch 'upstream/features' into RonnyPfannschmidt/introduce-attrs 2017-11-04 12:32:27 -02:00
Ronny Pfannschmidt
b18a9deb4c Merge pull request #2892 from nicoddemus/merge-master-into-features
Merge upstream/master into features
2017-11-04 08:15:28 +01:00
Ronny Pfannschmidt
2e2f72156a Merge pull request #2893 from fmichea/patch-1
Clarify language of proposal for fixtures parameters
2017-11-04 08:08:48 +01:00
Franck Michea
22e9b006da Add fragment per PR's guidelines. 2017-11-03 22:24:05 +01:00
Franck Michea
802585cb66 Clarify language of proposal for parametrized fixtures
This change slightly modifies the language of the proposal document around use of fixture as parameters of pytest.mark.parametrize. When looking for documentation around this, I very quickly scrolled through this document and landed on the last paragraph thinking it was documenting a real function. This change attempts to make it less likely for this to happen.
2017-11-03 22:13:47 +01:00
Bruno Oliveira
d7e8eeef56 Merge pull request #2878 from RonnyPfannschmidt/collector-makeitem-deprecate
deprecate the public internal PyCollector.makeitem method
2017-11-03 17:13:18 -02:00
Bruno Oliveira
e58e8faf47 Add CHANGELOG entry for attrs module dependency 2017-11-03 17:07:33 -02:00
Bruno Oliveira
7d43225c36 Merge pull request #2877 from RonnyPfannschmidt/extract-extract-parameterset
move responsibility for parameterset extraction into parameterset class
2017-11-03 16:52:28 -02:00
Bruno Oliveira
460cae02b0 Small formatting fix in CHANGELOG 2017-11-03 16:51:59 -02:00
Bruno Oliveira
f3a119c06a Merge upstream/master into features 2017-11-03 16:37:18 -02:00
Ronny Pfannschmidt
d1aa553f73 add mocked integrationtest for the deprecationwarning of makeitem 2017-10-30 19:49:14 +01:00
Ronny Pfannschmidt
cd747c48a4 Merge pull request #2874 from nicoddemus/fix-py27-xdist-envs-2843
Change directory for py27 xdist-related envs
2017-10-30 17:09:34 +01:00
Ronny Pfannschmidt
07b2b18a01 introduce attrs as dependency and use it
for FixtureFunctionMarker and marks
2017-10-30 17:04:42 +01:00
Bruno Oliveira
766de67392 Fix linting error in deprecated.py 2017-10-30 16:35:34 +01:00
Ronny Pfannschmidt
821f9a94d8 deprecate the public internal PyCollector.makeitem method 2017-10-30 16:35:23 +01:00
Ronny Pfannschmidt
26019b33f8 Merge pull request #2882 from thisch/doctest_lineno
Fix context output handling for doctests
2017-10-30 09:57:25 +01:00
Ronny Pfannschmidt
cb30848e5a Merge pull request #2880 from samueldg/capture-result-namedtuple
Capture result namedtuple
2017-10-30 09:47:06 +01:00
Ronny Pfannschmidt
d00e2da6e9 Merge pull request #2881 from dawran6/2658
Document pytest.param
2017-10-30 09:36:33 +01:00
Thomas Hisch
2f993af54a Fix context output handling for doctests
Show full context of doctest source in the pytest output, if the lineno of
failed example in the docstring is < 9.
2017-10-29 20:06:10 +00:00
Daw-Ran Liou
af5e9238c8 Document pytest.param
Append example for pytest.param in the example/parametrize document.
2017-10-28 14:25:09 -07:00
Samuel Dion-Girardeau
8e178e9f9b Add myself to AUTHORS list 2017-10-28 15:08:53 -04:00
Samuel Dion-Girardeau
8e28815d44 Add changelog entry for issue #2879 2017-10-28 15:08:07 -04:00
Samuel Dion-Girardeau
b27dde24d6 Use a nametuple for readouterr() results
This allows accessing `out` and `err` directly by attribute,
while preserving tuple unpacking.

Also added tests, one for the `capsys` fixture, and one for the
`MultiCapture` class itself.
2017-10-28 14:53:19 -04:00
Ronny Pfannschmidt
4a436f2255 move responsibility for parameterset extraction into parameterset class 2017-10-27 17:55:07 +02:00
Bruno Oliveira
27cea340f3 Remove trailing whitespace 2017-10-26 21:55:28 -02:00
Bruno Oliveira
c3ba9225ef Change directory for py27 xdist-related envs
The "filter_traceback" function was not filtering the frames
that belonged to the pytest internals.

"filter_traceback" was receiving *relative* paths when running with
xdist, and full paths in non-distributed runs; for this reason
the traceback function did not consider the received path to be
relative to the pytest internal modules.

Fix #2843
2017-10-26 21:34:41 -02:00
Bruno Oliveira
111d640bdb Merge pull request #2873 from stephenfin/doc/skipping-entire-files
doc: Include collector config in the skip doc
2017-10-26 20:21:31 -02:00
Bruno Oliveira
734c435d00 Merge pull request #2870 from Perlence/rewrite-python-37-docstring
Adapt the Python 3.7 AST changes
2017-10-26 20:15:22 -02:00
Bruno Oliveira
27bb2eceb4 Add comment about why we remove docstrings on test_assertrewrite
As explained in pytest-dev/pytest#2870
2017-10-26 20:15:05 -02:00
Stephen Finucane
383239cafc doc: Include collector config in the skip doc
None of the decorators are sufficient to skip an entire file, for
example if the file contain invalid code for a given Python version.
Simply link to details about customizing the collector.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-26 17:14:29 +01:00
Sviatoslav Abakumov
fd7bfa30d0 Put imports on the last line unless there are other exprs 2017-10-25 11:05:07 +03:00
Sviatoslav Abakumov
3427d27d5a Try to get docstring from module node 2017-10-25 10:54:43 +03:00
Ronny Pfannschmidt
def471b975 Merge pull request #2869 from nicoddemus/merge-master-into-features
Merge master into features
2017-10-25 09:08:08 +02:00
Ronny Pfannschmidt
f743e95cfc Merge pull request #2791 from OfirOshir/features
bugfix for issue #2491
2017-10-25 09:04:01 +02:00
Bruno Oliveira
4e581b637f Use zip and map from six 2017-10-24 22:13:32 -02:00
Bruno Oliveira
6b86b0dbfe Fix additional linting issues 2017-10-24 21:01:00 -02:00
Bruno Oliveira
0b540f98b1 Merge pull request #2864 from bilderbuchi/fix-1505
Introduce a dedicated section about conftest.py
2017-10-24 20:12:46 -02:00
Bruno Oliveira
bdab29fa3d Merge pull request #2867 from Perlence/ini-markers-whitespace
Strip whitespace from markers in INI config
2017-10-24 20:11:20 -02:00
Bruno Oliveira
6821d36ca5 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-10-24 19:57:14 -02:00
Ronny Pfannschmidt
5631a86296 Merge pull request #2862 from tom-dalton-fanduel/issue-2836-fixture-collection-bug
Issue 2836 fixture collection bug
2017-10-24 16:32:50 +02:00
Sviatoslav Abakumov
52aadcd7c1 Strip whitespace from markers in INI config
Resolves #2856.
2017-10-24 14:18:39 +03:00
Tom Dalton
f5e72d2f5f Unused import / lint 2017-10-24 11:25:42 +01:00
Tom Dalton
a5ac19cc5e Merge branch 'issue-2836-fixture-collection-bug' of github.com:tom-dalton-fanduel/pytest into issue-2836-fixture-collection-bug 2017-10-24 10:45:06 +01:00
Tom Dalton
14e3a5fcb9 Move the generic separator to a constant 2017-10-24 10:42:16 +01:00
Florian Bruhin
7b608f976d Merge pull request #2865 from nicoddemus/contributing-docs
Make CONTRIBUTING and PR template more consistent regarding doc contributions
2017-10-24 06:46:32 +02:00
Bruno Oliveira
fe560b7192 Make CONTRIBUTING and PR template more consistent regarding doc contributions 2017-10-23 18:46:14 -02:00
Bruno Oliveira
b61cbc4fba Merge pull request #2859 from OwenTuz/issue-2692-document-setup-teardown-mismatch-in-unittest-integration
2692.docs document setup/teardown behaviour when using unittest-based su…
2017-10-23 18:35:25 -02:00
Bruno Oliveira
a3ec3df0c8 Add E722 and E741 flake errors to the ignore list
Also fixed 'E704 multiple statements on one line (def)' in python_api
2017-10-23 18:19:15 -02:00
Christoph Buchner
e23af009f9 Introduce a dedicated section about conftest.py
Also reorganize conftest-related content a bit.
Closes #1505, closes #1770.
2017-10-23 22:11:09 +02:00
Florian Bruhin
531e0dcaa3 Merge pull request #2863 from lancelote/patch-1
Remove typo @ in assignment
2017-10-23 20:51:07 +02:00
Pavel Karateev
dc5f33ba5c Remove typo @ in assignment 2017-10-23 21:39:13 +03:00
Tom Dalton
655ab0bf8b Address more review comments, fix massive bug I reintroduced in the node-splitting code :-/ 2017-10-23 17:49:49 +01:00
Tom Dalton
a7199fa8ab Docstring typo 2017-10-23 16:59:56 +01:00
Tom Dalton
d714c196a5 Shorter code, longer docstring 2017-10-23 16:55:35 +01:00
Tom Dalton
ee7e1c94d2 Remove redundant if, tidy if-body 2017-10-23 16:12:07 +01:00
Tom Dalton
de9d116a49 Added Tom Dalton to AUTHORS 2017-10-23 15:37:15 +01:00
Tom Dalton
f003914d4b Add changelog entry for #2836 2017-10-23 15:37:02 +01:00
Tom Dalton
1e6dc6f8e5 Working (I think) fix for #2836 2017-10-23 13:26:42 +01:00
Tom Dalton
c03612f729 Test now looks for real expected output 2017-10-23 12:40:32 +01:00
Tom Dalton
29fa9d5bff Add failing test 2017-10-23 12:28:54 +01:00
Owen Tuz
3cdbb1854f #2692: Document setup/teardown behaviour when using unittest-based suites 2017-10-21 23:12:49 +01:00
Ronny Pfannschmidt
083084fcbc Merge pull request #2842 from ceridwen/features
Use funcsigs and inspect.signature to do function argument analysis
2017-10-20 07:49:08 +02:00
Bruno Oliveira
f7387e45ea Fix linting 2017-10-19 21:50:15 -02:00
Ceridwen
3da28067f3 Replace introspection in compat.getfuncargnames() with inspect/funcsigs.signature 2017-10-19 16:01:26 -07:00
Bruno Oliveira
5c71151967 Add more text to the 2.6 and 3.3 announcement
The text was a bit short for this important announcement.
2017-10-19 20:48:23 -02:00
Ronny Pfannschmidt
3f9f4be070 Merge pull request #2845 from jespino/fix/2832
Adding Failed exception to manage maxfail behavior
2017-10-19 09:12:11 +02:00
Bruno Oliveira
4cb60dac3d Merge pull request #2850 from bilderbuchi/docs-911
Add documentation about python -m pytest invocation.
2017-10-18 19:44:52 -02:00
Bruno Oliveira
a7a39f1364 Update CHANGELOG formatting 2017-10-18 19:26:10 -02:00
Bruno Oliveira
8c7974af01 Merge pull request #2848 from bilderbuchi/fix-538
Clarify the documentation of fixture scopes
2017-10-18 19:18:57 -02:00
Bruno Oliveira
e81b275eda Update formatting in CHANGELOG 2017-10-18 18:54:44 -02:00
Bruno Oliveira
537fc3c315 Merge pull request #2824 from dirk-thomas/pytest_addopts_before_initini
get PYTEST_ADDOPTS before calling _initini
2017-10-18 18:35:12 -02:00
Christoph Buchner
46cc9ab77c Add documentation about python -m pytest invocation. 2017-10-18 21:30:56 +02:00
ApaDoctor
cfd16d0dac provide error fixture applied to the same func
provide error fixture applied to the same func

provide error fixture applied to the same func
2017-10-18 12:01:08 +02:00
Florian Bruhin
2d08005039 Merge pull request #2847 from meawoppl/patch-1
Spelling Fix
2017-10-18 07:50:43 +02:00
Christoph Buchner
baadd569e8 Clarify the documentation of fixture scopes. Closes #538. 2017-10-17 23:42:32 +02:00
Matty G
11b391ff49 Update mark.py 2017-10-17 14:11:07 -07:00
Jesús Espino
00d3abe6dc Adding Failed exception to manage maxfail behavior 2017-10-17 21:32:20 +02:00
Ronny Pfannschmidt
71c76d96d3 Merge pull request #2834 from aysonje/ignore-setup
ignore valid setup.py during --doctest-modules
2017-10-17 07:19:09 +02:00
Bruno Oliveira
3676da594c Merge pull request #2841 from pgiraud/patch-1
Fix auto-use fixture doc
2017-10-16 21:18:18 -02:00
Bruno Oliveira
843872b501 Improve formatting in 502.feature file 2017-10-16 21:07:57 -02:00
Pierre GIRAUD
a4fd5cdcb5 Fix auto-use fixture doc 2017-10-16 10:23:35 +02:00
Florian Bruhin
ae4e596b31 Merge pull request #2840 from MarSoft/patch-2
Fix typo in parametrization doc
2017-10-16 05:23:12 +02:00
Семён Марьясин
cfdebb3ba4 Fix typo in parametrization doc 2017-10-16 01:55:30 +03:00
je
eaf38c7239 call path.read(), add tests, add news fragment 2017-10-14 00:49:54 +08:00
je
b29a9711c4 ignore valid setup.py during --doctest-modules 2017-10-14 00:49:45 +08:00
Ronny Pfannschmidt
c750a5beec Merge pull request #2794 from thisch/catchlog
Merge pytest-catchlog plugin
2017-10-12 09:02:46 +02:00
Ronny Pfannschmidt
df37cdf51f Merge pull request #2808 from georgeyk/allow-module-level-skip
Allow module level skip
2017-10-12 06:50:53 +02:00
Thomas Hisch
af75ca435b Fix some coding-style issues in the logging plugin 2017-10-12 02:19:24 +02:00
Thomas Hisch
8aed5fecd9 Remove test_logging_initialized_in_test 2017-10-12 02:19:24 +02:00
Thomas Hisch
f3261d9418 Move logging docu into own rst file
Remove reference of pytest-catchlog plugin in plugins.rst
2017-10-12 02:19:24 +02:00
Thomas Hisch
775f4a6f2f Fix flake8 issue 2017-10-12 02:19:24 +02:00
Thomas Hisch
502652ff02 Add preliminary documentation for logging-plugin 2017-10-12 02:19:24 +02:00
Thomas Hisch
0e83511d6d Rename name of registered logging plugin 2017-10-12 02:19:24 +02:00
Thomas Hisch
815dd19fb4 Remove unicode literal compat code 2017-10-12 02:19:24 +02:00
Thomas Hisch
1f3ab118fa Remove usage of get_logger_obj 2017-10-12 02:19:24 +02:00
Thomas Hisch
0ec72d0745 Improve get_option_ini and get_actual_log_level 2017-10-12 02:19:24 +02:00
Thomas Hisch
69f3bd8336 Add changelog entry for catchlog plugin 2017-10-12 02:19:24 +02:00
Bruno Oliveira
10a3b9118b Use a relative cache_dir in test because of how arguments are parsed on Windows
We use shlex to parse command-line arguments and PYTEST_ADDOPTS, so passing
a full path with '\' arguments produces incorrect results on Windows

Anyway users are advised to use relative paths for portability
2017-10-11 19:37:17 -03:00
Dirk Thomas
ce8c829945 add test for #2824 2017-10-11 09:41:18 -07:00
Dirk Thomas
ed7aa074aa add changelog file for #2824 2017-10-11 09:41:14 -07:00
Dirk Thomas
66e9a79472 get PYTEST_ADDOPTS before calling _initini 2017-10-11 09:38:44 -07:00
Ronny Pfannschmidt
1480aed781 Merge pull request #2823 from hugovk/features-rm-2.6
Remove code for unsupported Python versions
2017-10-10 09:42:32 +02:00
Hugo
be0e2132b7 Update authors [CI skip] 2017-10-10 10:01:15 +03:00
hugovk
7113c76f0d Remove unused import 2017-10-10 09:03:26 +03:00
hugovk
ef732fc51d Remove code for unsupported Python versions 2017-10-10 08:54:56 +03:00
Ronny Pfannschmidt
dd45f8ba6c Merge pull request #2822 from RonnyPfannschmidt/nomore-py26
Nomore py26
2017-10-10 07:00:08 +02:00
Ronny Pfannschmidt
c486598440 remove some support code for old python versions 2017-10-09 17:25:13 +02:00
Bruno Oliveira
059455b45d Merge pull request #2773 from RonnyPfannschmidt/fix-markeval-2767
refactor mark evaluators
2017-10-09 12:17:15 -03:00
Ronny Pfannschmidt
73ff53c742 remove eol python from the ci config 2017-10-09 16:36:41 +02:00
Ronny Pfannschmidt
88366b393c start the removal of python 2.6/3.3 support 2017-10-09 16:35:33 +02:00
Ronny Pfannschmidt
9b0ce535c9 Merge pull request #2801 from nicoddemus/capture-fixture
Allow fixtures to use capsys and capfd
2017-10-09 15:26:50 +02:00
Ronny Pfannschmidt
8a6bdb282f fix changelog entry 2017-10-09 15:21:06 +02:00
Ronny Pfannschmidt
46e30435eb Merge pull request #2819 from leezu/fix_kwargs_fixtures
Fix pytest.parametrize when argnames are specified as kwarg
2017-10-09 06:49:40 +02:00
Leonard Lausen
e86ba41a32 Add testcase for #2819 2017-10-09 01:06:25 +09:00
Leonard Lausen
e89abe6a40 Defensive fallback in case of kwargs not being present 2017-10-09 00:37:27 +09:00
Leonard Lausen
48b5c13f73 Add changelog for #2819 2017-10-08 12:33:02 +09:00
Leonard Lausen
c24ffa3b4c Fix pytest.parametrize when argnames are specified as kwarg 2017-10-08 12:23:26 +09:00
Ronny Pfannschmidt
459cc40192 skipping: cleanup
remove dead comments
fix naming
remove dead code
2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt
e3b73682b2 flake8 fix 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt
8480075f01 resuffle markevaluator internal structure 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt
9ad2b75038 skipping: replace _evalskip with a more consistent _skipped_by_mark 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt
a33650953a remove unused import 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt
667e70f555 switch out the placeholder MarkEvaluator in unittest plugin 2017-10-06 10:44:49 +02:00
Ronny Pfannschmidt
761d552814 Merge pull request #2815 from xuanluong/issue-1997-document-xpass
Add mention of xpass in skip/xfail documentation
2017-10-06 06:51:35 +02:00
Xuan Luong
4bc6ecb8a5 Add mention of xpass in skip/xfail documentation 2017-10-05 20:14:45 -04:00
George Y. Kussumoto
0668a6c6d3 Add myself to authors file 2017-10-04 22:14:29 -03:00
George Y. Kussumoto
03ce0adb79 Fix: handle CollectReport in folded_skips function 2017-10-04 19:18:55 -03:00
Bruno Oliveira
e7a4d3d8cf Merge remote-tracking branch 'upstream/master' into features 2017-10-04 17:28:34 -03:00
Bruno Oliveira
9ee0a1f5c3 Merge pull request #2813 from nicoddemus/release-3.2.3
Preparing release version 3.2.3
2017-10-04 17:27:36 -03:00
Bruno Oliveira
6b91bc88de Preparing release version 3.2.3 2017-10-03 21:42:34 +00:00
Ronny Pfannschmidt
61eb20df71 Merge pull request #2810 from nicoddemus/issue-2809
Fix warning about non-ascii warnings even when they are ascii
2017-10-03 20:56:23 +02:00
Bruno Oliveira
df6d5cd4e7 Use ascii_escaped to escape unicode warnings 2017-10-03 12:19:37 -03:00
Bruno Oliveira
fbb9e9328b Fix warning about non-ascii warnings even when they are ascii
Fix #2809
2017-10-03 07:39:53 -03:00
George Y. Kussumoto
9824499396 Add 2808.feature changelog entry 2017-10-02 21:26:29 -03:00
George Y. Kussumoto
59f66933cd Update documentation example of pytest.skip(allow_module_level=True) 2017-10-02 21:26:00 -03:00
George Y. Kussumoto
c1aa63c0bb Fix docstring alignment and typos 2017-10-02 21:24:52 -03:00
George Y. Kussumoto
e4a6e52b81 Update skipping documentation to include usage of allow_module_level kwarg 2017-10-02 21:07:21 -03:00
George Y. Kussumoto
06307be15d Add initial tests using skip with allow_module_level kwarg 2017-10-02 21:07:21 -03:00
George Y. Kussumoto
79d3353081 Add allow_module_level kwarg to skip helper 2017-10-02 21:07:21 -03:00
Bruno Oliveira
6690b8a444 Merge pull request #2807 from xuanluong/issue-1442-mention-not--k-help
[doc] Add example of -k 'not test' in help text
2017-10-01 14:32:34 -03:00
Xuan Luong
7093d8f65e Add example of -k 'not test' in help text 2017-09-30 18:43:20 -04:00
Bruno Oliveira
f9589f7b64 Resume output capturing after capsys/capfd.disabled() context manager
Fix #1993
2017-09-29 17:24:31 -03:00
Christian Boelsen
794d4585d3 Remove unnecessary complexity in _check_initialpaths_for_relpath(). 2017-09-28 20:53:50 +01:00
Ronny Pfannschmidt
d132c502e6 Merge pull request #2804 from nicoddemus/terminal-reporter-tw-2803
Deprecate TerminalReporter._tw
2017-09-28 10:01:24 +02:00
Bruno Oliveira
3b30c93f73 Deprecate TerminalReporter._tw
Fix #2803
2017-09-27 17:16:34 -03:00
Bruno Oliveira
c0c859ce99 Merge pull request #2799 from blueyed/cleanup-tox.ini
minor: cleanup tox.ini
2017-09-27 15:36:10 -03:00
Bruno Oliveira
22f338d74d Refactor some names for better understanding and consistency 2017-09-26 20:09:42 -03:00
Bruno Oliveira
9919269ed0 Allow to use capsys and capfd in other fixtures
Fix #2709
2017-09-26 20:09:36 -03:00
Daniel Hahler
87596714bf minor: cleanup tox.ini 2017-09-27 00:45:10 +02:00
Thomas Hisch
296ac5c476 Add thisch to AUTHORS 2017-09-26 23:24:27 +02:00
Thomas Hisch
ad21d5cac4 Remove pytest-capturelog backward compat code 2017-09-26 23:24:27 +02:00
Thomas Hisch
2559ec8bdb use 'formatter' kwarg of catching_logs 2017-09-22 22:27:50 +02:00
Thomas Hisch
207f153ec1 Remove logging_at_level ctx manager 2017-09-22 22:27:50 +02:00
Thomas Hisch
3a4011585f catching_logs: Remove usage of 'closing' ctx manager
The 'closing' context manager is only needed for the log_file_handler.
2017-09-22 22:27:50 +02:00
Thomas Hisch
57f66a455a catching_logs: Remove unused 'filter' kwarg 2017-09-22 22:27:50 +02:00
Thomas Hisch
e41fd52e8c Introduce live_logs context manager 2017-09-22 22:27:50 +02:00
Thomas Hisch
08f6b5f4ea Use pytest.hookimpl instead of pytest.mark.hookwrapper
pytest.mark.hookwrapper seems to be used nowhere in the _pytest package.
2017-09-22 22:27:50 +02:00
Thomas Hisch
d13e17cf51 Don't modify the 'config' object in __init__ 2017-09-22 22:27:50 +02:00
Thomas Hisch
f1f6109255 Remove _catchlog_ prefix 2017-09-22 22:27:50 +02:00
Thomas Hisch
87b8dc5afb Move 'config' handling from pytest_configure to __init__ 2017-09-22 22:27:50 +02:00
Thomas Hisch
fc965c1dc5 Remove outdated docstring 2017-09-22 22:27:50 +02:00
Thomas Hisch
a1bd54e4ea Clean-up LogCaptureHandler 2017-09-22 22:27:50 +02:00
Thomas Hisch
36cceeb10e Set type of log_print ini-variable to 'bool' 2017-09-22 22:27:50 +02:00
Thomas Hisch
3e71a50403 Remove unneeded sys import from unittest 2017-09-22 22:27:50 +02:00
Thomas Hisch
98209e92ee Remove superfluous whitespace in docstring 2017-09-22 22:27:50 +02:00
Thomas Hisch
1bea7e6985 Cleanup pytest_addoption 2017-09-22 22:27:50 +02:00
Thomas Hisch
1ba219e0da Adapt (logging) unittest 2017-09-22 22:27:50 +02:00
Thomas Hisch
a8e3effb6c Upgrade py 2017-09-22 22:27:49 +02:00
Thomas Hisch
ca46f4fe2a Remove conftest 2017-09-22 22:27:49 +02:00
Thomas Hisch
5130f5707f Fix name clash 2017-09-22 22:27:49 +02:00
Thomas Hisch
6607478b23 Add unittests for LoggingPlugin (excluding perf tests) 2017-09-22 22:27:49 +02:00
Thomas Hisch
8eafbd05ca Merge the pytest-catchlog plugin 2017-09-22 22:27:49 +02:00
Ronny Pfannschmidt
de0d19ca09 Merge pull request #2790 from nicoddemus/merge-master-into-features
Merge master into features
2017-09-20 10:25:56 +02:00
OfirOshir
d96869ff66 fixing cr 2017-09-20 09:45:40 +03:00
Bruno Oliveira
966391c77e Merge pull request #2789 from Avira/master
Don't crash if an item has no _fixtureinfo attribute
2017-09-19 17:34:43 -03:00
Bruno Oliveira
9c8847a0cb Merge pull request #2792 from Avira/fix-tox-docs-link
fix tox documentation link
2017-09-19 12:31:21 -03:00
Oliver Bestwalter
58aaabbb10 fix tox documentation link 2017-09-19 16:57:16 +02:00
Ofir
b57a84d065 updating bugfix changelog 2017-09-19 15:36:12 +03:00
Ofir
c89827b9f2 updating import plugin error test in order to make sure it also checks that the original traceback has been shown to the users 2017-09-19 15:23:07 +03:00
Ofir
062a0e3e68 If an exception happens while loading a plugin, PyTest no longer hides the original traceback.
In python2 it will show the original traceback with a new message that explains in which plugin.
 In python3 it will show 2 canonized exceptions, the original exception while loading the plugin in addition to an exception that PyTest throws about loading a plugin.
2017-09-19 15:14:08 +03:00
Oliver Bestwalter
2802135741 fix 'DoctestItem' object has no attribute '_fixtureinfo'
* doxtests don't seem to have this attribute, so nothing will be written in that case.
* tried to be a good boy scout and tidied up surrounding code a bit (comments, shadowed/unused names, removed random new lines, naming things)
2017-09-19 12:41:12 +02:00
Bruno Oliveira
a2da5a691a Update tox and appveyor environments to use py36 by default 2017-09-18 21:38:15 -03:00
Bruno Oliveira
afe7966683 Fix call to outcome.get_result now that outcome.result is deprecated 2017-09-18 21:36:54 -03:00
Bruno Oliveira
3ebfb881c9 Merge remote-tracking branch 'upstream/master' into features 2017-09-18 19:10:31 -03:00
Ronny Pfannschmidt
bf77daa2ee Merge pull request #2785 from nicoddemus/py36
Change to py36 as main environment for Python 3 environments in tox
2017-09-17 09:19:06 +02:00
Bruno Oliveira
9933635cf7 Change to py36 as main environment for Python 3 environments in tox
This also has the benefit of working around Travis recent failures
in Python 3.5 environments.
2017-09-16 19:18:07 -03:00
Bruno Oliveira
ac5c5cc1ef Merge pull request #2750 from evanunderscore/fix-filescompleter
Fix crash in FastFilesCompleter with no prefix
2017-09-14 20:11:43 -03:00
Bruno Oliveira
810320f591 Small fixes to development_guide: title and label names
* Fix title to use a proper "title" section marker
* Fix labels by adding a " " after the ":"
* Fix OS labels after obvious mishap
* Sort labels
2017-09-14 19:58:56 -03:00
Bruno Oliveira
25d2acbdb2 Merge pull request #2760 from nicoddemus/labels
Add development guide to docs
2017-09-14 19:20:45 -03:00
Bruno Oliveira
52c134aed3 Add development guide to docs 2017-09-13 19:32:40 -03:00
Christian Boelsen
14b6380e5f Fix #2775 - running pytest with "--pyargs" will result in Items with empty "parent.nodeid" if run from a different root directory 2017-09-13 17:15:32 +01:00
Ronny Pfannschmidt
70cdfaf661 Merge pull request #2754 from nicoddemus/xfail_strict
Set xfail_strict=True in pytest's own test suite
2017-09-13 09:01:32 +02:00
Bruno Oliveira
abfd9774ef Remove xfail mark from passing test in py26 2017-09-12 17:59:09 -03:00
Bruno Oliveira
e57cc55719 Merge pull request #2766 from xuanluong/issue-1548-docs-multiple-calls-metafunc-parametrize
Update documentation on multiple calls of metafunc.parametrize
2017-09-10 02:07:06 -03:00
Xuan Luong
696c702da7 Update documentation on multiple calls of metafunc.parametrize 2017-09-10 00:23:23 -04:00
Bruno Oliveira
bee2c864d8 Merge pull request #2765 from xuanluong/pass-callable-to-marker-typo
Fix typo in example of passing a callable to markers
2017-09-09 21:03:13 -03:00
Xuan Luong
e27a0d69aa Rename changelog file to PR id number 2017-09-09 18:26:15 -04:00
Xuan Luong
15222ceca2 Fix typo in example of passing a callable to markers 2017-09-09 18:22:23 -04:00
Bruno Oliveira
3c1ca03b9c Merge pull request #2763 from jhamman/docs/skipif_class_warning
add warning to skipping docs re marker inheritance
2017-09-09 15:15:47 -03:00
Ronny Pfannschmidt
25ed4edbc7 Merge pull request #2764 from xuanluong/issue-2758-fix-mark-decorator-equality
[bugfix] Checking MarkDecorator equality returns False for non-MarkDecorator object
2017-09-09 10:03:49 +02:00
Xuan Luong
1e93089165 [bugfix] Checking MarkDecorator equality returns False for non-MarkDecorator object 2017-09-09 01:31:08 -04:00
Joe Hamman
b2a8e06e4f add warning to skipping docs re marker inheritance 2017-09-08 12:01:33 -07:00
Bruno Oliveira
9273e11f21 Merge branch 'master' into features 2017-09-07 13:59:10 -03:00
Bruno Oliveira
09349c344e Merge pull request #2757 from nicoddemus/release-3.2.2
Preparing release version 3.2.2
2017-09-07 13:54:31 -03:00
Evan
6cf515b164 Fix crash in FastFilesCompleter with no prefix 2017-09-08 00:14:56 +10:00
Ronny Pfannschmidt
6967f3070e Merge pull request #2711 from massich/mimic_raises_signature_in_warns
[MRG][feature] Change warns signature to mimic the raises call
2017-09-07 13:19:09 +02:00
Joan Massich
a0c6758202 Add changelog 2017-09-07 10:51:14 +02:00
Joan Massich
80d165475b Add documentation 2017-09-07 10:28:52 +02:00
Joan Massich
aa6a67044f Add match_regex functionality to warns 2017-09-07 09:58:03 +02:00
Bruno Oliveira
b55a4f805f Merge pull request #2744 from nicoddemus/pluggy-master
Add test environment using pluggy from master branch
2017-09-06 15:03:19 -03:00
Bruno Oliveira
d01f08e96f Merge branch 'features' into pluggy-master 2017-09-06 13:13:35 -03:00
Bruno Oliveira
e1f2254fc2 Merge pull request #2734 from RonnyPfannschmidt/simplify-string-safening
simplyfy ascii escaping by using backslashreplace error handling
2017-09-05 21:14:27 -03:00
Bruno Oliveira
10d43bd3bf Set xfail_strict=True in pytest's own test suite
Fix #2722
2017-09-05 19:57:26 -03:00
Bruno Oliveira
f825b4979b Merge remote-tracking branch 'upstream/master' into features 2017-09-05 19:44:33 -03:00
Bruno Oliveira
3d70727021 Improve wording in changelog entry 2017-09-05 19:36:53 -03:00
Bruno Oliveira
7d59b2e350 Fix call to outcome.force_result
Even though the test is not running at the moment (xfail), at least
we avoid future confusion
2017-09-05 19:08:20 -03:00
Bruno Oliveira
d9992558fc Refactor tox.ini so pluggymaster envs share definitions 2017-09-05 19:04:58 -03:00
Bruno Oliveira
d1f71b0575 Merge pull request #2752 from tarcisiofischer/issue-2751-fix-flaky-testdir
Issue 2751 fix flaky testdir
2017-09-05 18:51:08 -03:00
Tarcisio Fischer
de6b41e318 Update changelog and AUTHORS files, following the CONTRIBUTING guidelines 2017-09-05 15:46:32 -03:00
Tarcisio Fischer
8d1903fed3 Avoid creating arbitrary filenames for tmpdir on Testdir's constructor
Fixes #2751
2017-09-05 15:22:04 -03:00
Ronny Pfannschmidt
13eac944ae restore ascii escaping for python 3.3/3.4 2017-09-04 21:25:46 +02:00
Joan Massich
d8ecca5ebd Add test to design warns signature in TDD mimicking raises signature 2017-09-04 15:26:00 +02:00
Bruno Oliveira
9bbf14d0f6 Create explicit 'pluggymaster' env definitions
For some reason, the previous approach brakes 'coveralls' because
pip still tries to install the 'pluggy' master requirement
(git+https://...)
2017-09-01 20:40:14 -03:00
Bruno Oliveira
c42d966a40 Change all pytest report options to the more concise '-ra' in tox.ini 2017-09-01 18:57:42 -03:00
Bruno Oliveira
3dc0da9339 Remove __multicall__ warning and usages in testing
pluggy>=0.5 already warns about those
2017-09-01 18:53:06 -03:00
Bruno Oliveira
11ec6aeafb Add test environment using pluggy from master branch
Fix #2737
2017-09-01 18:33:30 -03:00
Ronny Pfannschmidt
9d373d83ac Merge pull request #2741 from nicoddemus/pytester-makepyfile
Encode utf-8 byte strings in pytester's makefile
2017-09-01 08:31:35 +02:00
Bruno Oliveira
221797c609 Encode utf-8 byte strings in pytester's makefile
Fix #2738
2017-08-31 18:49:06 -03:00
Ronny Pfannschmidt
78a027e128 simplyfy ascii escaping by using backslashreplace error handling 2017-08-30 16:43:16 +02:00
Ronny Pfannschmidt
488bbd2aeb Merge pull request #2719 from tgoodlet/stop_vendoring_pluggy
Stop vendoring pluggy
2017-08-29 09:08:07 +02:00
Tyler Goodlet
312891daa6 Add a trivial changelog entry 2017-08-25 15:34:42 -04:00
Tyler Goodlet
fe415e3ff8 Use latest patch release 2017-08-25 11:49:02 -04:00
Tyler Goodlet
ff35c17ecf Drop wrapper module; import directly 2017-08-25 11:46:55 -04:00
Tyler Goodlet
9ab83083d1 Update docs 2017-08-24 16:53:37 -04:00
Tyler Goodlet
756db2131f Drop vendoring from packaging 2017-08-24 16:53:24 -04:00
Tyler Goodlet
cb700208e8 Drop vendoring task 2017-08-24 16:48:54 -04:00
Tyler Goodlet
333a9ad7fa Stop vendoring pluggy
Resolves #2716
2017-08-24 15:54:33 -04:00
Ronny Pfannschmidt
5c0feb2877 Merge pull request #2680 from prokaktus/skipping-same-module
Fold skipped tests with global pytestmark variable
2017-08-15 10:52:24 +02:00
Bruno Oliveira
5f17caa156 Merge pull request #2675 from RonnyPfannschmidt/mark-callspeck
ensure callspecs contain the list of marks
2017-08-14 20:33:16 -03:00
prokaktus
98bf5fc9be Fold skipped tests with global pytestmark variable 2017-08-15 02:18:46 +03:00
Ronny Pfannschmidt
eb462582af fix #2675 - store marks correctly in callspecs 2017-08-10 19:46:36 +02:00
Ronny Pfannschmidt
9e62a31b63 Merge pull request #2650 from srinivasreddy/2642
Fixed#2642: Convert py module references to six module
2017-08-04 09:21:51 +02:00
Bruno Oliveira
2e33d9b35e Add changelog entry for using six for portability 2017-08-04 00:03:43 -03:00
Srinivas Reddy Thatiparthy
dc563e4954 convert py module references to six module 2017-08-04 08:05:03 +05:30
Bruno Oliveira
40254b64e5 Merge branch 'master' into features 2017-08-01 19:35:56 -03:00
Ronny Pfannschmidt
6e7547244b Merge pull request #2636 from RonnyPfannschmidt/remove-preinit
remove preinit, its no longer needed
2017-08-01 05:22:41 +02:00
Ronny Pfannschmidt
333ec8ba5a Merge pull request #2638 from RonnyPfannschmidt/function-definition
small code cleanups
2017-08-01 05:21:21 +02:00
Ronny Pfannschmidt
dcaeef7c10 take review comments into account 2017-07-31 22:21:09 +02:00
Bruno Oliveira
8a2e6a8d51 Fix linting 2017-07-31 16:49:30 -03:00
Ronny Pfannschmidt
74d536314f pytester: make pytest fullpath a constant 2017-07-31 18:18:53 +02:00
Ronny Pfannschmidt
ceb016514b remove dead code - Node._memoizedcall 2017-07-31 18:18:26 +02:00
Ronny Pfannschmidt
e90f876b34 remove the last own implementation of pytest_namespace 2017-07-31 13:48:25 +02:00
Ronny Pfannschmidt
c68a89b4a7 remove preinit, its no longer needed 2017-07-31 13:44:05 +02:00
Floris Bruynooghe
1f0d06641a Update text to only give access when wanted
Also clarify merging perms given the PR approval now available.
2017-02-19 15:16:34 -03:00
Dmitry Malinovsky
a63b34c685 Switch to item fspath 2016-12-20 10:44:09 +06:00
Dmitry Malinovsky
522d59e844 Use session.config.hook instead of ihook. Fixes #2124 2016-12-10 16:45:40 +06:00
Floris Bruynooghe
4c62cd451a Add section about how you become a committer 2016-11-17 21:25:22 +00:00
298 changed files with 28637 additions and 17573 deletions

View File

@@ -1,7 +1,4 @@
[run]
omit =
omit =
# standlonetemplate is read dynamically and tested by test_genscript
*standalonetemplate.py
# oldinterpret could be removed, as it is no longer used in py26+
*oldinterpret.py
vendored_packages

View File

@@ -1,15 +1,14 @@
Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs:
Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is
just a guideline):
- [ ] Add a new news fragment into the changelog folder
* name it `$issue_id.$type` for example (588.bug)
* if you don't have an issue_id change it to the pr id after creating the pr
* ensure type is one of `removal`, `feature`, `bugfix`, `vendor`, `doc` or `trivial`
* Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
- [ ] Target: for `bugfix`, `vendor`, `doc` or `trivial` fixes, target `master`; for removals or features target `features`;
- [ ] Make sure to include reasonable tests for your change if necessary
- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](/changelog/README.rst) for details.
- [ ] Target the `master` branch for bug fixes, documentation updates and trivial changes.
- [ ] Target the `features` branch for new features and removals/deprecations.
- [ ] Include documentation when adding new features.
- [ ] Include new tests or update existing tests when applicable.
Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please:
Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:
- [ ] Add yourself to `AUTHORS`;
- [ ] Add yourself to `AUTHORS` in alphabetical order;

3
.gitignore vendored
View File

@@ -19,7 +19,7 @@ include/
.hypothesis/
# autogenerated
_pytest/_version.py
src/_pytest/_version.py
# setuptools
.eggs/
@@ -33,6 +33,7 @@ env/
3rdparty/
.tox
.cache
.pytest_cache
.coverage
.ropeproject
.idea

36
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,36 @@
exclude: doc/en/example/py2py3/test_py2.py
repos:
- repo: https://github.com/ambv/black
rev: 18.4a4
hooks:
- id: black
args: [--safe, --quiet]
language_version: python3.6
- repo: https://github.com/asottile/blacken-docs
rev: v0.1.1
hooks:
- id: blacken-docs
additional_dependencies: [black==18.5b1]
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
exclude: _pytest/debugging.py
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v1.2.0
hooks:
- id: pyupgrade
- repo: local
hooks:
- id: rst
name: rst
entry: rst-lint --encoding utf-8
files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|changelog/.*)$
language: python
additional_dependencies: [pygments, restructuredtext_lint]
python_version: python3.6

View File

@@ -1,17 +1,19 @@
sudo: false
language: python
stages:
- linting
- test
- deploy
python:
- '3.6'
# command to install dependencies
install:
- pip install --upgrade --pre tox
# # command to run tests
env:
matrix:
# coveralls is not listed in tox's envlist, but should run in travis
- TOXENV=coveralls
# note: please use "tox --listenvs" to populate the build matrix below
- TOXENV=linting
# please remove the linting env in all cases
- TOXENV=py27
- TOXENV=py34
- TOXENV=py36
@@ -19,20 +21,18 @@ env:
- TOXENV=py27-xdist
- TOXENV=py27-trial
- TOXENV=py27-numpy
- TOXENV=py27-pluggymaster
- TOXENV=py36-pexpect
- TOXENV=py36-xdist
- TOXENV=py36-trial
- TOXENV=py36-numpy
- TOXENV=py36-pluggymaster
- TOXENV=py27-nobyte
- TOXENV=doctesting
- TOXENV=docs
matrix:
jobs:
include:
- env: TOXENV=py26
python: '2.6'
- env: TOXENV=py33
python: '3.3'
- env: TOXENV=pypy
python: 'pypy-5.4'
- env: TOXENV=py35
@@ -41,9 +41,30 @@ matrix:
python: '3.5'
- env: TOXENV=py37
python: 'nightly'
allow_failures:
- env: TOXENV=py37
python: 'nightly'
- stage: deploy
python: '3.6'
env:
install: pip install -U setuptools setuptools_scm
script: skip
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
- stage: linting
python: '3.6'
env:
install:
- pip install pre-commit
- pre-commit install-hooks
script:
- pre-commit run --all-files
script: tox --recreate
@@ -56,3 +77,7 @@ notifications:
skip_join: true
email:
- pytest-commit@python.org
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/pre-commit

35
AUTHORS
View File

@@ -3,21 +3,27 @@ merlinux GmbH, Germany, office at merlinux eu
Contributors include::
Aaron Coleman
Abdeali JK
Abhijeet Kasurde
Ahn Ki-Wook
Alan Velasco
Alexander Johnson
Alexei Kozlenok
Anatoly Bubenkoff
Anders Hovmöller
Andras Tim
Andreas Zeidler
Andrzej Ostrowski
Andy Freeland
Anthon van der Neut
Anthony Shaw
Anthony Sottile
Antony Lee
Armin Rigo
Aron Coyle
Aron Curzon
Aviral Verma
Aviv Palivoda
Barney Gale
Ben Webb
@@ -25,11 +31,14 @@ Benjamin Peterson
Bernard Pratz
Bob Ippolito
Brian Dorsey
Brian Maissy
Brian Okken
Brianna Laugher
Bruno Oliveira
Cal Leeming
Carl Friedrich Bolz
Carlos Jenkins
Ceridwen
Charles Cloud
Charnjit SiNGH (CCSJ)
Chris Lamb
@@ -37,6 +46,7 @@ Christian Boelsen
Christian Theunert
Christian Tismer
Christopher Gilling
Cyrus Maden
Daniel Grana
Daniel Hahler
Daniel Nuri
@@ -46,6 +56,7 @@ Dave Hunt
David Díaz-Barquero
David Mohr
David Vierra
Daw-Ran Liou
Denis Kirisov
Diego Russo
Dmitry Dygalo
@@ -64,34 +75,44 @@ Feng Ma
Florian Bruhin
Floris Bruynooghe
Gabriel Reis
George Kussumoto
Georgy Dyuldin
Graham Horler
Greg Price
Grig Gheorghiu
Grigorii Eremeev (budulianin)
Guido Wesdorp
Guoqiang Zhang
Harald Armin Massa
Henk-Jaap Wagenaar
Hugo van Kemenade
Hui Wang (coldnight)
Ian Bicking
Ian Lesperance
Jaap Broekhuizen
Jan Balster
Janne Vanhala
Jason R. Coombs
Javier Domingo Cansino
Javier Romero
Jeff Rackauckas
Jeff Widman
John Eddie Ayson
John Towler
Jon Sonesen
Jonas Obrist
Jordan Guymon
Jordan Moldow
Jordan Speicher
Joshua Bronson
Jurko Gospodnetić
Justyna Janczyszyn
Kale Kundert
Katarzyna Jachim
Katerina Koukiou
Kevin Cox
Kodi B. Arfer
Kostis Anagnostopoulos
Lawrence Mitchell
Lee Kamentsky
Lev Maximov
@@ -117,6 +138,7 @@ Matt Bachmann
Matt Duck
Matt Williams
Matthias Hafner
Maxim Filipenko
mbyt
Michael Aquilina
Michael Birtwell
@@ -125,22 +147,26 @@ Michael Seifert
Michal Wajszczuk
Mihai Capotă
Mike Lundy
Miro Hrončok
Nathaniel Waisbrot
Ned Batchelder
Neven Mundar
Nicolas Delaby
Oleg Pidsadnyi
Oleg Sushchenko
Oliver Bestwalter
Omar Kohl
Omer Hadari
Patrick Hayes
Paweł Adamczak
Pedro Algarvio
Pieter Mulder
Piotr Banaszkiewicz
Punyashloka Biswal
Quentin Pradet
Ralf Schmitt
Ran Benita
Raphael Castaneda
Raphael Pierzina
Raquel Alegre
Ravi Chandra
@@ -151,6 +177,7 @@ Ronny Pfannschmidt
Ross Lawley
Russel Winder
Ryan Wooden
Samuel Dion-Girardeau
Samuele Pedroni
Segev Finer
Simon Gomizelj
@@ -161,18 +188,26 @@ Stefan Zimmermann
Stefano Taschini
Steffen Allner
Stephan Obermann
Tarcisio Fischer
Tareq Alayan
Ted Xiao
Thomas Grainger
Thomas Hisch
Tim Strazny
Tom Dalton
Tom Viner
Trevor Bekolay
Tyler Goodlet
Tzu-ping Chung
Vasily Kuznetsov
Victor Uriarte
Vidar T. Fauske
Vitaly Lashmanov
Vlad Dragos
William Lee
Wouter van Ackooy
Xuan Luong
Xuecong Liao
Zoltán Máté
Roland Puntaier
Allan Feldman

File diff suppressed because it is too large Load Diff

View File

@@ -48,8 +48,7 @@ fix the bug itself.
Fix bugs
--------
Look through the GitHub issues for bugs. Here is a filter you can use:
https://github.com/pytest-dev/pytest/labels/bug
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.
@@ -60,8 +59,7 @@ Don't forget to check the issue trackers of your favourite plugins, too!
Implement features
------------------
Look through the GitHub issues for enhancements. Here is a filter you can use:
https://github.com/pytest-dev/pytest/labels/enhancement
Look through the `GitHub issues for enhancements <https://github.com/pytest-dev/pytest/labels/type:%20enhancement>`_.
:ref:`Talk <contact>` to developers to find out how you can implement specific
features.
@@ -120,7 +118,7 @@ the following:
- PyPI presence with a ``setup.py`` that contains a license, ``pytest-``
prefixed name, version number, authors, short and long description.
- a ``tox.ini`` for running tests using `tox <http://tox.testrun.org>`_.
- a ``tox.ini`` for running tests using `tox <https://tox.readthedocs.io>`_.
- a ``README.txt`` describing how to use the plugin and on which
platforms it runs.
@@ -141,7 +139,7 @@ Here's a rundown of how a repository transfer usually proceeds
* ``joedoe`` transfers repository ownership to ``pytest-dev`` administrator ``calvin``.
* ``calvin`` creates ``pytest-xyz-admin`` and ``pytest-xyz-developers`` teams, inviting ``joedoe`` to both as **maintainer**.
* ``calvin`` transfers repository to ``pytest-dev`` and configures team access:
- ``pytest-xyz-admin`` **admin** access;
- ``pytest-xyz-developers`` **write** access;
@@ -164,10 +162,11 @@ Preparing Pull Requests
Short version
~~~~~~~~~~~~~
#. Fork the repository;
#. Target ``master`` for bugfixes and doc changes;
#. 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**. There's a ``tox`` command to help fixing it: ``tox -e fix-lint``.
#. Follow **PEP-8** for naming and `black <https://github.com/ambv/black>`_ for formatting.
#. Tests are run using ``tox``::
tox -e linting,py27,py36
@@ -177,7 +176,8 @@ Short version
#. Write a ``changelog`` entry: ``changelog/2574.bugfix``, use issue id number
and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or
``trivial`` for the issue type.
#. Add yourself to ``AUTHORS`` file if not there yet, in alphabetical order.
#. 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.
Long version
@@ -203,20 +203,30 @@ 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":
$ git checkout -b your-bugfix-branch-name master
# 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
be released in micro releases whereas features will be released in
Given we have "major.minor.micro" version numbers, bugfixes 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::
$ pip install --user pre-commit
$ pre-commit install
Afterwards ``pre-commit`` will run whenever you commit.
https://pre-commit.com/ is a framework for managing and maintaining multi-language pre-commit hooks
to ensure code-style and code formatting is consistent.
#. Install tox
Tox is used to run all the tests and will automatically setup virtualenvs
@@ -235,15 +245,7 @@ Here is a simple overview, with pytest-specific bits:
This command will run tests via the "tox" tool against Python 2.7 and 3.6
and also perform "lint" coding-style checks.
#. You can now edit your local working copy. Please follow PEP-8.
You can now make the changes you want and run the tests again as necessary.
If you have too much linting errors, try running::
$ tox -e fix-lint
To fix pep8 related errors.
#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming.
You can pass different options to ``tox``. For example, to run tests on Python 2.7 and pass options to pytest
(e.g. enter pdb on failure) to pytest you can do::
@@ -254,6 +256,9 @@ Here is a simple overview, with pytest-specific bits:
$ tox -e py36 -- testing/test_config.py
When committing, ``pre-commit`` will re-format the files if necessary.
#. Commit and push once your tests pass and you are happy with your change(s)::
$ git commit -a -m "<commit message>"
@@ -275,3 +280,15 @@ Here is a simple overview, with pytest-specific bits:
base: features # if it's a feature
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,
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.

View File

@@ -1,5 +1,9 @@
How to release pytest
--------------------------------------------
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::
@@ -8,7 +12,7 @@ How to release pytest
#. Install development dependencies in a virtual environment with::
pip3 install -r tasks/requirements.txt
pip3 install -U -r tasks/requirements.txt
#. Create a branch ``release-X.Y.Z`` with the version for the release.
@@ -18,44 +22,28 @@ How to release pytest
Ensure your are in a clean work tree.
#. Generate docs, changelog, announcements and upload a package to
your ``devpi`` staging server::
#. Generate docs, changelog, announcements and a **local** tag::
invoke generate.pre_release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD>
If ``--password`` is not given, it is assumed the user is already logged in ``devpi``.
If you don't have an account, please ask for one.
invoke generate.pre-release <VERSION>
#. Open a PR for this branch targeting ``master``.
#. Test the package
#. After all tests pass and the PR has been approved, publish to PyPI by pushing the tag::
* **Manual method**
git push git@github.com:pytest-dev/pytest.git <VERSION>
Run from multiple machines::
Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
devpi use https://devpi.net/USER/dev
devpi test pytest==VERSION
#. Send an email announcement with the contents from::
Check that tests pass for relevant combinations with::
doc/en/announce/release-<VERSION>.rst
devpi list pytest
To the following mailing lists:
* **CI servers**
* pytest-dev@python.org (all releases)
* python-announce-list@python.org (all releases)
* testing-in-python@lists.idyll.org (only major/minor releases)
Configure a repository as per-instructions on
devpi-cloud-test_ to test the package on Travis_ and AppVeyor_.
All test environments should pass.
#. Publish to PyPI::
invoke generate.publish_release <VERSION> <DEVPI USER> <PYPI_NAME>
where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.
And announce it on `Twitter <https://twitter.com/>`_ with the ``#pytest`` hashtag.
#. After a minor/major release, merge ``release-X.Y.Z`` into ``master`` and push (or open a PR).
.. _devpi-cloud-test: https://github.com/obestwalter/devpi-cloud-test
.. _AppVeyor: https://www.appveyor.com/
.. _Travis: https://travis-ci.org

View File

@@ -6,13 +6,13 @@
------
.. image:: https://img.shields.io/pypi/v/pytest.svg
:target: https://pypi.python.org/pypi/pytest
:target: https://pypi.org/project/pytest/
.. image:: https://anaconda.org/conda-forge/pytest/badges/version.svg
.. image:: https://img.shields.io/conda/vn/conda-forge/pytest.svg
:target: https://anaconda.org/conda-forge/pytest
.. image:: https://img.shields.io/pypi/pyversions/pytest.svg
:target: https://pypi.python.org/pypi/pytest
:target: https://pypi.org/project/pytest/
.. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg
:target: https://coveralls.io/r/pytest-dev/pytest
@@ -23,6 +23,12 @@
.. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true
:target: https://ci.appveyor.com/project/pytestbot/pytest
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
:target: https://www.codetriage.com/pytest-dev/pytest
The ``pytest`` framework makes it easy to write small tests, yet
scales to support complex functional testing for applications and libraries.
@@ -34,6 +40,7 @@ An example of a simple test:
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 5
@@ -76,7 +83,7 @@ Features
- Can run `unittest <http://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
`nose <http://docs.pytest.org/en/latest/nose.html>`_ test suites out of the box;
- Python2.6+, Python3.3+, PyPy-2.3, Jython-2.5 (untested);
- Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
- Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community;

View File

@@ -1,11 +0,0 @@
"""
imports symbols from vendored "pluggy" if available, otherwise
falls back to importing "pluggy" from the default namespace.
"""
from __future__ import absolute_import, division, print_function
try:
from _pytest.vendored_packages.pluggy import * # noqa
from _pytest.vendored_packages.pluggy import __version__ # noqa
except ImportError:
from pluggy import * # noqa
from pluggy import __version__ # noqa

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +0,0 @@
"""
This module contains deprecation messages and bits of code used elsewhere in the codebase
that is planned to be removed in the next pytest release.
Keeping it in a central location makes it easy to track what is deprecated and should
be removed when the time comes.
"""
from __future__ import absolute_import, division, print_function
class RemovedInPytest4Warning(DeprecationWarning):
"""warning class for features removed in pytest 4.0"""
MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \
'pass a list of arguments instead.'
YIELD_TESTS = 'yield tests are deprecated, and scheduled to be removed in pytest 4.0'
FUNCARG_PREFIX = (
'{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated '
'and scheduled to be removed in pytest 4.0. '
'Please remove the prefix and use the @pytest.fixture decorator instead.')
SETUP_CFG_PYTEST = '[pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.'
GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"
RESULT_LOG = (
'--result-log is deprecated and scheduled for removal in pytest 4.0.\n'
'See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information.'
)
MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
"MarkInfo objects are deprecated as they contain the merged marks"
)
MARK_PARAMETERSET_UNPACKING = RemovedInPytest4Warning(
"Applying marks directly to parameters is deprecated,"
" please use pytest.param(..., marks=...) instead.\n"
"For more details, see: https://docs.pytest.org/en/latest/parametrize.html"
)

View File

@@ -1,362 +0,0 @@
""" discover and run doctests in modules and test files."""
from __future__ import absolute_import, division, print_function
import traceback
import pytest
from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
from _pytest.fixtures import FixtureRequest
DOCTEST_REPORT_CHOICE_NONE = 'none'
DOCTEST_REPORT_CHOICE_CDIFF = 'cdiff'
DOCTEST_REPORT_CHOICE_NDIFF = 'ndiff'
DOCTEST_REPORT_CHOICE_UDIFF = 'udiff'
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE = 'only_first_failure'
DOCTEST_REPORT_CHOICES = (
DOCTEST_REPORT_CHOICE_NONE,
DOCTEST_REPORT_CHOICE_CDIFF,
DOCTEST_REPORT_CHOICE_NDIFF,
DOCTEST_REPORT_CHOICE_UDIFF,
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE,
)
def pytest_addoption(parser):
parser.addini('doctest_optionflags', 'option flags for doctests',
type="args", default=["ELLIPSIS"])
parser.addini("doctest_encoding", 'encoding used for doctest files', default="utf-8")
group = parser.getgroup("collect")
group.addoption("--doctest-modules",
action="store_true", default=False,
help="run doctests in all .py modules",
dest="doctestmodules")
group.addoption("--doctest-report",
type=str.lower, default="udiff",
help="choose another output format for diffs on doctest failure",
choices=DOCTEST_REPORT_CHOICES,
dest="doctestreport")
group.addoption("--doctest-glob",
action="append", default=[], metavar="pat",
help="doctests file matching pattern, default: test*.txt",
dest="doctestglob")
group.addoption("--doctest-ignore-import-errors",
action="store_true", default=False,
help="ignore doctest ImportErrors",
dest="doctest_ignore_import_errors")
def pytest_collect_file(path, parent):
config = parent.config
if path.ext == ".py":
if config.option.doctestmodules:
return DoctestModule(path, parent)
elif _is_doctest(config, path, parent):
return DoctestTextfile(path, parent)
def _is_doctest(config, path, parent):
if path.ext in ('.txt', '.rst') and parent.session.isinitpath(path):
return True
globs = config.getoption("doctestglob") or ['test*.txt']
for glob in globs:
if path.check(fnmatch=glob):
return True
return False
class ReprFailDoctest(TerminalRepr):
def __init__(self, reprlocation, lines):
self.reprlocation = reprlocation
self.lines = lines
def toterminal(self, tw):
for line in self.lines:
tw.line(line)
self.reprlocation.toterminal(tw)
class DoctestItem(pytest.Item):
def __init__(self, name, parent, runner=None, dtest=None):
super(DoctestItem, self).__init__(name, parent)
self.runner = runner
self.dtest = dtest
self.obj = None
self.fixture_request = None
def setup(self):
if self.dtest is not None:
self.fixture_request = _setup_fixtures(self)
globs = dict(getfixture=self.fixture_request.getfixturevalue)
for name, value in self.fixture_request.getfixturevalue('doctest_namespace').items():
globs[name] = value
self.dtest.globs.update(globs)
def runtest(self):
_check_all_skipped(self.dtest)
self.runner.run(self.dtest)
def repr_failure(self, excinfo):
import doctest
if excinfo.errisinstance((doctest.DocTestFailure,
doctest.UnexpectedException)):
doctestfailure = excinfo.value
example = doctestfailure.example
test = doctestfailure.test
filename = test.filename
if test.lineno is None:
lineno = None
else:
lineno = test.lineno + example.lineno + 1
message = excinfo.type.__name__
reprlocation = ReprFileLocation(filename, lineno, message)
checker = _get_checker()
report_choice = _get_report_choice(self.config.getoption("doctestreport"))
if lineno is not None:
lines = doctestfailure.test.docstring.splitlines(False)
# add line numbers to the left of the error message
lines = ["%03d %s" % (i + test.lineno + 1, x)
for (i, x) in enumerate(lines)]
# trim docstring error lines to 10
lines = lines[example.lineno - 9:example.lineno + 1]
else:
lines = ['EXAMPLE LOCATION UNKNOWN, not showing all tests of that example']
indent = '>>>'
for line in example.source.splitlines():
lines.append('??? %s %s' % (indent, line))
indent = '...'
if excinfo.errisinstance(doctest.DocTestFailure):
lines += checker.output_difference(example,
doctestfailure.got, report_choice).split("\n")
else:
inner_excinfo = ExceptionInfo(excinfo.value.exc_info)
lines += ["UNEXPECTED EXCEPTION: %s" %
repr(inner_excinfo.value)]
lines += traceback.format_exception(*excinfo.value.exc_info)
return ReprFailDoctest(reprlocation, lines)
else:
return super(DoctestItem, self).repr_failure(excinfo)
def reportinfo(self):
return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name
def _get_flag_lookup():
import doctest
return dict(DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
ELLIPSIS=doctest.ELLIPSIS,
IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL,
COMPARISON_FLAGS=doctest.COMPARISON_FLAGS,
ALLOW_UNICODE=_get_allow_unicode_flag(),
ALLOW_BYTES=_get_allow_bytes_flag(),
)
def get_optionflags(parent):
optionflags_str = parent.config.getini("doctest_optionflags")
flag_lookup_table = _get_flag_lookup()
flag_acc = 0
for flag in optionflags_str:
flag_acc |= flag_lookup_table[flag]
return flag_acc
class DoctestTextfile(pytest.Module):
obj = None
def collect(self):
import doctest
# inspired by doctest.testfile; ideally we would use it directly,
# but it doesn't support passing a custom checker
encoding = self.config.getini("doctest_encoding")
text = self.fspath.read_text(encoding)
filename = str(self.fspath)
name = self.fspath.basename
globs = {'__name__': '__main__'}
optionflags = get_optionflags(self)
runner = doctest.DebugRunner(verbose=0, optionflags=optionflags,
checker=_get_checker())
_fix_spoof_python2(runner, encoding)
parser = doctest.DocTestParser()
test = parser.get_doctest(text, globs, name, filename, 0)
if test.examples:
yield DoctestItem(test.name, self, runner, test)
def _check_all_skipped(test):
"""raises pytest.skip() if all examples in the given DocTest have the SKIP
option set.
"""
import doctest
all_skipped = all(x.options.get(doctest.SKIP, False) for x in test.examples)
if all_skipped:
pytest.skip('all tests skipped by +SKIP option')
class DoctestModule(pytest.Module):
def collect(self):
import doctest
if self.fspath.basename == "conftest.py":
module = self.config.pluginmanager._importconftest(self.fspath)
else:
try:
module = self.fspath.pyimport()
except ImportError:
if self.config.getvalue('doctest_ignore_import_errors'):
pytest.skip('unable to import module %r' % self.fspath)
else:
raise
# uses internal doctest module parsing mechanism
finder = doctest.DocTestFinder()
optionflags = get_optionflags(self)
runner = doctest.DebugRunner(verbose=0, optionflags=optionflags,
checker=_get_checker())
for test in finder.find(module, module.__name__):
if test.examples: # skip empty doctests
yield DoctestItem(test.name, self, runner, test)
def _setup_fixtures(doctest_item):
"""
Used by DoctestTextfile and DoctestItem to setup fixture information.
"""
def func():
pass
doctest_item.funcargs = {}
fm = doctest_item.session._fixturemanager
doctest_item._fixtureinfo = fm.getfixtureinfo(node=doctest_item, func=func,
cls=None, funcargs=False)
fixture_request = FixtureRequest(doctest_item)
fixture_request._fillfixtures()
return fixture_request
def _get_checker():
"""
Returns a doctest.OutputChecker subclass that takes in account the
ALLOW_UNICODE option to ignore u'' prefixes in strings and ALLOW_BYTES
to strip b'' prefixes.
Useful when the same doctest should run in Python 2 and Python 3.
An inner class is used to avoid importing "doctest" at the module
level.
"""
if hasattr(_get_checker, 'LiteralsOutputChecker'):
return _get_checker.LiteralsOutputChecker()
import doctest
import re
class LiteralsOutputChecker(doctest.OutputChecker):
"""
Copied from doctest_nose_plugin.py from the nltk project:
https://github.com/nltk/nltk
Further extended to also support byte literals.
"""
_unicode_literal_re = re.compile(r"(\W|^)[uU]([rR]?[\'\"])", re.UNICODE)
_bytes_literal_re = re.compile(r"(\W|^)[bB]([rR]?[\'\"])", re.UNICODE)
def check_output(self, want, got, optionflags):
res = doctest.OutputChecker.check_output(self, want, got,
optionflags)
if res:
return True
allow_unicode = optionflags & _get_allow_unicode_flag()
allow_bytes = optionflags & _get_allow_bytes_flag()
if not allow_unicode and not allow_bytes:
return False
else: # pragma: no cover
def remove_prefixes(regex, txt):
return re.sub(regex, r'\1\2', txt)
if allow_unicode:
want = remove_prefixes(self._unicode_literal_re, want)
got = remove_prefixes(self._unicode_literal_re, got)
if allow_bytes:
want = remove_prefixes(self._bytes_literal_re, want)
got = remove_prefixes(self._bytes_literal_re, got)
res = doctest.OutputChecker.check_output(self, want, got,
optionflags)
return res
_get_checker.LiteralsOutputChecker = LiteralsOutputChecker
return _get_checker.LiteralsOutputChecker()
def _get_allow_unicode_flag():
"""
Registers and returns the ALLOW_UNICODE flag.
"""
import doctest
return doctest.register_optionflag('ALLOW_UNICODE')
def _get_allow_bytes_flag():
"""
Registers and returns the ALLOW_BYTES flag.
"""
import doctest
return doctest.register_optionflag('ALLOW_BYTES')
def _get_report_choice(key):
"""
This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
"""
import doctest
return {
DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
DOCTEST_REPORT_CHOICE_NONE: 0,
}[key]
def _fix_spoof_python2(runner, encoding):
"""
Installs a "SpoofOut" into the given DebugRunner so it properly deals with unicode output. This
should patch only doctests for text files because they don't have a way to declare their
encoding. Doctests in docstrings from Python modules don't have the same problem given that
Python already decoded the strings.
This fixes the problem related in issue #2434.
"""
from _pytest.compat import _PY2
if not _PY2:
return
from doctest import _SpoofOut
class UnicodeSpoof(_SpoofOut):
def getvalue(self):
result = _SpoofOut.getvalue(self)
if encoding:
result = result.decode(encoding)
return result
runner._fakeout = UnicodeSpoof()
@pytest.fixture(scope='session')
def doctest_namespace():
"""
Inject names into the doctest namespace.
"""
return dict()

View File

@@ -1,826 +0,0 @@
""" core implementation of testing process: init, session, runtest loop. """
from __future__ import absolute_import, division, print_function
import functools
import os
import sys
import _pytest
import _pytest._code
import py
try:
from collections import MutableMapping as MappingMixin
except ImportError:
from UserDict import DictMixin as MappingMixin
from _pytest.config import directory_arg, UsageError, hookimpl
from _pytest.runner import collect_one_node
from _pytest.outcomes import exit
tracebackcutdir = py.path.local(_pytest.__file__).dirpath()
# exitcodes for the command line
EXIT_OK = 0
EXIT_TESTSFAILED = 1
EXIT_INTERRUPTED = 2
EXIT_INTERNALERROR = 3
EXIT_USAGEERROR = 4
EXIT_NOTESTSCOLLECTED = 5
def pytest_addoption(parser):
parser.addini("norecursedirs", "directory patterns to avoid for recursion",
type="args", default=['.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'])
parser.addini("testpaths", "directories to search for tests when no files or directories are given in the "
"command line.",
type="args", default=[])
# parser.addini("dirpatterns",
# "patterns specifying possible locations of test files",
# type="linelist", default=["**/test_*.txt",
# "**/test_*.py", "**/*_test.py"]
# )
group = parser.getgroup("general", "running and selection options")
group._addoption('-x', '--exitfirst', action="store_const",
dest="maxfail", const=1,
help="exit instantly on first error or failed test."),
group._addoption('--maxfail', metavar="num",
action="store", type=int, dest="maxfail", default=0,
help="exit after first num failures or errors.")
group._addoption('--strict', action="store_true",
help="marks not registered in configuration file raise errors.")
group._addoption("-c", metavar="file", type=str, dest="inifilename",
help="load configuration from `file` instead of trying to locate one of the implicit "
"configuration files.")
group._addoption("--continue-on-collection-errors", action="store_true",
default=False, dest="continue_on_collection_errors",
help="Force test execution even if collection errors occur.")
group = parser.getgroup("collect", "collection")
group.addoption('--collectonly', '--collect-only', action="store_true",
help="only collect tests, don't execute them."),
group.addoption('--pyargs', action="store_true",
help="try to interpret all arguments as python packages.")
group.addoption("--ignore", action="append", metavar="path",
help="ignore path during collection (multi-allowed).")
# when changing this to --conf-cut-dir, config.py Conftest.setinitial
# needs upgrading as well
group.addoption('--confcutdir', dest="confcutdir", default=None,
metavar="dir", type=functools.partial(directory_arg, optname="--confcutdir"),
help="only load conftest.py's relative to specified dir.")
group.addoption('--noconftest', action="store_true",
dest="noconftest", default=False,
help="Don't load any conftest.py files.")
group.addoption('--keepduplicates', '--keep-duplicates', action="store_true",
dest="keepduplicates", default=False,
help="Keep duplicate tests.")
group.addoption('--collect-in-virtualenv', action='store_true',
dest='collect_in_virtualenv', default=False,
help="Don't ignore tests in a local virtualenv directory")
group = parser.getgroup("debugconfig",
"test session debugging and configuration")
group.addoption('--basetemp', dest="basetemp", default=None, metavar="dir",
help="base temporary directory for this test run.")
def pytest_namespace():
"""keeping this one works around a deeper startup issue in pytest
i tried to find it for a while but the amount of time turned unsustainable,
so i put a hack in to revisit later
"""
return {}
def pytest_configure(config):
__import__('pytest').config = config # compatibiltiy
def wrap_session(config, doit):
"""Skeleton command line program"""
session = Session(config)
session.exitstatus = EXIT_OK
initstate = 0
try:
try:
config._do_configure()
initstate = 1
config.hook.pytest_sessionstart(session=session)
initstate = 2
session.exitstatus = doit(config, session) or 0
except UsageError:
raise
except KeyboardInterrupt:
excinfo = _pytest._code.ExceptionInfo()
if initstate < 2 and isinstance(excinfo.value, exit.Exception):
sys.stderr.write('{0}: {1}\n'.format(
excinfo.typename, excinfo.value.msg))
config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
session.exitstatus = EXIT_INTERRUPTED
except:
excinfo = _pytest._code.ExceptionInfo()
config.notify_exception(excinfo, config.option)
session.exitstatus = EXIT_INTERNALERROR
if excinfo.errisinstance(SystemExit):
sys.stderr.write("mainloop: caught Spurious SystemExit!\n")
finally:
excinfo = None # Explicitly break reference cycle.
session.startdir.chdir()
if initstate >= 2:
config.hook.pytest_sessionfinish(
session=session,
exitstatus=session.exitstatus)
config._ensure_unconfigure()
return session.exitstatus
def pytest_cmdline_main(config):
return wrap_session(config, _main)
def _main(config, session):
""" default command line protocol for initialization, session,
running tests and reporting. """
config.hook.pytest_collection(session=session)
config.hook.pytest_runtestloop(session=session)
if session.testsfailed:
return EXIT_TESTSFAILED
elif session.testscollected == 0:
return EXIT_NOTESTSCOLLECTED
def pytest_collection(session):
return session.perform_collect()
def pytest_runtestloop(session):
if (session.testsfailed and
not session.config.option.continue_on_collection_errors):
raise session.Interrupted(
"%d errors during collection" % session.testsfailed)
if session.config.option.collectonly:
return True
for i, item in enumerate(session.items):
nextitem = session.items[i + 1] if i + 1 < len(session.items) else None
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
if session.shouldstop:
raise session.Interrupted(session.shouldstop)
return True
def _in_venv(path):
"""Attempts to detect if ``path`` is the root of a Virtual Environment by
checking for the existence of the appropriate activate script"""
bindir = path.join('Scripts' if sys.platform.startswith('win') else 'bin')
if not bindir.exists():
return False
activates = ('activate', 'activate.csh', 'activate.fish',
'Activate', 'Activate.bat', 'Activate.ps1')
return any([fname.basename in activates for fname in bindir.listdir()])
def pytest_ignore_collect(path, config):
ignore_paths = config._getconftest_pathlist("collect_ignore", path=path.dirpath())
ignore_paths = ignore_paths or []
excludeopt = config.getoption("ignore")
if excludeopt:
ignore_paths.extend([py.path.local(x) for x in excludeopt])
if py.path.local(path) in ignore_paths:
return True
allow_in_venv = config.getoption("collect_in_virtualenv")
if _in_venv(path) and not allow_in_venv:
return True
# Skip duplicate paths.
keepduplicates = config.getoption("keepduplicates")
duplicate_paths = config.pluginmanager._duplicatepaths
if not keepduplicates:
if path in duplicate_paths:
return True
else:
duplicate_paths.add(path)
return False
class FSHookProxy:
def __init__(self, fspath, pm, remove_mods):
self.fspath = fspath
self.pm = pm
self.remove_mods = remove_mods
def __getattr__(self, name):
x = self.pm.subset_hook_caller(name, remove_plugins=self.remove_mods)
self.__dict__[name] = x
return x
class _CompatProperty(object):
def __init__(self, name):
self.name = name
def __get__(self, obj, owner):
if obj is None:
return self
# TODO: reenable in the features branch
# warnings.warn(
# "usage of {owner!r}.{name} is deprecated, please use pytest.{name} instead".format(
# name=self.name, owner=type(owner).__name__),
# PendingDeprecationWarning, stacklevel=2)
return getattr(__import__('pytest'), self.name)
class NodeKeywords(MappingMixin):
def __init__(self, node):
self.node = node
self.parent = node.parent
self._markers = {node.name: True}
def __getitem__(self, key):
try:
return self._markers[key]
except KeyError:
if self.parent is None:
raise
return self.parent.keywords[key]
def __setitem__(self, key, value):
self._markers[key] = value
def __delitem__(self, key):
raise ValueError("cannot delete key in keywords dict")
def __iter__(self):
seen = set(self._markers)
if self.parent is not None:
seen.update(self.parent.keywords)
return iter(seen)
def __len__(self):
return len(self.__iter__())
def keys(self):
return list(self)
def __repr__(self):
return "<NodeKeywords for node %s>" % (self.node, )
class Node(object):
""" base class for Collector and Item the test collection tree.
Collector subclasses have children, Items are terminal nodes."""
def __init__(self, name, parent=None, config=None, session=None):
#: a unique name within the scope of the parent node
self.name = name
#: the parent collector node.
self.parent = parent
#: the pytest config object
self.config = config or parent.config
#: the session this node is part of
self.session = session or parent.session
#: filesystem path where this node was collected from (can be None)
self.fspath = getattr(parent, 'fspath', None)
#: keywords/markers collected from all scopes
self.keywords = NodeKeywords(self)
#: allow adding of extra keywords to use for matching
self.extra_keyword_matches = set()
# used for storing artificial fixturedefs for direct parametrization
self._name2pseudofixturedef = {}
@property
def ihook(self):
""" fspath sensitive hook proxy used to call pytest hooks"""
return self.session.gethookproxy(self.fspath)
Module = _CompatProperty("Module")
Class = _CompatProperty("Class")
Instance = _CompatProperty("Instance")
Function = _CompatProperty("Function")
File = _CompatProperty("File")
Item = _CompatProperty("Item")
def _getcustomclass(self, name):
maybe_compatprop = getattr(type(self), name)
if isinstance(maybe_compatprop, _CompatProperty):
return getattr(__import__('pytest'), name)
else:
cls = getattr(self, name)
# TODO: reenable in the features branch
# warnings.warn("use of node.%s is deprecated, "
# "use pytest_pycollect_makeitem(...) to create custom "
# "collection nodes" % name, category=DeprecationWarning)
return cls
def __repr__(self):
return "<%s %r>" % (self.__class__.__name__,
getattr(self, 'name', None))
def warn(self, code, message):
""" generate a warning with the given code and message for this
item. """
assert isinstance(code, str)
fslocation = getattr(self, "location", None)
if fslocation is None:
fslocation = getattr(self, "fspath", None)
self.ihook.pytest_logwarning.call_historic(kwargs=dict(
code=code, message=message,
nodeid=self.nodeid, fslocation=fslocation))
# methods for ordering nodes
@property
def nodeid(self):
""" a ::-separated string denoting its collection tree address. """
try:
return self._nodeid
except AttributeError:
self._nodeid = x = self._makeid()
return x
def _makeid(self):
return self.parent.nodeid + "::" + self.name
def __hash__(self):
return hash(self.nodeid)
def setup(self):
pass
def teardown(self):
pass
def _memoizedcall(self, attrname, function):
exattrname = "_ex_" + attrname
failure = getattr(self, exattrname, None)
if failure is not None:
py.builtin._reraise(failure[0], failure[1], failure[2])
if hasattr(self, attrname):
return getattr(self, attrname)
try:
res = function()
except py.builtin._sysex:
raise
except:
failure = sys.exc_info()
setattr(self, exattrname, failure)
raise
setattr(self, attrname, res)
return res
def listchain(self):
""" return list of all parent collectors up to self,
starting from root of collection tree. """
chain = []
item = self
while item is not None:
chain.append(item)
item = item.parent
chain.reverse()
return chain
def add_marker(self, marker):
""" dynamically add a marker object to the node.
``marker`` can be a string or pytest.mark.* instance.
"""
from _pytest.mark import MarkDecorator, MARK_GEN
if isinstance(marker, py.builtin._basestring):
marker = getattr(MARK_GEN, marker)
elif not isinstance(marker, MarkDecorator):
raise ValueError("is not a string or pytest.mark.* Marker")
self.keywords[marker.name] = marker
def get_marker(self, name):
""" get a marker object from this node or None if
the node doesn't have a marker with that name. """
val = self.keywords.get(name, None)
if val is not None:
from _pytest.mark import MarkInfo, MarkDecorator
if isinstance(val, (MarkDecorator, MarkInfo)):
return val
def listextrakeywords(self):
""" Return a set of all extra keywords in self and any parents."""
extra_keywords = set()
item = self
for item in self.listchain():
extra_keywords.update(item.extra_keyword_matches)
return extra_keywords
def listnames(self):
return [x.name for x in self.listchain()]
def addfinalizer(self, fin):
""" register a function to be called when this node is finalized.
This method can only be called when this node is active
in a setup chain, for example during self.setup().
"""
self.session._setupstate.addfinalizer(fin, self)
def getparent(self, cls):
""" get the next parent node (including ourself)
which is an instance of the given class"""
current = self
while current and not isinstance(current, cls):
current = current.parent
return current
def _prunetraceback(self, excinfo):
pass
def _repr_failure_py(self, excinfo, style=None):
fm = self.session._fixturemanager
if excinfo.errisinstance(fm.FixtureLookupError):
return excinfo.value.formatrepr()
tbfilter = True
if self.config.option.fulltrace:
style = "long"
else:
tb = _pytest._code.Traceback([excinfo.traceback[-1]])
self._prunetraceback(excinfo)
if len(excinfo.traceback) == 0:
excinfo.traceback = tb
tbfilter = False # prunetraceback already does it
if style == "auto":
style = "long"
# XXX should excinfo.getrepr record all data and toterminal() process it?
if style is None:
if self.config.option.tbstyle == "short":
style = "short"
else:
style = "long"
try:
os.getcwd()
abspath = False
except OSError:
abspath = True
return excinfo.getrepr(funcargs=True, abspath=abspath,
showlocals=self.config.option.showlocals,
style=style, tbfilter=tbfilter)
repr_failure = _repr_failure_py
class Collector(Node):
""" Collector instances create children through collect()
and thus iteratively build a tree.
"""
class CollectError(Exception):
""" an error during collection, contains a custom message. """
def collect(self):
""" returns a list of children (items and collectors)
for this collection node.
"""
raise NotImplementedError("abstract")
def repr_failure(self, excinfo):
""" represent a collection failure. """
if excinfo.errisinstance(self.CollectError):
exc = excinfo.value
return str(exc.args[0])
return self._repr_failure_py(excinfo, style="short")
def _prunetraceback(self, excinfo):
if hasattr(self, 'fspath'):
traceback = excinfo.traceback
ntraceback = traceback.cut(path=self.fspath)
if ntraceback == traceback:
ntraceback = ntraceback.cut(excludepath=tracebackcutdir)
excinfo.traceback = ntraceback.filter()
class FSCollector(Collector):
def __init__(self, fspath, parent=None, config=None, session=None):
fspath = py.path.local(fspath) # xxx only for test_resultlog.py?
name = fspath.basename
if parent is not None:
rel = fspath.relto(parent.fspath)
if rel:
name = rel
name = name.replace(os.sep, "/")
super(FSCollector, self).__init__(name, parent, config, session)
self.fspath = fspath
def _makeid(self):
relpath = self.fspath.relto(self.config.rootdir)
if os.sep != "/":
relpath = relpath.replace(os.sep, "/")
return relpath
class File(FSCollector):
""" base class for collecting tests from a file. """
class Item(Node):
""" a basic test invocation item. Note that for a single function
there might be multiple test invocation items.
"""
nextitem = None
def __init__(self, name, parent=None, config=None, session=None):
super(Item, self).__init__(name, parent, config, session)
self._report_sections = []
def add_report_section(self, when, key, content):
"""
Adds a new report section, similar to what's done internally to add stdout and
stderr captured output::
item.add_report_section("call", "stdout", "report section contents")
:param str when:
One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``.
:param str key:
Name of the section, can be customized at will. Pytest uses ``"stdout"`` and
``"stderr"`` internally.
:param str content:
The full contents as a string.
"""
if content:
self._report_sections.append((when, key, content))
def reportinfo(self):
return self.fspath, None, ""
@property
def location(self):
try:
return self._location
except AttributeError:
location = self.reportinfo()
# bestrelpath is a quite slow function
cache = self.config.__dict__.setdefault("_bestrelpathcache", {})
try:
fspath = cache[location[0]]
except KeyError:
fspath = self.session.fspath.bestrelpath(location[0])
cache[location[0]] = fspath
location = (fspath, location[1], str(location[2]))
self._location = location
return location
class NoMatch(Exception):
""" raised if matching cannot locate a matching names. """
class Interrupted(KeyboardInterrupt):
""" signals an interrupted test run. """
__module__ = 'builtins' # for py3
class Session(FSCollector):
Interrupted = Interrupted
def __init__(self, config):
FSCollector.__init__(self, config.rootdir, parent=None,
config=config, session=self)
self.testsfailed = 0
self.testscollected = 0
self.shouldstop = False
self.trace = config.trace.root.get("collection")
self._norecursepatterns = config.getini("norecursedirs")
self.startdir = py.path.local()
self.config.pluginmanager.register(self, name="session")
def _makeid(self):
return ""
@hookimpl(tryfirst=True)
def pytest_collectstart(self):
if self.shouldstop:
raise self.Interrupted(self.shouldstop)
@hookimpl(tryfirst=True)
def pytest_runtest_logreport(self, report):
if report.failed and not hasattr(report, 'wasxfail'):
self.testsfailed += 1
maxfail = self.config.getvalue("maxfail")
if maxfail and self.testsfailed >= maxfail:
self.shouldstop = "stopping after %d failures" % (
self.testsfailed)
pytest_collectreport = pytest_runtest_logreport
def isinitpath(self, path):
return path in self._initialpaths
def gethookproxy(self, fspath):
# check if we have the common case of running
# hooks with all conftest.py filesall conftest.py
pm = self.config.pluginmanager
my_conftestmodules = pm._getconftestmodules(fspath)
remove_mods = pm._conftest_plugins.difference(my_conftestmodules)
if remove_mods:
# one or more conftests are not in use at this fspath
proxy = FSHookProxy(fspath, pm, remove_mods)
else:
# all plugis are active for this fspath
proxy = self.config.hook
return proxy
def perform_collect(self, args=None, genitems=True):
hook = self.config.hook
try:
items = self._perform_collect(args, genitems)
self.config.pluginmanager.check_pending()
hook.pytest_collection_modifyitems(session=self,
config=self.config, items=items)
finally:
hook.pytest_collection_finish(session=self)
self.testscollected = len(items)
return items
def _perform_collect(self, args, genitems):
if args is None:
args = self.config.args
self.trace("perform_collect", self, args)
self.trace.root.indent += 1
self._notfound = []
self._initialpaths = set()
self._initialparts = []
self.items = items = []
for arg in args:
parts = self._parsearg(arg)
self._initialparts.append(parts)
self._initialpaths.add(parts[0])
rep = collect_one_node(self)
self.ihook.pytest_collectreport(report=rep)
self.trace.root.indent -= 1
if self._notfound:
errors = []
for arg, exc in self._notfound:
line = "(no name %r in any of %r)" % (arg, exc.args[0])
errors.append("not found: %s\n%s" % (arg, line))
# XXX: test this
raise UsageError(*errors)
if not genitems:
return rep.result
else:
if rep.passed:
for node in rep.result:
self.items.extend(self.genitems(node))
return items
def collect(self):
for parts in self._initialparts:
arg = "::".join(map(str, parts))
self.trace("processing argument", arg)
self.trace.root.indent += 1
try:
for x in self._collect(arg):
yield x
except NoMatch:
# we are inside a make_report hook so
# we cannot directly pass through the exception
self._notfound.append((arg, sys.exc_info()[1]))
self.trace.root.indent -= 1
def _collect(self, arg):
names = self._parsearg(arg)
path = names.pop(0)
if path.check(dir=1):
assert not names, "invalid arg %r" % (arg,)
for path in path.visit(fil=lambda x: x.check(file=1),
rec=self._recurse, bf=True, sort=True):
for x in self._collectfile(path):
yield x
else:
assert path.check(file=1)
for x in self.matchnodes(self._collectfile(path), names):
yield x
def _collectfile(self, path):
ihook = self.gethookproxy(path)
if not self.isinitpath(path):
if ihook.pytest_ignore_collect(path=path, config=self.config):
return ()
return ihook.pytest_collect_file(path=path, parent=self)
def _recurse(self, path):
ihook = self.gethookproxy(path.dirpath())
if ihook.pytest_ignore_collect(path=path, config=self.config):
return
for pat in self._norecursepatterns:
if path.check(fnmatch=pat):
return False
ihook = self.gethookproxy(path)
ihook.pytest_collect_directory(path=path, parent=self)
return True
def _tryconvertpyarg(self, x):
"""Convert a dotted module name to path.
"""
import pkgutil
try:
loader = pkgutil.find_loader(x)
except ImportError:
return x
if loader is None:
return x
# This method is sometimes invoked when AssertionRewritingHook, which
# does not define a get_filename method, is already in place:
try:
path = loader.get_filename(x)
except AttributeError:
# Retrieve path from AssertionRewritingHook:
path = loader.modules[x][0].co_filename
if loader.is_package(x):
path = os.path.dirname(path)
return path
def _parsearg(self, arg):
""" return (fspath, names) tuple after checking the file exists. """
parts = str(arg).split("::")
if self.config.option.pyargs:
parts[0] = self._tryconvertpyarg(parts[0])
relpath = parts[0].replace("/", os.sep)
path = self.config.invocation_dir.join(relpath, abs=True)
if not path.check():
if self.config.option.pyargs:
raise UsageError(
"file or package not found: " + arg +
" (missing __init__.py?)")
else:
raise UsageError("file not found: " + arg)
parts[0] = path
return parts
def matchnodes(self, matching, names):
self.trace("matchnodes", matching, names)
self.trace.root.indent += 1
nodes = self._matchnodes(matching, names)
num = len(nodes)
self.trace("matchnodes finished -> ", num, "nodes")
self.trace.root.indent -= 1
if num == 0:
raise NoMatch(matching, names[:1])
return nodes
def _matchnodes(self, matching, names):
if not matching or not names:
return matching
name = names[0]
assert name
nextnames = names[1:]
resultnodes = []
for node in matching:
if isinstance(node, Item):
if not names:
resultnodes.append(node)
continue
assert isinstance(node, Collector)
rep = collect_one_node(node)
if rep.passed:
has_matched = False
for x in rep.result:
# TODO: remove parametrized workaround once collection structure contains parametrization
if x.name == name or x.name.split("[")[0] == name:
resultnodes.extend(self.matchnodes([x], nextnames))
has_matched = True
# XXX accept IDs that don't have "()" for class instances
if not has_matched and len(rep.result) == 1 and x.name == "()":
nextnames.insert(0, name)
resultnodes.extend(self.matchnodes([x], nextnames))
else:
# report collection failures here to avoid failing to run some test
# specified in the command line because the module could not be
# imported (#134)
node.ihook.pytest_collectreport(report=rep)
return resultnodes
def genitems(self, node):
self.trace("genitems", node)
if isinstance(node, Item):
node.ihook.pytest_itemcollected(item=node)
yield node
else:
assert isinstance(node, Collector)
rep = collect_one_node(node)
if rep.passed:
for subnode in rep.result:
for x in self.genitems(subnode):
yield x
node.ihook.pytest_collectreport(report=rep)

View File

@@ -1,463 +0,0 @@
""" generic mechanism for marking and selecting python functions. """
from __future__ import absolute_import, division, print_function
import inspect
import warnings
from collections import namedtuple
from operator import attrgetter
from .compat import imap
from .deprecated import MARK_PARAMETERSET_UNPACKING
def alias(name, warning=None):
getter = attrgetter(name)
def warned(self):
warnings.warn(warning, stacklevel=2)
return getter(self)
return property(getter if warning is None else warned, doc='alias for ' + name)
class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')):
@classmethod
def param(cls, *values, **kw):
marks = kw.pop('marks', ())
if isinstance(marks, MarkDecorator):
marks = marks,
else:
assert isinstance(marks, (tuple, list, set))
def param_extract_id(id=None):
return id
id = param_extract_id(**kw)
return cls(values, marks, id)
@classmethod
def extract_from(cls, parameterset, legacy_force_tuple=False):
"""
:param parameterset:
a legacy style parameterset that may or may not be a tuple,
and may or may not be wrapped into a mess of mark objects
:param legacy_force_tuple:
enforce tuple wrapping so single argument tuple values
don't get decomposed and break tests
"""
if isinstance(parameterset, cls):
return parameterset
if not isinstance(parameterset, MarkDecorator) and legacy_force_tuple:
return cls.param(parameterset)
newmarks = []
argval = parameterset
while isinstance(argval, MarkDecorator):
newmarks.append(MarkDecorator(Mark(
argval.markname, argval.args[:-1], argval.kwargs)))
argval = argval.args[-1]
assert not isinstance(argval, ParameterSet)
if legacy_force_tuple:
argval = argval,
if newmarks:
warnings.warn(MARK_PARAMETERSET_UNPACKING)
return cls(argval, marks=newmarks, id=None)
@property
def deprecated_arg_dict(self):
return dict((mark.name, mark) for mark in self.marks)
class MarkerError(Exception):
"""Error in use of a pytest marker/attribute."""
def param(*values, **kw):
return ParameterSet.param(*values, **kw)
def pytest_addoption(parser):
group = parser.getgroup("general")
group._addoption(
'-k',
action="store", dest="keyword", default='', metavar="EXPRESSION",
help="only run tests which match the given substring expression. "
"An expression is a python evaluatable expression "
"where all names are substring-matched against test names "
"and their parent classes. Example: -k 'test_method or test_"
"other' matches all test functions and classes whose name "
"contains 'test_method' or 'test_other'. "
"Additionally keywords are matched to classes and functions "
"containing extra names in their 'extra_keyword_matches' set, "
"as well as functions which have names assigned directly to them."
)
group._addoption(
"-m",
action="store", dest="markexpr", default="", metavar="MARKEXPR",
help="only run tests matching given mark expression. "
"example: -m 'mark1 and not mark2'."
)
group.addoption(
"--markers", action="store_true",
help="show markers (builtin, plugin and per-project ones)."
)
parser.addini("markers", "markers for test functions", 'linelist')
def pytest_cmdline_main(config):
import _pytest.config
if config.option.markers:
config._do_configure()
tw = _pytest.config.create_terminal_writer(config)
for line in config.getini("markers"):
name, rest = line.split(":", 1)
tw.write("@pytest.mark.%s:" % name, bold=True)
tw.line(rest)
tw.line()
config._ensure_unconfigure()
return 0
pytest_cmdline_main.tryfirst = True
def pytest_collection_modifyitems(items, config):
keywordexpr = config.option.keyword.lstrip()
matchexpr = config.option.markexpr
if not keywordexpr and not matchexpr:
return
# pytest used to allow "-" for negating
# but today we just allow "-" at the beginning, use "not" instead
# we probably remove "-" altogether soon
if keywordexpr.startswith("-"):
keywordexpr = "not " + keywordexpr[1:]
selectuntil = False
if keywordexpr[-1:] == ":":
selectuntil = True
keywordexpr = keywordexpr[:-1]
remaining = []
deselected = []
for colitem in items:
if keywordexpr and not matchkeyword(colitem, keywordexpr):
deselected.append(colitem)
else:
if selectuntil:
keywordexpr = None
if matchexpr:
if not matchmark(colitem, matchexpr):
deselected.append(colitem)
continue
remaining.append(colitem)
if deselected:
config.hook.pytest_deselected(items=deselected)
items[:] = remaining
class MarkMapping:
"""Provides a local mapping for markers where item access
resolves to True if the marker is present. """
def __init__(self, keywords):
mymarks = set()
for key, value in keywords.items():
if isinstance(value, MarkInfo) or isinstance(value, MarkDecorator):
mymarks.add(key)
self._mymarks = mymarks
def __getitem__(self, name):
return name in self._mymarks
class KeywordMapping:
"""Provides a local mapping for keywords.
Given a list of names, map any substring of one of these names to True.
"""
def __init__(self, names):
self._names = names
def __getitem__(self, subname):
for name in self._names:
if subname in name:
return True
return False
def matchmark(colitem, markexpr):
"""Tries to match on any marker names, attached to the given colitem."""
return eval(markexpr, {}, MarkMapping(colitem.keywords))
def matchkeyword(colitem, keywordexpr):
"""Tries to match given keyword expression to given collector item.
Will match on the name of colitem, including the names of its parents.
Only matches names of items which are either a :class:`Class` or a
:class:`Function`.
Additionally, matches on names in the 'extra_keyword_matches' set of
any item, as well as names directly assigned to test functions.
"""
mapped_names = set()
# Add the names of the current item and any parent items
import pytest
for item in colitem.listchain():
if not isinstance(item, pytest.Instance):
mapped_names.add(item.name)
# Add the names added as extra keywords to current or parent items
for name in colitem.listextrakeywords():
mapped_names.add(name)
# Add the names attached to the current function through direct assignment
if hasattr(colitem, 'function'):
for name in colitem.function.__dict__:
mapped_names.add(name)
mapping = KeywordMapping(mapped_names)
if " " not in keywordexpr:
# special case to allow for simple "-k pass" and "-k 1.3"
return mapping[keywordexpr]
elif keywordexpr.startswith("not ") and " " not in keywordexpr[4:]:
return not mapping[keywordexpr[4:]]
return eval(keywordexpr, {}, mapping)
def pytest_configure(config):
config._old_mark_config = MARK_GEN._config
if config.option.strict:
MARK_GEN._config = config
def pytest_unconfigure(config):
MARK_GEN._config = getattr(config, '_old_mark_config', None)
class MarkGenerator:
""" Factory for :class:`MarkDecorator` objects - exposed as
a ``pytest.mark`` singleton instance. Example::
import pytest
@pytest.mark.slowtest
def test_function():
pass
will set a 'slowtest' :class:`MarkInfo` object
on the ``test_function`` object. """
_config = None
def __getattr__(self, name):
if name[0] == "_":
raise AttributeError("Marker name must NOT start with underscore")
if self._config is not None:
self._check(name)
return MarkDecorator(Mark(name, (), {}))
def _check(self, name):
try:
if name in self._markers:
return
except AttributeError:
pass
self._markers = l = set()
for line in self._config.getini("markers"):
beginning = line.split(":", 1)
x = beginning[0].split("(", 1)[0]
l.add(x)
if name not in self._markers:
raise AttributeError("%r not a registered marker" % (name,))
def istestfunc(func):
return hasattr(func, "__call__") and \
getattr(func, "__name__", "<lambda>") != "<lambda>"
class MarkDecorator:
""" A decorator for test functions and test classes. When applied
it will create :class:`MarkInfo` objects which may be
:ref:`retrieved by hooks as item keywords <excontrolskip>`.
MarkDecorator instances are often created like this::
mark1 = pytest.mark.NAME # simple MarkDecorator
mark2 = pytest.mark.NAME(name1=value) # parametrized MarkDecorator
and can then be applied as decorators to test functions::
@mark2
def test_function():
pass
When a MarkDecorator instance is called it does the following:
1. If called with a single class as its only positional argument and no
additional keyword arguments, it attaches itself to the class so it
gets applied automatically to all test cases found in that class.
2. If called with a single function as its only positional argument and
no additional keyword arguments, it attaches a MarkInfo object to the
function, containing all the arguments already stored internally in
the MarkDecorator.
3. When called in any other case, it performs a 'fake construction' call,
i.e. it returns a new MarkDecorator instance with the original
MarkDecorator's content updated with the arguments passed to this
call.
Note: The rules above prevent MarkDecorator objects from storing only a
single function or class reference as their positional argument with no
additional keyword or positional arguments.
"""
def __init__(self, mark):
assert isinstance(mark, Mark), repr(mark)
self.mark = mark
name = alias('mark.name')
args = alias('mark.args')
kwargs = alias('mark.kwargs')
@property
def markname(self):
return self.name # for backward-compat (2.4.1 had this attr)
def __eq__(self, other):
return self.mark == other.mark
def __repr__(self):
return "<MarkDecorator %r>" % (self.mark,)
def with_args(self, *args, **kwargs):
""" return a MarkDecorator with extra arguments added
unlike call this can be used even if the sole argument is a callable/class
:return: MarkDecorator
"""
mark = Mark(self.name, args, kwargs)
return self.__class__(self.mark.combined_with(mark))
def __call__(self, *args, **kwargs):
""" if passed a single callable argument: decorate it with mark info.
otherwise add *args/**kwargs in-place to mark information. """
if args and not kwargs:
func = args[0]
is_class = inspect.isclass(func)
if len(args) == 1 and (istestfunc(func) or is_class):
if is_class:
store_mark(func, self.mark)
else:
store_legacy_markinfo(func, self.mark)
store_mark(func, self.mark)
return func
return self.with_args(*args, **kwargs)
def get_unpacked_marks(obj):
"""
obtain the unpacked marks that are stored on a object
"""
mark_list = getattr(obj, 'pytestmark', [])
if not isinstance(mark_list, list):
mark_list = [mark_list]
return [
getattr(mark, 'mark', mark) # unpack MarkDecorator
for mark in mark_list
]
def store_mark(obj, mark):
"""store a Mark on a object
this is used to implement the Mark declarations/decorators correctly
"""
assert isinstance(mark, Mark), mark
# always reassign name to avoid updating pytestmark
# in a referene that was only borrowed
obj.pytestmark = get_unpacked_marks(obj) + [mark]
def store_legacy_markinfo(func, mark):
"""create the legacy MarkInfo objects and put them onto the function
"""
if not isinstance(mark, Mark):
raise TypeError("got {mark!r} instead of a Mark".format(mark=mark))
holder = getattr(func, mark.name, None)
if holder is None:
holder = MarkInfo(mark)
setattr(func, mark.name, holder)
else:
holder.add_mark(mark)
class Mark(namedtuple('Mark', 'name, args, kwargs')):
def combined_with(self, other):
assert self.name == other.name
return Mark(
self.name, self.args + other.args,
dict(self.kwargs, **other.kwargs))
class MarkInfo(object):
""" Marking object created by :class:`MarkDecorator` instances. """
def __init__(self, mark):
assert isinstance(mark, Mark), repr(mark)
self.combined = mark
self._marks = [mark]
name = alias('combined.name')
args = alias('combined.args')
kwargs = alias('combined.kwargs')
def __repr__(self):
return "<MarkInfo {0!r}>".format(self.combined)
def add_mark(self, mark):
""" add a MarkInfo with the given args and kwargs. """
self._marks.append(mark)
self.combined = self.combined.combined_with(mark)
def __iter__(self):
""" yield MarkInfo objects each relating to a marking-call. """
return imap(MarkInfo, self._marks)
MARK_GEN = MarkGenerator()
def _marked(func, mark):
""" Returns True if :func: is already marked with :mark:, False otherwise.
This can happen if marker is applied to class and the test file is
invoked more than once.
"""
try:
func_mark = getattr(func, mark.name)
except AttributeError:
return False
return mark.args == func_mark.args and mark.kwargs == func_mark.kwargs
def transfer_markers(funcobj, cls, mod):
"""
this function transfers class level markers and module level markers
into function level markinfo objects
this is the main reason why marks are so broken
the resolution will involve phasing out function level MarkInfo objects
"""
for obj in (cls, mod):
for mark in get_unpacked_marks(obj):
if not _marked(funcobj, mark):
store_legacy_markinfo(funcobj, mark)

View File

@@ -1,372 +0,0 @@
""" support for skip/xfail functions and markers. """
from __future__ import absolute_import, division, print_function
import os
import sys
import traceback
import py
from _pytest.config import hookimpl
from _pytest.mark import MarkInfo, MarkDecorator
from _pytest.outcomes import fail, skip, xfail, TEST_OUTCOME
def pytest_addoption(parser):
group = parser.getgroup("general")
group.addoption('--runxfail',
action="store_true", dest="runxfail", default=False,
help="run tests even if they are marked xfail")
parser.addini("xfail_strict", "default for the strict parameter of xfail "
"markers when not given explicitly (default: "
"False)",
default=False,
type="bool")
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)
config.addinivalue_line("markers",
"skip(reason=None): skip the given test function with an optional reason. "
"Example: skip(reason=\"no way of currently testing this\") skips the "
"test."
)
config.addinivalue_line("markers",
"skipif(condition): skip the given test function if eval(condition) "
"results in a True value. Evaluation happens within the "
"module global context. Example: skipif('sys.platform == \"win32\"') "
"skips the test if we are on the win32 platform. see "
"http://pytest.org/latest/skipping.html"
)
config.addinivalue_line("markers",
"xfail(condition, reason=None, run=True, raises=None, strict=False): "
"mark the test function as an expected failure if eval(condition) "
"has a True value. Optionally specify a reason for better reporting "
"and run=False if you don't even want to execute the test function. "
"If only specific exception(s) are expected, you can list them in "
"raises, and if the test fails in other ways, it will be reported as "
"a true failure. See http://pytest.org/latest/skipping.html"
)
class MarkEvaluator:
def __init__(self, item, name):
self.item = item
self.name = name
@property
def holder(self):
return self.item.keywords.get(self.name)
def __bool__(self):
return bool(self.holder)
__nonzero__ = __bool__
def wasvalid(self):
return not hasattr(self, 'exc')
def invalidraise(self, exc):
raises = self.get('raises')
if not raises:
return
return not isinstance(exc, raises)
def istrue(self):
try:
return self._istrue()
except TEST_OUTCOME:
self.exc = sys.exc_info()
if isinstance(self.exc[1], SyntaxError):
msg = [" " * (self.exc[1].offset + 4) + "^", ]
msg.append("SyntaxError: invalid syntax")
else:
msg = traceback.format_exception_only(*self.exc[:2])
fail("Error evaluating %r expression\n"
" %s\n"
"%s"
% (self.name, self.expr, "\n".join(msg)),
pytrace=False)
def _getglobals(self):
d = {'os': os, 'sys': sys, 'config': self.item.config}
if hasattr(self.item, 'obj'):
d.update(self.item.obj.__globals__)
return d
def _istrue(self):
if hasattr(self, 'result'):
return self.result
if self.holder:
if self.holder.args or 'condition' in self.holder.kwargs:
self.result = False
# "holder" might be a MarkInfo or a MarkDecorator; only
# MarkInfo keeps track of all parameters it received in an
# _arglist attribute
marks = getattr(self.holder, '_marks', None) \
or [self.holder.mark]
for _, args, kwargs in marks:
if 'condition' in kwargs:
args = (kwargs['condition'],)
for expr in args:
self.expr = expr
if isinstance(expr, py.builtin._basestring):
d = self._getglobals()
result = cached_eval(self.item.config, expr, d)
else:
if "reason" not in kwargs:
# XXX better be checked at collection time
msg = "you need to specify reason=STRING " \
"when using booleans as conditions."
fail(msg)
result = bool(expr)
if result:
self.result = True
self.reason = kwargs.get('reason', None)
self.expr = expr
return self.result
else:
self.result = True
return getattr(self, 'result', False)
def get(self, attr, default=None):
return self.holder.kwargs.get(attr, default)
def getexplanation(self):
expl = getattr(self, 'reason', None) or self.get('reason', None)
if not expl:
if not hasattr(self, 'expr'):
return ""
else:
return "condition: " + str(self.expr)
return expl
@hookimpl(tryfirst=True)
def pytest_runtest_setup(item):
# Check if skip or skipif are specified as pytest marks
skipif_info = item.keywords.get('skipif')
if isinstance(skipif_info, (MarkInfo, MarkDecorator)):
eval_skipif = MarkEvaluator(item, 'skipif')
if eval_skipif.istrue():
item._evalskip = eval_skipif
skip(eval_skipif.getexplanation())
skip_info = item.keywords.get('skip')
if isinstance(skip_info, (MarkInfo, MarkDecorator)):
item._evalskip = True
if 'reason' in skip_info.kwargs:
skip(skip_info.kwargs['reason'])
elif skip_info.args:
skip(skip_info.args[0])
else:
skip("unconditional skip")
item._evalxfail = MarkEvaluator(item, 'xfail')
check_xfail_no_run(item)
@hookimpl(hookwrapper=True)
def pytest_pyfunc_call(pyfuncitem):
check_xfail_no_run(pyfuncitem)
outcome = yield
passed = outcome.excinfo is None
if passed:
check_strict_xfail(pyfuncitem)
def check_xfail_no_run(item):
"""check xfail(run=False)"""
if not item.config.option.runxfail:
evalxfail = item._evalxfail
if evalxfail.istrue():
if not evalxfail.get('run', True):
xfail("[NOTRUN] " + evalxfail.getexplanation())
def check_strict_xfail(pyfuncitem):
"""check xfail(strict=True) for the given PASSING test"""
evalxfail = pyfuncitem._evalxfail
if evalxfail.istrue():
strict_default = pyfuncitem.config.getini('xfail_strict')
is_strict_xfail = evalxfail.get('strict', strict_default)
if is_strict_xfail:
del pyfuncitem._evalxfail
explanation = evalxfail.getexplanation()
fail('[XPASS(strict)] ' + explanation, pytrace=False)
@hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
rep = outcome.get_result()
evalxfail = getattr(item, '_evalxfail', None)
evalskip = getattr(item, '_evalskip', None)
# unitttest special case, see setting of _unexpectedsuccess
if hasattr(item, '_unexpectedsuccess') and rep.when == "call":
from _pytest.compat import _is_unittest_unexpected_success_a_failure
if item._unexpectedsuccess:
rep.longrepr = "Unexpected success: {0}".format(item._unexpectedsuccess)
else:
rep.longrepr = "Unexpected success"
if _is_unittest_unexpected_success_a_failure():
rep.outcome = "failed"
else:
rep.outcome = "passed"
rep.wasxfail = rep.longrepr
elif item.config.option.runxfail:
pass # don't interefere
elif call.excinfo and call.excinfo.errisinstance(xfail.Exception):
rep.wasxfail = "reason: " + call.excinfo.value.msg
rep.outcome = "skipped"
elif evalxfail and not rep.skipped and evalxfail.wasvalid() and \
evalxfail.istrue():
if call.excinfo:
if evalxfail.invalidraise(call.excinfo.value):
rep.outcome = "failed"
else:
rep.outcome = "skipped"
rep.wasxfail = evalxfail.getexplanation()
elif call.when == "call":
strict_default = item.config.getini('xfail_strict')
is_strict_xfail = evalxfail.get('strict', strict_default)
explanation = evalxfail.getexplanation()
if is_strict_xfail:
rep.outcome = "failed"
rep.longrepr = "[XPASS(strict)] {0}".format(explanation)
else:
rep.outcome = "passed"
rep.wasxfail = explanation
elif evalskip is not None and rep.skipped and type(rep.longrepr) is tuple:
# skipped by mark.skipif; change the location of the failure
# to point to the item definition, otherwise it will display
# the location of where the skip exception was raised within pytest
filename, line, reason = rep.longrepr
filename, line = item.location[:2]
rep.longrepr = filename, line, reason
# called by terminalreporter progress reporting
def pytest_report_teststatus(report):
if hasattr(report, "wasxfail"):
if report.skipped:
return "xfailed", "x", "xfail"
elif report.passed:
return "xpassed", "X", ("XPASS", {'yellow': True})
# called by the terminalreporter instance/plugin
def pytest_terminal_summary(terminalreporter):
tr = terminalreporter
if not tr.reportchars:
# for name in "xfailed skipped failed xpassed":
# if not tr.stats.get(name, 0):
# tr.write_line("HINT: use '-r' option to see extra "
# "summary info about tests")
# break
return
lines = []
for char in tr.reportchars:
if char == "x":
show_xfailed(terminalreporter, lines)
elif char == "X":
show_xpassed(terminalreporter, lines)
elif char in "fF":
show_simple(terminalreporter, lines, 'failed', "FAIL %s")
elif char in "sS":
show_skipped(terminalreporter, lines)
elif char == "E":
show_simple(terminalreporter, lines, 'error', "ERROR %s")
elif char == 'p':
show_simple(terminalreporter, lines, 'passed', "PASSED %s")
if lines:
tr._tw.sep("=", "short test summary info")
for line in lines:
tr._tw.line(line)
def show_simple(terminalreporter, lines, stat, format):
failed = terminalreporter.stats.get(stat)
if failed:
for rep in failed:
pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
lines.append(format % (pos,))
def show_xfailed(terminalreporter, lines):
xfailed = terminalreporter.stats.get("xfailed")
if xfailed:
for rep in xfailed:
pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
reason = rep.wasxfail
lines.append("XFAIL %s" % (pos,))
if reason:
lines.append(" " + str(reason))
def show_xpassed(terminalreporter, lines):
xpassed = terminalreporter.stats.get("xpassed")
if xpassed:
for rep in xpassed:
pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
reason = rep.wasxfail
lines.append("XPASS %s %s" % (pos, reason))
def cached_eval(config, expr, d):
if not hasattr(config, '_evalcache'):
config._evalcache = {}
try:
return config._evalcache[expr]
except KeyError:
import _pytest._code
exprcode = _pytest._code.compile(expr, mode="eval")
config._evalcache[expr] = x = eval(exprcode, d)
return x
def folded_skips(skipped):
d = {}
for event in skipped:
key = event.longrepr
assert len(key) == 3, (event, key)
d.setdefault(key, []).append(event)
l = []
for key, events in d.items():
l.append((len(events),) + key)
return l
def show_skipped(terminalreporter, lines):
tr = terminalreporter
skipped = tr.stats.get('skipped', [])
if skipped:
# if not tr.hasopt('skipped'):
# tr.write_line(
# "%d skipped tests, specify -rs for more info" %
# len(skipped))
# return
fskips = folded_skips(skipped)
if fskips:
# tr.write_sep("_", "skipped test summary")
for num, fspath, lineno, reason in fskips:
if reason.startswith("Skipped: "):
reason = reason[9:]
lines.append(
"SKIP [%d] %s:%d: %s" %
(num, fspath, lineno + 1, reason))

View File

@@ -1,13 +0,0 @@
This directory vendors the `pluggy` module.
For a more detailed discussion for the reasons to vendoring this
package, please see [this issue](https://github.com/pytest-dev/pytest/issues/944).
To update the current version, execute:
```
$ pip install -U pluggy==<version> --no-compile --target=_pytest/vendored_packages
```
And commit the modified files. The `pluggy-<version>.dist-info` directory
created by `pip` should be added as well.

View File

@@ -1,11 +0,0 @@
Plugin registration and hook calling for Python
===============================================
This is the plugin manager as used by pytest but stripped
of pytest specific details.
During the 0.x series this plugin does not have much documentation
except extensive docstrings in the pluggy.py module.

View File

@@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 holger krekel (rather uses bitbucket/hpk42)
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 the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,40 +0,0 @@
Metadata-Version: 2.0
Name: pluggy
Version: 0.4.0
Summary: plugin and hook calling mechanisms for python
Home-page: https://github.com/pytest-dev/pluggy
Author: Holger Krekel
Author-email: holger at merlinux.eu
License: MIT license
Platform: unix
Platform: linux
Platform: osx
Platform: win32
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Plugin registration and hook calling for Python
===============================================
This is the plugin manager as used by pytest but stripped
of pytest specific details.
During the 0.x series this plugin does not have much documentation
except extensive docstrings in the pluggy.py module.

View File

@@ -1,9 +0,0 @@
pluggy.py,sha256=u0oG9cv-oLOkNvEBlwnnu8pp1AyxpoERgUO00S3rvpQ,31543
pluggy-0.4.0.dist-info/DESCRIPTION.rst,sha256=ltvjkFd40LW_xShthp6RRVM6OB_uACYDFR3kTpKw7o4,307
pluggy-0.4.0.dist-info/LICENSE.txt,sha256=ruwhUOyV1HgE9F35JVL9BCZ9vMSALx369I4xq9rhpkM,1134
pluggy-0.4.0.dist-info/METADATA,sha256=pe2hbsqKFaLHC6wAQPpFPn0KlpcPfLBe_BnS4O70bfk,1364
pluggy-0.4.0.dist-info/RECORD,,
pluggy-0.4.0.dist-info/WHEEL,sha256=9Z5Xm-eel1bTS7e6ogYiKz0zmPEqDwIypurdHN1hR40,116
pluggy-0.4.0.dist-info/metadata.json,sha256=T3go5L2qOa_-H-HpCZi3EoVKb8sZ3R-fOssbkWo2nvM,1119
pluggy-0.4.0.dist-info/top_level.txt,sha256=xKSCRhai-v9MckvMuWqNz16c1tbsmOggoMSwTgcpYHE,7
pluggy-0.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4

View File

@@ -1,6 +0,0 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.29.0)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any

View File

@@ -1 +0,0 @@
{"classifiers": ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Operating System :: Microsoft :: Windows", "Operating System :: MacOS :: MacOS X", "Topic :: Software Development :: Testing", "Topic :: Software Development :: Libraries", "Topic :: Utilities", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5"], "extensions": {"python.details": {"contacts": [{"email": "holger at merlinux.eu", "name": "Holger Krekel", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst", "license": "LICENSE.txt"}, "project_urls": {"Home": "https://github.com/pytest-dev/pluggy"}}}, "generator": "bdist_wheel (0.29.0)", "license": "MIT license", "metadata_version": "2.0", "name": "pluggy", "platform": "unix", "summary": "plugin and hook calling mechanisms for python", "version": "0.4.0"}

View File

@@ -1,802 +0,0 @@
"""
PluginManager, basic initialization and tracing.
pluggy is the cristallized core of plugin management as used
by some 150 plugins for pytest.
Pluggy uses semantic versioning. Breaking changes are only foreseen for
Major releases (incremented X in "X.Y.Z"). If you want to use pluggy in
your project you should thus use a dependency restriction like
"pluggy>=0.1.0,<1.0" to avoid surprises.
pluggy is concerned with hook specification, hook implementations and hook
calling. For any given hook specification a hook call invokes up to N implementations.
A hook implementation can influence its position and type of execution:
if attributed "tryfirst" or "trylast" it will be tried to execute
first or last. However, if attributed "hookwrapper" an implementation
can wrap all calls to non-hookwrapper implementations. A hookwrapper
can thus execute some code ahead and after the execution of other hooks.
Hook specification is done by way of a regular python function where
both the function name and the names of all its arguments are significant.
Each hook implementation function is verified against the original specification
function, including the names of all its arguments. To allow for hook specifications
to evolve over the livetime of a project, hook implementations can
accept less arguments. One can thus add new arguments and semantics to
a hook specification by adding another argument typically without breaking
existing hook implementations.
The chosen approach is meant to let a hook designer think carefuly about
which objects are needed by an extension writer. By contrast, subclass-based
extension mechanisms often expose a lot more state and behaviour than needed,
thus restricting future developments.
Pluggy currently consists of functionality for:
- a way to register new hook specifications. Without a hook
specification no hook calling can be performed.
- a registry of plugins which contain hook implementation functions. It
is possible to register plugins for which a hook specification is not yet
known and validate all hooks when the system is in a more referentially
consistent state. Setting an "optionalhook" attribution to a hook
implementation will avoid PluginValidationError's if a specification
is missing. This allows to have optional integration between plugins.
- a "hook" relay object from which you can launch 1:N calls to
registered hook implementation functions
- a mechanism for ordering hook implementation functions
- mechanisms for two different type of 1:N calls: "firstresult" for when
the call should stop when the first implementation returns a non-None result.
And the other (default) way of guaranteeing that all hook implementations
will be called and their non-None result collected.
- mechanisms for "historic" extension points such that all newly
registered functions will receive all hook calls that happened
before their registration.
- a mechanism for discovering plugin objects which are based on
setuptools based entry points.
- a simple tracing mechanism, including tracing of plugin calls and
their arguments.
"""
import sys
import inspect
__version__ = '0.4.0'
__all__ = ["PluginManager", "PluginValidationError", "HookCallError",
"HookspecMarker", "HookimplMarker"]
_py3 = sys.version_info > (3, 0)
class HookspecMarker:
""" Decorator helper class for marking functions as hook specifications.
You can instantiate it with a project_name to get a decorator.
Calling PluginManager.add_hookspecs later will discover all marked functions
if the PluginManager uses the same project_name.
"""
def __init__(self, project_name):
self.project_name = project_name
def __call__(self, function=None, firstresult=False, historic=False):
""" if passed a function, directly sets attributes on the function
which will make it discoverable to add_hookspecs(). If passed no
function, returns a decorator which can be applied to a function
later using the attributes supplied.
If firstresult is True the 1:N hook call (N being the number of registered
hook implementation functions) will stop at I<=N when the I'th function
returns a non-None result.
If historic is True calls to a hook will be memorized and replayed
on later registered plugins.
"""
def setattr_hookspec_opts(func):
if historic and firstresult:
raise ValueError("cannot have a historic firstresult hook")
setattr(func, self.project_name + "_spec",
dict(firstresult=firstresult, historic=historic))
return func
if function is not None:
return setattr_hookspec_opts(function)
else:
return setattr_hookspec_opts
class HookimplMarker:
""" Decorator helper class for marking functions as hook implementations.
You can instantiate with a project_name to get a decorator.
Calling PluginManager.register later will discover all marked functions
if the PluginManager uses the same project_name.
"""
def __init__(self, project_name):
self.project_name = project_name
def __call__(self, function=None, hookwrapper=False, optionalhook=False,
tryfirst=False, trylast=False):
""" if passed a function, directly sets attributes on the function
which will make it discoverable to register(). If passed no function,
returns a decorator which can be applied to a function later using
the attributes supplied.
If optionalhook is True a missing matching hook specification will not result
in an error (by default it is an error if no matching spec is found).
If tryfirst is True this hook implementation will run as early as possible
in the chain of N hook implementations for a specfication.
If trylast is True this hook implementation will run as late as possible
in the chain of N hook implementations.
If hookwrapper is True the hook implementations needs to execute exactly
one "yield". The code before the yield is run early before any non-hookwrapper
function is run. The code after the yield is run after all non-hookwrapper
function have run. The yield receives an ``_CallOutcome`` object representing
the exception or result outcome of the inner calls (including other hookwrapper
calls).
"""
def setattr_hookimpl_opts(func):
setattr(func, self.project_name + "_impl",
dict(hookwrapper=hookwrapper, optionalhook=optionalhook,
tryfirst=tryfirst, trylast=trylast))
return func
if function is None:
return setattr_hookimpl_opts
else:
return setattr_hookimpl_opts(function)
def normalize_hookimpl_opts(opts):
opts.setdefault("tryfirst", False)
opts.setdefault("trylast", False)
opts.setdefault("hookwrapper", False)
opts.setdefault("optionalhook", False)
class _TagTracer:
def __init__(self):
self._tag2proc = {}
self.writer = None
self.indent = 0
def get(self, name):
return _TagTracerSub(self, (name,))
def format_message(self, tags, args):
if isinstance(args[-1], dict):
extra = args[-1]
args = args[:-1]
else:
extra = {}
content = " ".join(map(str, args))
indent = " " * self.indent
lines = [
"%s%s [%s]\n" % (indent, content, ":".join(tags))
]
for name, value in extra.items():
lines.append("%s %s: %s\n" % (indent, name, value))
return lines
def processmessage(self, tags, args):
if self.writer is not None and args:
lines = self.format_message(tags, args)
self.writer(''.join(lines))
try:
self._tag2proc[tags](tags, args)
except KeyError:
pass
def setwriter(self, writer):
self.writer = writer
def setprocessor(self, tags, processor):
if isinstance(tags, str):
tags = tuple(tags.split(":"))
else:
assert isinstance(tags, tuple)
self._tag2proc[tags] = processor
class _TagTracerSub:
def __init__(self, root, tags):
self.root = root
self.tags = tags
def __call__(self, *args):
self.root.processmessage(self.tags, args)
def setmyprocessor(self, processor):
self.root.setprocessor(self.tags, processor)
def get(self, name):
return self.__class__(self.root, self.tags + (name,))
def _raise_wrapfail(wrap_controller, msg):
co = wrap_controller.gi_code
raise RuntimeError("wrap_controller at %r %s:%d %s" %
(co.co_name, co.co_filename, co.co_firstlineno, msg))
def _wrapped_call(wrap_controller, func):
""" Wrap calling to a function with a generator which needs to yield
exactly once. The yield point will trigger calling the wrapped function
and return its _CallOutcome to the yield point. The generator then needs
to finish (raise StopIteration) in order for the wrapped call to complete.
"""
try:
next(wrap_controller) # first yield
except StopIteration:
_raise_wrapfail(wrap_controller, "did not yield")
call_outcome = _CallOutcome(func)
try:
wrap_controller.send(call_outcome)
_raise_wrapfail(wrap_controller, "has second yield")
except StopIteration:
pass
return call_outcome.get_result()
class _CallOutcome:
""" Outcome of a function call, either an exception or a proper result.
Calling the ``get_result`` method will return the result or reraise
the exception raised when the function was called. """
excinfo = None
def __init__(self, func):
try:
self.result = func()
except BaseException:
self.excinfo = sys.exc_info()
def force_result(self, result):
self.result = result
self.excinfo = None
def get_result(self):
if self.excinfo is None:
return self.result
else:
ex = self.excinfo
if _py3:
raise ex[1].with_traceback(ex[2])
_reraise(*ex) # noqa
if not _py3:
exec("""
def _reraise(cls, val, tb):
raise cls, val, tb
""")
class _TracedHookExecution:
def __init__(self, pluginmanager, before, after):
self.pluginmanager = pluginmanager
self.before = before
self.after = after
self.oldcall = pluginmanager._inner_hookexec
assert not isinstance(self.oldcall, _TracedHookExecution)
self.pluginmanager._inner_hookexec = self
def __call__(self, hook, hook_impls, kwargs):
self.before(hook.name, hook_impls, kwargs)
outcome = _CallOutcome(lambda: self.oldcall(hook, hook_impls, kwargs))
self.after(outcome, hook.name, hook_impls, kwargs)
return outcome.get_result()
def undo(self):
self.pluginmanager._inner_hookexec = self.oldcall
class PluginManager(object):
""" Core Pluginmanager class which manages registration
of plugin objects and 1:N hook calling.
You can register new hooks by calling ``add_hookspec(module_or_class)``.
You can register plugin objects (which contain hooks) by calling
``register(plugin)``. The Pluginmanager is initialized with a
prefix that is searched for in the names of the dict of registered
plugin objects. An optional excludefunc allows to blacklist names which
are not considered as hooks despite a matching prefix.
For debugging purposes you can call ``enable_tracing()``
which will subsequently send debug information to the trace helper.
"""
def __init__(self, project_name, implprefix=None):
""" if implprefix is given implementation functions
will be recognized if their name matches the implprefix. """
self.project_name = project_name
self._name2plugin = {}
self._plugin2hookcallers = {}
self._plugin_distinfo = []
self.trace = _TagTracer().get("pluginmanage")
self.hook = _HookRelay(self.trace.root.get("hook"))
self._implprefix = implprefix
self._inner_hookexec = lambda hook, methods, kwargs: \
_MultiCall(methods, kwargs, hook.spec_opts).execute()
def _hookexec(self, hook, methods, kwargs):
# called from all hookcaller instances.
# enable_tracing will set its own wrapping function at self._inner_hookexec
return self._inner_hookexec(hook, methods, kwargs)
def register(self, plugin, name=None):
""" Register a plugin and return its canonical name or None if the name
is blocked from registering. Raise a ValueError if the plugin is already
registered. """
plugin_name = name or self.get_canonical_name(plugin)
if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
if self._name2plugin.get(plugin_name, -1) is None:
return # blocked plugin, return None to indicate no registration
raise ValueError("Plugin already registered: %s=%s\n%s" %
(plugin_name, plugin, self._name2plugin))
# XXX if an error happens we should make sure no state has been
# changed at point of return
self._name2plugin[plugin_name] = plugin
# register matching hook implementations of the plugin
self._plugin2hookcallers[plugin] = hookcallers = []
for name in dir(plugin):
hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
if hookimpl_opts is not None:
normalize_hookimpl_opts(hookimpl_opts)
method = getattr(plugin, name)
hookimpl = HookImpl(plugin, plugin_name, method, hookimpl_opts)
hook = getattr(self.hook, name, None)
if hook is None:
hook = _HookCaller(name, self._hookexec)
setattr(self.hook, name, hook)
elif hook.has_spec():
self._verify_hook(hook, hookimpl)
hook._maybe_apply_history(hookimpl)
hook._add_hookimpl(hookimpl)
hookcallers.append(hook)
return plugin_name
def parse_hookimpl_opts(self, plugin, name):
method = getattr(plugin, name)
try:
res = getattr(method, self.project_name + "_impl", None)
except Exception:
res = {}
if res is not None and not isinstance(res, dict):
# false positive
res = None
elif res is None and self._implprefix and name.startswith(self._implprefix):
res = {}
return res
def unregister(self, plugin=None, name=None):
""" unregister a plugin object and all its contained hook implementations
from internal data structures. """
if name is None:
assert plugin is not None, "one of name or plugin needs to be specified"
name = self.get_name(plugin)
if plugin is None:
plugin = self.get_plugin(name)
# if self._name2plugin[name] == None registration was blocked: ignore
if self._name2plugin.get(name):
del self._name2plugin[name]
for hookcaller in self._plugin2hookcallers.pop(plugin, []):
hookcaller._remove_plugin(plugin)
return plugin
def set_blocked(self, name):
""" block registrations of the given name, unregister if already registered. """
self.unregister(name=name)
self._name2plugin[name] = None
def is_blocked(self, name):
""" return True if the name blogs registering plugins of that name. """
return name in self._name2plugin and self._name2plugin[name] is None
def add_hookspecs(self, module_or_class):
""" add new hook specifications defined in the given module_or_class.
Functions are recognized if they have been decorated accordingly. """
names = []
for name in dir(module_or_class):
spec_opts = self.parse_hookspec_opts(module_or_class, name)
if spec_opts is not None:
hc = getattr(self.hook, name, None)
if hc is None:
hc = _HookCaller(name, self._hookexec, module_or_class, spec_opts)
setattr(self.hook, name, hc)
else:
# plugins registered this hook without knowing the spec
hc.set_specification(module_or_class, spec_opts)
for hookfunction in (hc._wrappers + hc._nonwrappers):
self._verify_hook(hc, hookfunction)
names.append(name)
if not names:
raise ValueError("did not find any %r hooks in %r" %
(self.project_name, module_or_class))
def parse_hookspec_opts(self, module_or_class, name):
method = getattr(module_or_class, name)
return getattr(method, self.project_name + "_spec", None)
def get_plugins(self):
""" return the set of registered plugins. """
return set(self._plugin2hookcallers)
def is_registered(self, plugin):
""" Return True if the plugin is already registered. """
return plugin in self._plugin2hookcallers
def get_canonical_name(self, plugin):
""" Return canonical name for a plugin object. Note that a plugin
may be registered under a different name which was specified
by the caller of register(plugin, name). To obtain the name
of an registered plugin use ``get_name(plugin)`` instead."""
return getattr(plugin, "__name__", None) or str(id(plugin))
def get_plugin(self, name):
""" Return a plugin or None for the given name. """
return self._name2plugin.get(name)
def has_plugin(self, name):
""" Return True if a plugin with the given name is registered. """
return self.get_plugin(name) is not None
def get_name(self, plugin):
""" Return name for registered plugin or None if not registered. """
for name, val in self._name2plugin.items():
if plugin == val:
return name
def _verify_hook(self, hook, hookimpl):
if hook.is_historic() and hookimpl.hookwrapper:
raise PluginValidationError(
"Plugin %r\nhook %r\nhistoric incompatible to hookwrapper" %
(hookimpl.plugin_name, hook.name))
for arg in hookimpl.argnames:
if arg not in hook.argnames:
raise PluginValidationError(
"Plugin %r\nhook %r\nargument %r not available\n"
"plugin definition: %s\n"
"available hookargs: %s" %
(hookimpl.plugin_name, hook.name, arg,
_formatdef(hookimpl.function), ", ".join(hook.argnames)))
def check_pending(self):
""" Verify that all hooks which have not been verified against
a hook specification are optional, otherwise raise PluginValidationError"""
for name in self.hook.__dict__:
if name[0] != "_":
hook = getattr(self.hook, name)
if not hook.has_spec():
for hookimpl in (hook._wrappers + hook._nonwrappers):
if not hookimpl.optionalhook:
raise PluginValidationError(
"unknown hook %r in plugin %r" %
(name, hookimpl.plugin))
def load_setuptools_entrypoints(self, entrypoint_name):
""" Load modules from querying the specified setuptools entrypoint name.
Return the number of loaded plugins. """
from pkg_resources import (iter_entry_points, DistributionNotFound,
VersionConflict)
for ep in iter_entry_points(entrypoint_name):
# is the plugin registered or blocked?
if self.get_plugin(ep.name) or self.is_blocked(ep.name):
continue
try:
plugin = ep.load()
except DistributionNotFound:
continue
except VersionConflict as e:
raise PluginValidationError(
"Plugin %r could not be loaded: %s!" % (ep.name, e))
self.register(plugin, name=ep.name)
self._plugin_distinfo.append((plugin, ep.dist))
return len(self._plugin_distinfo)
def list_plugin_distinfo(self):
""" return list of distinfo/plugin tuples for all setuptools registered
plugins. """
return list(self._plugin_distinfo)
def list_name_plugin(self):
""" return list of name/plugin pairs. """
return list(self._name2plugin.items())
def get_hookcallers(self, plugin):
""" get all hook callers for the specified plugin. """
return self._plugin2hookcallers.get(plugin)
def add_hookcall_monitoring(self, before, after):
""" add before/after tracing functions for all hooks
and return an undo function which, when called,
will remove the added tracers.
``before(hook_name, hook_impls, kwargs)`` will be called ahead
of all hook calls and receive a hookcaller instance, a list
of HookImpl instances and the keyword arguments for the hook call.
``after(outcome, hook_name, hook_impls, kwargs)`` receives the
same arguments as ``before`` but also a :py:class:`_CallOutcome <_pytest.vendored_packages.pluggy._CallOutcome>` object
which represents the result of the overall hook call.
"""
return _TracedHookExecution(self, before, after).undo
def enable_tracing(self):
""" enable tracing of hook calls and return an undo function. """
hooktrace = self.hook._trace
def before(hook_name, methods, kwargs):
hooktrace.root.indent += 1
hooktrace(hook_name, kwargs)
def after(outcome, hook_name, methods, kwargs):
if outcome.excinfo is None:
hooktrace("finish", hook_name, "-->", outcome.result)
hooktrace.root.indent -= 1
return self.add_hookcall_monitoring(before, after)
def subset_hook_caller(self, name, remove_plugins):
""" Return a new _HookCaller instance for the named method
which manages calls to all registered plugins except the
ones from remove_plugins. """
orig = getattr(self.hook, name)
plugins_to_remove = [plug for plug in remove_plugins if hasattr(plug, name)]
if plugins_to_remove:
hc = _HookCaller(orig.name, orig._hookexec, orig._specmodule_or_class,
orig.spec_opts)
for hookimpl in (orig._wrappers + orig._nonwrappers):
plugin = hookimpl.plugin
if plugin not in plugins_to_remove:
hc._add_hookimpl(hookimpl)
# we also keep track of this hook caller so it
# gets properly removed on plugin unregistration
self._plugin2hookcallers.setdefault(plugin, []).append(hc)
return hc
return orig
class _MultiCall:
""" execute a call into multiple python functions/methods. """
# XXX note that the __multicall__ argument is supported only
# for pytest compatibility reasons. It was never officially
# supported there and is explicitely deprecated since 2.8
# so we can remove it soon, allowing to avoid the below recursion
# in execute() and simplify/speed up the execute loop.
def __init__(self, hook_impls, kwargs, specopts={}):
self.hook_impls = hook_impls
self.kwargs = kwargs
self.kwargs["__multicall__"] = self
self.specopts = specopts
def execute(self):
all_kwargs = self.kwargs
self.results = results = []
firstresult = self.specopts.get("firstresult")
while self.hook_impls:
hook_impl = self.hook_impls.pop()
try:
args = [all_kwargs[argname] for argname in hook_impl.argnames]
except KeyError:
for argname in hook_impl.argnames:
if argname not in all_kwargs:
raise HookCallError(
"hook call must provide argument %r" % (argname,))
if hook_impl.hookwrapper:
return _wrapped_call(hook_impl.function(*args), self.execute)
res = hook_impl.function(*args)
if res is not None:
if firstresult:
return res
results.append(res)
if not firstresult:
return results
def __repr__(self):
status = "%d meths" % (len(self.hook_impls),)
if hasattr(self, "results"):
status = ("%d results, " % len(self.results)) + status
return "<_MultiCall %s, kwargs=%r>" % (status, self.kwargs)
def varnames(func, startindex=None):
""" return argument name tuple for a function, method, class or callable.
In case of a class, its "__init__" method is considered.
For methods the "self" parameter is not included unless you are passing
an unbound method with Python3 (which has no supports for unbound methods)
"""
cache = getattr(func, "__dict__", {})
try:
return cache["_varnames"]
except KeyError:
pass
if inspect.isclass(func):
try:
func = func.__init__
except AttributeError:
return ()
startindex = 1
else:
if not inspect.isfunction(func) and not inspect.ismethod(func):
try:
func = getattr(func, '__call__', func)
except Exception:
return ()
if startindex is None:
startindex = int(inspect.ismethod(func))
try:
rawcode = func.__code__
except AttributeError:
return ()
try:
x = rawcode.co_varnames[startindex:rawcode.co_argcount]
except AttributeError:
x = ()
else:
defaults = func.__defaults__
if defaults:
x = x[:-len(defaults)]
try:
cache["_varnames"] = x
except TypeError:
pass
return x
class _HookRelay:
""" hook holder object for performing 1:N hook calls where N is the number
of registered plugins.
"""
def __init__(self, trace):
self._trace = trace
class _HookCaller(object):
def __init__(self, name, hook_execute, specmodule_or_class=None, spec_opts=None):
self.name = name
self._wrappers = []
self._nonwrappers = []
self._hookexec = hook_execute
if specmodule_or_class is not None:
assert spec_opts is not None
self.set_specification(specmodule_or_class, spec_opts)
def has_spec(self):
return hasattr(self, "_specmodule_or_class")
def set_specification(self, specmodule_or_class, spec_opts):
assert not self.has_spec()
self._specmodule_or_class = specmodule_or_class
specfunc = getattr(specmodule_or_class, self.name)
argnames = varnames(specfunc, startindex=inspect.isclass(specmodule_or_class))
assert "self" not in argnames # sanity check
self.argnames = ["__multicall__"] + list(argnames)
self.spec_opts = spec_opts
if spec_opts.get("historic"):
self._call_history = []
def is_historic(self):
return hasattr(self, "_call_history")
def _remove_plugin(self, plugin):
def remove(wrappers):
for i, method in enumerate(wrappers):
if method.plugin == plugin:
del wrappers[i]
return True
if remove(self._wrappers) is None:
if remove(self._nonwrappers) is None:
raise ValueError("plugin %r not found" % (plugin,))
def _add_hookimpl(self, hookimpl):
if hookimpl.hookwrapper:
methods = self._wrappers
else:
methods = self._nonwrappers
if hookimpl.trylast:
methods.insert(0, hookimpl)
elif hookimpl.tryfirst:
methods.append(hookimpl)
else:
# find last non-tryfirst method
i = len(methods) - 1
while i >= 0 and methods[i].tryfirst:
i -= 1
methods.insert(i + 1, hookimpl)
def __repr__(self):
return "<_HookCaller %r>" % (self.name,)
def __call__(self, **kwargs):
assert not self.is_historic()
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
def call_historic(self, proc=None, kwargs=None):
self._call_history.append((kwargs or {}, proc))
# historizing hooks don't return results
self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
def call_extra(self, methods, kwargs):
""" Call the hook with some additional temporarily participating
methods using the specified kwargs as call parameters. """
old = list(self._nonwrappers), list(self._wrappers)
for method in methods:
opts = dict(hookwrapper=False, trylast=False, tryfirst=False)
hookimpl = HookImpl(None, "<temp>", method, opts)
self._add_hookimpl(hookimpl)
try:
return self(**kwargs)
finally:
self._nonwrappers, self._wrappers = old
def _maybe_apply_history(self, method):
if self.is_historic():
for kwargs, proc in self._call_history:
res = self._hookexec(self, [method], kwargs)
if res and proc is not None:
proc(res[0])
class HookImpl:
def __init__(self, plugin, plugin_name, function, hook_impl_opts):
self.function = function
self.argnames = varnames(self.function)
self.plugin = plugin
self.opts = hook_impl_opts
self.plugin_name = plugin_name
self.__dict__.update(hook_impl_opts)
class PluginValidationError(Exception):
""" plugin failed validation. """
class HookCallError(Exception):
""" Hook was called wrongly. """
if hasattr(inspect, 'signature'):
def _formatdef(func):
return "%s%s" % (
func.__name__,
str(inspect.signature(func))
)
else:
def _formatdef(func):
return "%s%s" % (
func.__name__,
inspect.formatargspec(*inspect.getargspec(func))
)

View File

@@ -10,9 +10,7 @@ environment:
- TOXENV: "coveralls"
# note: please use "tox --listenvs" to populate the build matrix below
- TOXENV: "linting"
- TOXENV: "py26"
- TOXENV: "py27"
- TOXENV: "py33"
- TOXENV: "py34"
- TOXENV: "py35"
- TOXENV: "py36"
@@ -21,10 +19,12 @@ environment:
- TOXENV: "py27-xdist"
- TOXENV: "py27-trial"
- TOXENV: "py27-numpy"
- TOXENV: "py27-pluggymaster"
- TOXENV: "py36-pexpect"
- TOXENV: "py36-xdist"
- TOXENV: "py36-trial"
- TOXENV: "py36-numpy"
- TOXENV: "py36-pluggymaster"
- TOXENV: "py27-nobyte"
- TOXENV: "doctesting"
- TOXENV: "py35-freeze"
@@ -42,3 +42,7 @@ build: false # Not a C# project, build stuff at the test step instead.
test_script:
- call scripts\call-tox.bat
cache:
- '%LOCALAPPDATA%\pip\cache'
- '%USERPROFILE%\.cache\pre-commit'

View File

@@ -1,12 +1,13 @@
import sys
if __name__ == '__main__':
if __name__ == "__main__":
import cProfile
import pytest
import pytest # NOQA
import pstats
script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
stats = cProfile.run('pytest.cmdline.main(%r)' % script, 'prof')
stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
p = pstats.Stats("prof")
p.strip_dirs()
p.sort_stats('cumulative')
p.sort_stats("cumulative")
print(p.print_stats(500))

View File

@@ -5,15 +5,18 @@
# FilesCompleter 75.1109 69.2116
# FastFilesCompleter 0.7383 1.0760
import timeit
if __name__ == '__main__':
import sys
import timeit
from argcomplete.completers import FilesCompleter
from _pytest._argcomplete import FastFilesCompleter
count = 1000 # only a few seconds
setup = 'from __main__ import FastFilesCompleter\nfc = FastFilesCompleter()'
run = 'fc("/d")'
sys.stdout.write('%s\n' % (timeit.timeit(run,
setup=setup.replace('Fast', ''), number=count)))
sys.stdout.write('%s\n' % (timeit.timeit(run, setup=setup, number=count)))
imports = [
"from argcomplete.completers import FilesCompleter as completer",
"from _pytest._argcomplete import FastFilesCompleter as completer",
]
count = 1000 # only a few seconds
setup = "%s\nfc = completer()"
run = 'fc("/d")'
if __name__ == "__main__":
print(timeit.timeit(run, setup=setup % imports[0], number=count))
print((timeit.timeit(run, setup=setup % imports[1], number=count)))

View File

@@ -1,3 +1,4 @@
import py
for i in range(1000):
py.builtin.exec_("def test_func_%d(): pass" % i)

View File

@@ -1,12 +1,15 @@
import pytest
@pytest.fixture(scope='module', params=range(966))
@pytest.fixture(scope="module", params=range(966))
def foo(request):
return request.param
def test_it(foo):
pass
def test_it2(foo):
pass

View File

@@ -1,10 +1,11 @@
from six.moves import range
import pytest
SKIP = True
@pytest.mark.parametrize("x", xrange(5000))
@pytest.mark.parametrize("x", range(5000))
def test_foo(x):
if SKIP:
pytest.skip("heh")

32
changelog/README.rst Normal file
View File

@@ -0,0 +1,32 @@
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
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::
Fix issue with non-ascii messages from the ``warnings`` module.
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.
* ``bugfix``: fixes a reported bug.
* ``doc``: documentation improvement, like rewording an entire session or adding missing docs.
* ``removal``: feature deprecation or removal.
* ``vendor``: changes in packages vendored in pytest.
* ``trivial``: fixing a small typo or internal change that might be noteworthy.
So for example: ``123.feature.rst``, ``456.bugfix.rst``.
If your PR fixes an issue, use that number here. If there is no issue,
then after you submit the PR and get the PR number you can add a
changelog using that instead.
If you are not sure what issue type to use, don't hesitate to ask in your PR.
Note that the ``towncrier`` tool will automatically
reflow your text, so it will work best if you stick to a single paragraph, but multiple sentences and links are OK
and encouraged. 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.

View File

@@ -13,8 +13,6 @@ PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
REGENDOC_ARGS := \
--normalize "/={8,} (.*) ={8,}/======= \1 ========/" \
--normalize "/_{8,} (.*) _{8,}/_______ \1 ________/" \
--normalize "/in \d+.\d+ seconds/in 0.12 seconds/" \
--normalize "@/tmp/pytest-of-.*/pytest-\d+@PYTEST_TMPDIR@" \
--normalize "@pytest-(\d+)\\.[^ ,]+@pytest-\1.x.y@" \

View File

@@ -2,15 +2,16 @@
<ul>
<li><a href="{{ pathto('index') }}">Home</a></li>
<li><a href="{{ pathto('contents') }}">Contents</a></li>
<li><a href="{{ pathto('getting-started') }}">Install</a></li>
<li><a href="{{ pathto('contents') }}">Contents</a></li>
<li><a href="{{ pathto('reference') }}">Reference</a></li>
<li><a href="{{ pathto('example/index') }}">Examples</a></li>
<li><a href="{{ pathto('customize') }}">Customize</a></li>
<li><a href="{{ pathto('contact') }}">Contact</a></li>
<li><a href="{{ pathto('talks') }}">Talks/Posts</a></li>
<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>
<li><a href="{{ pathto('license') }}">License</a></li>
<li><a href="{{ pathto('contact') }}">Contact Channels</a></li>
</ul>
{%- if display_toc %}

View File

@@ -1,11 +1,8 @@
<h3>Useful Links</h3>
<ul>
<li><a href="{{ pathto('index') }}">The pytest Website</a></li>
<li><a href="{{ pathto('contributing') }}">Contribution Guide</a></li>
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>
<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

@@ -6,4 +6,4 @@ pygments_style = flask_theme_support.FlaskyStyle
[options]
index_logo = ''
index_logo_height = 120px
touch_icon =
touch_icon =

View File

@@ -1,7 +1,19 @@
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
from pygments.token import (
Keyword,
Name,
Comment,
String,
Error,
Number,
Operator,
Generic,
Whitespace,
Punctuation,
Other,
Literal,
)
class FlaskyStyle(Style):
@@ -10,77 +22,68 @@ class FlaskyStyle(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'
# 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'
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

@@ -5,7 +5,21 @@ Release announcements
.. toctree::
:maxdepth: 2
release-3.6.2
release-3.6.1
release-3.6.0
release-3.5.1
release-3.5.0
release-3.4.2
release-3.4.1
release-3.4.0
release-3.3.2
release-3.3.1
release-3.3.0
release-3.2.5
release-3.2.4
release-3.2.3
release-3.2.2
release-3.2.1
release-3.2.0

View File

@@ -1,4 +1,4 @@
py.test 2.0.3: bug fixes and speed ups
py.test 2.0.3: bug fixes and speed ups
===========================================================================
Welcome to pytest-2.0.3, a maintenance and bug fix release of pytest,
@@ -37,4 +37,3 @@ Changes between 2.0.2 and 2.0.3
internally)
- fix issue37: avoid invalid characters in junitxml's output

View File

@@ -34,4 +34,3 @@ Changes between 2.1.0 and 2.1.1
- fix issue59: provide system-out/err tags for junitxml output
- fix issue61: assertion rewriting on boolean operations with 3 or more operands
- you can now build a man page with "cd doc ; make man"

View File

@@ -30,4 +30,3 @@ Changes between 2.1.1 and 2.1.2
- fix issue68 / packages now work with assertion rewriting
- fix issue66: use different assertion rewriting caches when the -O option is passed
- don't try assertion rewriting on Jython, use reinterp

View File

@@ -9,7 +9,7 @@ and integration testing. See extensive docs with examples here:
The release contains another fix to the perfected assertions introduced
with the 2.1 series as well as the new possibility to customize reporting
for assertion expressions on a per-directory level.
for assertion expressions on a per-directory level.
If you want to install or upgrade pytest, just type one of::

View File

@@ -27,7 +27,7 @@ Changes between 2.2.0 and 2.2.1
----------------------------------------
- fix issue99 (in pytest and py) internallerrors with resultlog now
produce better output - fixed by normalizing pytest_internalerror
produce better output - fixed by normalizing pytest_internalerror
input arguments.
- fix issue97 / traceback issues (in pytest and py) improve traceback output
in conjunction with jinja2 and cython which hack tracebacks
@@ -35,7 +35,7 @@ Changes between 2.2.0 and 2.2.1
the final test in a test node will now run its teardown directly
instead of waiting for the end of the session. Thanks Dave Hunt for
the good reporting and feedback. The pytest_runtest_protocol as well
as the pytest_runtest_teardown hooks now have "nextitem" available
as the pytest_runtest_teardown hooks now have "nextitem" available
which will be None indicating the end of the test run.
- fix collection crash due to unknown-source collected items, thanks
to Ralf Schmitt (fixed by depending on a more recent pylib)

View File

@@ -4,7 +4,7 @@ pytest-2.2.2: bug fixes
pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor
backward-compatible release of the versatile py.test testing tool. It
contains bug fixes and a few refinements particularly to reporting with
"--collectonly", see below for betails.
"--collectonly", see below for betails.
For general information see here:
@@ -27,7 +27,7 @@ Changes between 2.2.1 and 2.2.2
- fix issue101: wrong args to unittest.TestCase test function now
produce better output
- fix issue102: report more useful errors and hints for when a
- fix issue102: report more useful errors and hints for when a
test directory was renamed and some pyc/__pycache__ remain
- fix issue106: allow parametrize to be applied multiple times
e.g. from module, class and at function level.
@@ -38,6 +38,6 @@ Changes between 2.2.1 and 2.2.2
- fix issue115: make --collectonly robust against early failure
(missing files/directories)
- "-qq --collectonly" now shows only files and the number of tests in them
- "-q --collectonly" now shows test ids
- "-q --collectonly" now shows test ids
- allow adding of attributes to test reports such that it also works
with distributed testing (no upgrade of pytest-xdist needed)

View File

@@ -36,4 +36,3 @@ Changes between 2.2.3 and 2.2.4
configure/sessionstart where called
- fix issue #144: better mangle test ids to junitxml classnames
- upgrade distribute_setup.py to 0.6.27

View File

@@ -1,7 +1,7 @@
pytest-2.3: improved fixtures / better unittest integration
=============================================================================
pytest-2.3 comes with many major improvements for fixture/funcarg management
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
instances. Also, you can directly declare the caching "scope" of
@@ -9,7 +9,7 @@ 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-useable fixture design.
For detailed info and tutorial-style examples, see:
@@ -27,7 +27,7 @@ All changes are backward compatible and you should be able to continue
to run your test suites and 3rd party plugins that worked with
pytest-2.2.4.
If you are interested in the precise reasoning (including examples) of the
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
@@ -43,7 +43,7 @@ and more details for those already in the knowing of pytest can be found
in the CHANGELOG below.
Particular thanks for this release go to Floris Bruynooghe, Alex Okrushko
Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping
Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping
to get the new features right and well integrated. Ronny and Floris
also helped to fix a number of bugs and yet more people helped by
providing bug reports.
@@ -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 http://pytest.org/latest/faq.html
especially with respect to the "magic" history, also mention
pytest-django, trial and unittest integration.
@@ -125,10 +125,9 @@ Changes between 2.2.4 and 2.3.0
you can use startdir.bestrelpath(yourpath) to show
nice relative path
- allow plugins to implement both pytest_report_header and
- allow plugins to implement both pytest_report_header and
pytest_sessionstart (sessionstart is invoked first).
- don't show deselected reason line if there is none
- py.test -vv will show all of assert comparisons instead of truncating

View File

@@ -3,16 +3,16 @@ pytest-2.3.1: fix regression with factory functions
pytest-2.3.1 is a quick follow-up release:
- fix issue202 - regression with fixture functions/funcarg factories:
using "self" is now safe again and works as in 2.2.4. Thanks
- fix issue202 - regression with fixture functions/funcarg factories:
using "self" is now safe again and works as in 2.2.4. Thanks
to Eduard Schettino for the quick bug report.
- disable pexpect pytest self tests on Freebsd - thanks Koob for the
- disable pexpect pytest self tests on Freebsd - thanks Koob for the
quick reporting
- fix/improve interactive docs with --markers
See
See
http://pytest.org/

View File

@@ -8,9 +8,9 @@ pytest-2.3.2 is another stabilization release:
- fix teardown-ordering for parametrized setups
- fix unittest and trial compat behaviour with respect to runTest() methods
- issue 206 and others: some improvements to packaging
- fix issue127 and others: improve some docs
- fix issue127 and others: improve some docs
See
See
http://pytest.org/
@@ -26,7 +26,7 @@ holger krekel
Changes between 2.3.1 and 2.3.2
-----------------------------------
- fix issue208 and fix issue29 use new py version to avoid long pauses
- fix issue208 and fix issue29 use new py version to avoid long pauses
when printing tracebacks in long modules
- fix issue205 - conftests in subdirs customizing

View File

@@ -6,7 +6,7 @@ which offers uebersimple assertions, scalable fixture mechanisms
and deep customization for testing with Python. Particularly,
this release provides:
- integration fixes and improvements related to flask, numpy, nose,
- integration fixes and improvements related to flask, numpy, nose,
unittest, mock
- makes pytest work on py24 again (yes, people sometimes still need to use it)
@@ -16,7 +16,7 @@ this release provides:
Thanks to Manuel Jacob, Thomas Waldmann, Ronny Pfannschmidt, Pavel Repin
and Andreas Taumoefolau for providing patches and all for the issues.
See
See
http://pytest.org/
@@ -59,4 +59,3 @@ Changes between 2.3.2 and 2.3.3
- fix issue127 - improve documentation for pytest_addoption() and
add a ``config.getoption(name)`` helper function for consistency.

View File

@@ -10,15 +10,15 @@ comes with the following fixes and features:
can write: -k "name1 or name2" etc. This is a slight usage incompatibility
if you used special syntax like "TestClass.test_method" which you now
need to write as -k "TestClass and test_method" to match a certain
method in a certain test class.
method in a certain test class.
- allow to dynamically define markers via
item.keywords[...]=assignment integrating with "-m" option
- yielded test functions will now have autouse-fixtures active but
- 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
- fix autouse-issue where autouse-fixtures would not be discovered
if defined in a a/conftest.py file and tests in a/tests/test_some.py
if defined in an a/conftest.py file and tests in a/tests/test_some.py
- fix issue226 - LIFO ordering for fixture teardowns
- fix issue224 - invocations with >256 char arguments now work
- fix issue91 - add/discuss package/directory level setups in example
@@ -26,7 +26,7 @@ comes with the following fixes and features:
Thanks in particular to Thomas Waldmann for spotting and reporting issues.
See
See
http://pytest.org/

View File

@@ -13,8 +13,8 @@ few interesting new plugins saw the light last month:
- pytest-random: randomize test ordering
And several others like pytest-django saw maintenance releases.
For a more complete list, check out
https://pypi.python.org/pypi?%3Aaction=search&term=pytest&submit=search.
For a more complete list, check out
https://pypi.org/search/?q=pytest
For general information see:
@@ -81,7 +81,7 @@ Changes between 2.3.4 and 2.3.5
- fix bug where using capsys with pytest.set_trace() in a test
function would break when looking at capsys.readouterr()
- allow to specify prefixes starting with "_" when
- allow to specify prefixes starting with "_" when
customizing python_functions test discovery. (thanks Graham Horler)
- improve PYTEST_DEBUG tracing output by putting
@@ -94,4 +94,3 @@ Changes between 2.3.4 and 2.3.5
- fix issue134 - print the collect errors that prevent running specified test items
- fix issue266 - accept unicode in MarkEvaluator expressions

View File

@@ -1,9 +1,9 @@
pytest-2.4.0: new fixture features/hooks and bug fixes
===========================================================================
The just released pytest-2.4.0 brings many improvements and numerous
The just released pytest-2.4.0 brings many improvements and numerous
bug fixes while remaining plugin- and test-suite compatible apart
from a few supposedly very minor incompatibilities. See below for
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
@@ -13,7 +13,7 @@ a full list of details. A few feature highlights:
- improved pdb support: ``import pdb ; pdb.set_trace()`` now works
without requiring prior disabling of stdout/stderr capturing.
Also the ``--pdb`` options works now on collection and internal errors
and we introduced a new experimental hook for IDEs/plugins to
and we introduced a new experimental hook for IDEs/plugins to
intercept debugging: ``pytest_exception_interact(node, call, report)``.
- shorter monkeypatch variant to allow specifying an import path as
@@ -23,21 +23,21 @@ a full list of details. A few feature highlights:
called if the corresponding setup method succeeded.
- integrate tab-completion on command line options if you
have `argcomplete <http://pypi.python.org/pypi/argcomplete>`_
have `argcomplete <http://pypi.python.org/pypi/argcomplete>`_
configured.
- allow boolean expression directly with skipif/xfail
if a "reason" is also specified.
- a new hook ``pytest_load_initial_conftests`` allows plugins like
`pytest-django <http://pypi.python.org/pypi/pytest-django>`_ to
`pytest-django <https://pypi.org/project/pytest-django/>`_ to
influence the environment before conftest files import ``django``.
- reporting: color the last line red or green depending if
failures/errors occurred or everything passed.
The documentation has been updated to accommodate the changes,
see `http://pytest.org <http://pytest.org>`_
The documentation has been updated to accommodate the changes,
see `http://pytest.org <http://pytest.org>`_
To install or upgrade pytest::
@@ -45,8 +45,8 @@ To install or upgrade pytest::
easy_install -U pytest
**Many thanks to all who helped, including Floris Bruynooghe,
Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff,
**Many thanks to all who helped, including Floris Bruynooghe,
Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff,
Vladimir Keleshev, Mathieu Agopian, Ronny Pfannschmidt, Christian
Theunert and many others.**
@@ -101,12 +101,12 @@ new features:
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no
"-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut.
- fix issue181: --pdb now also works on collect errors (and
on internal errors) . This was implemented by a slight internal
refactoring and the introduction of a new hook
- fix issue181: --pdb now also works on collect errors (and
on internal errors) . This was implemented by a slight internal
refactoring and the introduction of a new hook
``pytest_exception_interact`` hook (see next item).
- fix issue341: introduce new experimental hook for IDEs/terminals to
- fix issue341: introduce new experimental hook for IDEs/terminals to
intercept debugging: ``pytest_exception_interact(node, call, report)``.
- new monkeypatch.setattr() variant to provide a shorter
@@ -124,7 +124,7 @@ new features:
phase of a node.
- simplify pytest.mark.parametrize() signature: allow to pass a
CSV-separated string to specify argnames. For example:
CSV-separated string to specify argnames. For example:
``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])``
works as well as the previous:
``pytest.mark.parametrize(("input", "expected"), ...)``.
@@ -149,10 +149,10 @@ new features:
Bug fixes:
- fix issue358 - capturing options are now parsed more properly
- fix issue358 - capturing options are now parsed more properly
by using a new parser.parse_known_args method.
- pytest now uses argparse instead of optparse (thanks Anthon) which
- pytest now uses argparse instead of optparse (thanks Anthon) which
means that "argparse" is added as a dependency if installing into python2.6
environments or below.
@@ -193,7 +193,7 @@ Bug fixes:
- fix issue323 - sorting of many module-scoped arg parametrizations
- make sessionfinish hooks execute with the same cwd-context as at
session start (helps fix plugin behaviour which write output files
session start (helps fix plugin behaviour which write output files
with relative path such as pytest-cov)
- fix issue316 - properly reference collection hooks in docs
@@ -201,7 +201,7 @@ Bug fixes:
- fix issue 306 - cleanup of -k/-m options to only match markers/test
names/keywords respectively. Thanks Wouter van Ackooy.
- improved doctest counting for doctests in python modules --
- improved doctest counting for doctests in python modules --
files without any doctest items will not show up anymore
and doctest examples are counted as separate test items.
thanks Danilo Bellini.
@@ -211,7 +211,7 @@ Bug fixes:
mode. Thanks Jason R. Coombs.
- fix junitxml generation when test output contains control characters,
addressing issue267, thanks Jaap Broekhuizen
addressing issue267, thanks Jaap Broekhuizen
- fix issue338: honor --tb style for setup/teardown errors as well. Thanks Maho.
@@ -220,6 +220,5 @@ Bug fixes:
- better parametrize error messages, thanks Brianna Laugher
- pytest_terminal_summary(terminalreporter) hooks can now use
".section(title)" and ".line(msg)" methods to print extra
".section(title)" and ".line(msg)" methods to print extra
information at the end of a test run.

View File

@@ -8,7 +8,7 @@ compared to 2.3.5 before they hit more people:
"type" keyword should also be converted to the respective types.
thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362)
- fix dotted filename completion when using argcomplete
- fix dotted filename completion when using argcomplete
thanks Anthon van der Neuth. (fixes issue361)
- fix regression when a 1-tuple ("arg",) is used for specifying

View File

@@ -26,9 +26,9 @@ pytest-2.4.2 is another bug-fixing release:
- remove attempt to "dup" stdout at startup as it's icky.
the normal capturing should catch enough possibilities
of tests messing up standard FDs.
of tests messing up standard FDs.
- add pluginmanager.do_configure(config) as a link to
- add pluginmanager.do_configure(config) as a link to
config.do_configure() for plugin-compatibility
as usual, docs at http://pytest.org and upgrades via::

View File

@@ -4,7 +4,7 @@ pytest-2.5.0: now down to ZERO reported bugs!
pytest-2.5.0 is a big fixing release, the result of two community bug
fixing days plus numerous additional works from many people and
reporters. The release should be fully compatible to 2.4.2, existing
plugins and test suites. We aim at maintaining this level of ZERO reported
plugins and test suites. We aim at maintaining this level of ZERO reported
bugs because it's no fun if your testing tool has bugs, is it? Under a
condition, though: when submitting a bug report please provide
clear information about the circumstances and a simple example which
@@ -17,12 +17,12 @@ help.
For those who use older Python versions, please note that pytest is not
automatically tested on python2.5 due to virtualenv, setuptools and tox
not supporting it anymore. Manual verification shows that it mostly
works fine but it's not going to be part of the automated release
works fine but it's not going to be part of the automated release
process and thus likely to break in the future.
As usual, current docs are at
As usual, current docs are at
http://pytest.org
http://pytest.org
and you can upgrade from pypi via::
@@ -40,28 +40,28 @@ holger krekel
2.5.0
-----------------------------------
- dropped python2.5 from automated release testing of pytest itself
which means it's probably going to break soon (but still works
- dropped python2.5 from automated release testing of pytest itself
which means it's probably going to break soon (but still works
with this release we believe).
- simplified and fixed implementation for calling finalizers when
parametrized fixtures or function arguments are involved. finalization
parametrized fixtures or function arguments are involved. finalization
is now performed lazily at setup time instead of in the "teardown phase".
While this might sound odd at first, it helps to ensure that we are
While this might sound odd at first, it helps to ensure that we are
correctly handling setup/teardown even in complex code. User-level code
should not be affected unless it's implementing the pytest_runtest_teardown
hook and expecting certain fixture instances are torn down within (very
unlikely and would have been unreliable anyway).
- PR90: add --color=yes|no|auto option to force terminal coloring
- PR90: add --color=yes|no|auto option to force terminal coloring
mode ("auto" is default). Thanks Marc Abramowitz.
- fix issue319 - correctly show unicode in assertion errors. Many
thanks to Floris Bruynooghe for the complete PR. Also means
we depend on py>=1.4.19 now.
- fix issue396 - correctly sort and finalize class-scoped parametrized
tests independently from number of methods on the class.
- fix issue396 - correctly sort and finalize class-scoped parametrized
tests independently from number of methods on the class.
- refix issue323 in a better way -- parametrization should now never
cause Runtime Recursion errors because the underlying algorithm
@@ -70,18 +70,18 @@ holger krekel
to problems for more than >966 non-function scoped parameters).
- fix issue290 - there is preliminary support now for parametrizing
with repeated same values (sometimes useful to test if calling
with repeated same values (sometimes useful to test if calling
a second time works as with the first time).
- close issue240 - document precisely how pytest module importing
works, discuss the two common test directory layouts, and how it
works, discuss the two common test directory layouts, and how it
interacts with PEP420-namespace packages.
- fix issue246 fix finalizer order to be LIFO on independent fixtures
depending on a parametrized higher-than-function scoped fixture.
depending on a parametrized higher-than-function scoped fixture.
(was quite some effort so please bear with the complexity of this sentence :)
Thanks Ralph Schmitt for the precise failure example.
- fix issue244 by implementing special index for parameters to only use
indices for paramentrized test ids
@@ -99,9 +99,9 @@ holger krekel
filtering with simple strings that are not valid python expressions.
Examples: "-k 1.3" matches all tests parametrized with 1.3.
"-k None" filters all tests that have "None" in their name
and conversely "-k 'not None'".
and conversely "-k 'not None'".
Previously these examples would raise syntax errors.
- fix issue384 by removing the trial support code
since the unittest compat enhancements allow
trial to handle it on its own
@@ -109,7 +109,7 @@ holger krekel
- don't hide an ImportError when importing a plugin produces one.
fixes issue375.
- fix issue275 - allow usefixtures and autouse fixtures
- fix issue275 - allow usefixtures and autouse fixtures
for running doctest text files.
- fix issue380 by making --resultlog only rely on longrepr instead
@@ -135,20 +135,20 @@ holger krekel
(it already did neutralize pytest.mark.xfail markers)
- refine pytest / pkg_resources interactions: The AssertionRewritingHook
PEP302 compliant loader now registers itself with setuptools/pkg_resources
PEP302 compliant loader now registers itself with setuptools/pkg_resources
properly so that the pkg_resources.resource_stream method works properly.
Fixes issue366. Thanks for the investigations and full PR to Jason R. Coombs.
- pytestconfig fixture is now session-scoped as it is the same object during the
whole test run. Fixes issue370.
whole test run. Fixes issue370.
- avoid one surprising case of marker malfunction/confusion::
@pytest.mark.some(lambda arg: ...)
def test_function():
would not work correctly because pytest assumes @pytest.mark.some
gets a function to be decorated already. We now at least detect if this
would not work correctly because pytest assumes @pytest.mark.some
gets a function to be decorated already. We now at least detect if this
arg is a lambda and thus the example will work. Thanks Alex Gaynor
for bringing it up.
@@ -159,11 +159,11 @@ holger krekel
although it's not needed by pytest itself atm. Also
fix caching. Fixes issue376.
- fix issue221 - handle importing of namespace-package with no
- fix issue221 - handle importing of namespace-package with no
__init__.py properly.
- refactor internal FixtureRequest handling to avoid monkeypatching.
One of the positive user-facing effects is that the "request" object
One of the positive user-facing effects is that the "request" object
can now be used in closures.
- fixed version comparison in pytest.importskip(modname, minverstring)
@@ -172,4 +172,3 @@ holger krekel
does not duplicate the unittest-API into the "plain" namespace.
- fix verbose reporting for @mock'd test functions

View File

@@ -1,8 +1,8 @@
pytest-2.5.1: fixes and new home page styling
===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests
against itself, passing on many different interpreters and platforms.
pytest is a mature Python testing tool with more than a 1000 tests
against itself, passing on many different interpreters and platforms.
The 2.5.1 release maintains the "zero-reported-bugs" promise by fixing
the three bugs reported since the last release a few days ago. It also
@@ -11,12 +11,12 @@ the flask theme from Armin Ronacher:
http://pytest.org
If you have anything more to improve styling and docs,
If you have anything more to improve styling and docs,
we'd be very happy to merge further pull requests.
On the coding side, the release also contains a little enhancement to
fixture decorators allowing to directly influence generation of test
ids, thanks to Floris Bruynooghe. Other thanks for helping with
ids, thanks to Floris Bruynooghe. Other thanks for helping with
this release go to Anatoly Bubenkoff and Ronny Pfannschmidt.
As usual, you can upgrade from pypi via::
@@ -37,11 +37,10 @@ holger krekel
- Allow parameterized fixtures to specify the ID of the parameters by
adding an ids argument to pytest.fixture() and pytest.yield_fixture().
Thanks Floris Bruynooghe.
Thanks Floris Bruynooghe.
- fix issue404 by always using the binary xml escape in the junitxml
plugin. Thanks Ronny Pfannschmidt.
- fix issue407: fix addoption docstring to point to argparse instead of
optparse. Thanks Daniel D. Wright.

View File

@@ -1,8 +1,8 @@
pytest-2.5.2: fixes
pytest-2.5.2: fixes
===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests
against itself, passing on many different interpreters and platforms.
pytest is a mature Python testing tool with more than a 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
actively being worked on (and waiting for the bug reporter's input).
@@ -19,18 +19,18 @@ As usual, you can upgrade from pypi via::
Thanks to the following people who contributed to this release:
Anatoly Bubenkov
Anatoly Bubenkov
Ronny Pfannschmidt
Floris Bruynooghe
Bruno Oliveira
Andreas Pelme
Bruno Oliveira
Andreas Pelme
Jurko Gospodnetić
Piotr Banaszkiewicz
Simon Liedtke
lakka
Lukasz Balcerzak
Philippe Muller
Daniel Hahler
Piotr Banaszkiewicz
Simon Liedtke
lakka
Lukasz Balcerzak
Philippe Muller
Daniel Hahler
have fun,
holger krekel
@@ -39,11 +39,11 @@ holger krekel
-----------------------------------
- fix issue409 -- better interoperate with cx_freeze by not
trying to import from collections.abc which causes problems
trying to import from collections.abc which causes problems
for py27/cx_freeze. Thanks Wolfgang L. for reporting and tracking it down.
- fixed docs and code to use "pytest" instead of "py.test" almost everywhere.
Thanks Jurko Gospodnetic for the complete PR.
Thanks Jurko Gospodnetic for the complete PR.
- fix issue425: mention at end of "py.test -h" that --markers
and --fixtures work according to specified test path (or current dir)
@@ -54,11 +54,10 @@ holger krekel
- copy, cleanup and integrate py.io capture
from pylib 1.4.20.dev2 (rev 13d9af95547e)
- address issue416: clarify docs as to conftest.py loading semantics
- fix issue429: comparing byte strings with non-ascii chars in assert
expressions now work better. Thanks Floris Bruynooghe.
- make capfd/capsys.capture private, its unused and shouldn't be exposed

View File

@@ -52,8 +52,7 @@ Changes 2.6.1
"::" node id specifications (copy pasted from "-v" output)
- fix issue544 by only removing "@NUM" at the end of "::" separated parts
and if the part has an ".py" extension
and if the part has a ".py" extension
- don't use py.std import helper, rather import things directly.
Thanks Bruno Oliveira.

View File

@@ -49,4 +49,3 @@ holger krekel
- Do not mark as universal wheel because Python 2.6 is different from
other builds due to the extra argparse dependency. Fixes issue566.
Thanks sontek.

View File

@@ -49,4 +49,3 @@ Changes 2.6.3
- check xfail/skip also with non-python function test items. Thanks
Floris Bruynooghe.

View File

@@ -62,7 +62,7 @@ holger krekel
- fix issue655: work around different ways that cause python2/3
to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
- fix issue615: assertion re-writing did not correctly escape % signs
- fix issue615: assertion rewriting did not correctly escape % signs
when formatting boolean operations, which tripped over mixing
booleans with modulo operators. Thanks to Tom Viner for the report,
triaging and fix.
@@ -98,4 +98,3 @@ holger krekel
- On failure, the ``sys.last_value``, ``sys.last_type`` and
``sys.last_traceback`` are set, so that a user can inspect the error
via postmortem debugging (almarklein).

View File

@@ -55,4 +55,3 @@ The py.test Development Team
- fix issue756, fix issue752 (and similar issues): depend on py-1.4.29
which has a refined algorithm for traceback generation.

View File

@@ -53,7 +53,6 @@ The py.test Development Team
Thanks Gabriel Reis for the PR.
- add more talks to the documentation
- extend documentation on the --ignore cli option
- use pytest-runner for setuptools integration
- extend documentation on the --ignore cli option
- use pytest-runner for setuptools integration
- minor fixes for interaction with OS X El Capitan system integrity protection (thanks Florian)

View File

@@ -28,4 +28,4 @@ The py.test Development Team
2.8.7 (compared to 2.8.6)
-------------------------
- fix #1338: use predictable object resolution for monkeypatch
- fix #1338: use predictable object resolution for monkeypatch

View File

@@ -14,25 +14,25 @@ As usual, you can upgrade from pypi via::
Thanks to all who contributed to this release, among them:
Anatoly Bubenkov
Bruno Oliveira
Buck Golemon
David Vierra
Florian Bruhin
Galaczi Endre
Georgy Dyuldin
Lukas Bednar
Luke Murphy
Marcin Biernat
Matt Williams
Michael Aquilina
Raphael Pierzina
Ronny Pfannschmidt
Ryan Wooden
Tiemo Kieft
TomV
holger krekel
jab
Anatoly Bubenkov
Bruno Oliveira
Buck Golemon
David Vierra
Florian Bruhin
Galaczi Endre
Georgy Dyuldin
Lukas Bednar
Luke Murphy
Marcin Biernat
Matt Williams
Michael Aquilina
Raphael Pierzina
Ronny Pfannschmidt
Ryan Wooden
Tiemo Kieft
TomV
holger krekel
jab
Happy testing,
@@ -76,18 +76,18 @@ The py.test Development Team
**Changes**
* **Important**: `py.code <https://pylib.readthedocs.io/en/latest/code.html>`_ has been
merged into the ``pytest`` repository as ``pytest._code``. This decision
was made because ``py.code`` had very few uses outside ``pytest`` and the
fact that it was in a different repository made it difficult to fix bugs on
merged into the ``pytest`` repository as ``pytest._code``. This decision
was made because ``py.code`` had very few uses outside ``pytest`` and the
fact that it was in a different repository made it difficult to fix bugs on
its code in a timely manner. The team hopes with this to be able to better
refactor out and improve that code.
This change shouldn't affect users, but it is useful to let users aware
if they encounter any strange behavior.
Keep in mind that the code for ``pytest._code`` is **private** and
Keep in mind that the code for ``pytest._code`` is **private** and
**experimental**, so you definitely should not import it explicitly!
Please note that the original ``py.code`` is still available in
Please note that the original ``py.code`` is still available in
`pylib <https://pylib.readthedocs.io>`_.
* ``pytest_enter_pdb`` now optionally receives the pytest config object.
@@ -129,8 +129,8 @@ The py.test Development Team
* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records
with same name.
.. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
.. _#1422: https://github.com/pytest-dev/pytest/issues/1422
@@ -156,4 +156,4 @@ The py.test Development Team
.. _@tomviner: https://github.com/tomviner
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
.. _@rabbbit: https://github.com/rabbbit
.. _@hackebrot: https://github.com/hackebrot
.. _@hackebrot: https://github.com/hackebrot

View File

@@ -14,17 +14,17 @@ As usual, you can upgrade from pypi via::
Thanks to all who contributed to this release, among them:
Bruno Oliveira
Daniel Hahler
Dmitry Malinovsky
Florian Bruhin
Floris Bruynooghe
Matt Bachmann
Ronny Pfannschmidt
TomV
Vladimir Bolshakov
Zearin
palaviv
Bruno Oliveira
Daniel Hahler
Dmitry Malinovsky
Florian Bruhin
Floris Bruynooghe
Matt Bachmann
Ronny Pfannschmidt
TomV
Vladimir Bolshakov
Zearin
palaviv
Happy testing,

View File

@@ -8,10 +8,10 @@ against itself, passing on many different interpreters and platforms.
This release contains a lot of bugs fixes and improvements, and much of
the work done on it was possible because of the 2016 Sprint[1], which
was funded by an indiegogo campaign which raised over US$12,000 with
nearly 100 backers.
was funded by an indiegogo campaign which raised over US$12,000 with
nearly 100 backers.
There's a "What's new in pytest 3.0" [2] blog post highlighting the
There's a "What's new in pytest 3.0" [2] blog post highlighting the
major features in this release.
To see the complete changelog and documentation, please visit:

View File

@@ -7,7 +7,7 @@ This release fixes some regressions reported in version 3.0.0, being a
drop-in replacement. To upgrade:
pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -7,7 +7,7 @@ This release fixes some regressions and bugs reported in version 3.0.1, being a
drop-in replacement. To upgrade::
pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -3,11 +3,11 @@ pytest-3.0.3
pytest 3.0.3 has just been released to PyPI.
This release fixes some regressions and bugs reported in the last version,
This release fixes some regressions and bugs reported in the last version,
being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -3,11 +3,11 @@ pytest-3.0.4
pytest 3.0.4 has just been released to PyPI.
This release fixes some regressions and bugs reported in the last version,
This release fixes some regressions and bugs reported in the last version,
being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.0.5 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.0.6 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.

View File

@@ -6,7 +6,7 @@ pytest 3.0.7 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.1.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.1.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.1.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.2.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -6,7 +6,7 @@ pytest 3.2.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:

View File

@@ -0,0 +1,23 @@
pytest-3.2.3
=======================================
pytest 3.2.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Bruno Oliveira
* Evan
* Joe Hamman
* Oliver Bestwalter
* Ronny Pfannschmidt
* Xuan Luong
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,36 @@
pytest-3.2.4
=======================================
pytest 3.2.4 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Bruno Oliveira
* Christian Boelsen
* Christoph Buchner
* Daw-Ran Liou
* Florian Bruhin
* Franck Michea
* Leonard Lausen
* Matty G
* Owen Tuz
* Pavel Karateev
* Pierre GIRAUD
* Ronny Pfannschmidt
* Stephen Finucane
* Sviatoslav Abakumov
* Thomas Hisch
* Tom Dalton
* Xuan Luong
* Yorgos Pagles
* Семён Марьясин
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,18 @@
pytest-3.2.5
=======================================
pytest 3.2.5 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Bruno Oliveira
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,50 @@
pytest-3.3.0
=======================================
The pytest team is proud to announce the 3.3.0 release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:
http://doc.pytest.org/en/latest/changelog.html
For complete documentation, please visit:
http://docs.pytest.org
As usual, you can upgrade from pypi via:
pip install -U pytest
Thanks to all who contributed to this release, among them:
* Anthony Sottile
* Bruno Oliveira
* Ceridwen
* Daniel Hahler
* Dirk Thomas
* Dmitry Malinovsky
* Florian Bruhin
* George Y. Kussumoto
* Hugo
* Jesús Espino
* Joan Massich
* Ofir
* OfirOshir
* Ronny Pfannschmidt
* Samuel Dion-Girardeau
* Srinivas Reddy Thatiparthy
* Sviatoslav Abakumov
* Tarcisio Fischer
* Thomas Hisch
* Tyler Goodlet
* hugovk
* je
* prokaktus
Happy testing,
The Pytest Development Team

View File

@@ -0,0 +1,25 @@
pytest-3.3.1
=======================================
pytest 3.3.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Bruno Oliveira
* Daniel Hahler
* Eugene Prikazchikov
* Florian Bruhin
* Roland Puntaier
* Ronny Pfannschmidt
* Sebastian Rahlf
* Tom Viner
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,28 @@
pytest-3.3.2
=======================================
pytest 3.3.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Anthony Sottile
* Antony Lee
* Austin
* Bruno Oliveira
* Florian Bruhin
* Floris Bruynooghe
* Henk-Jaap Wagenaar
* Jurko Gospodnetić
* Ronny Pfannschmidt
* Srinivas Reddy Thatiparthy
* Thomas Hisch
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,52 @@
pytest-3.4.0
=======================================
The pytest team is proud to announce the 3.4.0 release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:
http://doc.pytest.org/en/latest/changelog.html
For complete documentation, please visit:
http://docs.pytest.org
As usual, you can upgrade from pypi via:
pip install -U pytest
Thanks to all who contributed to this release, among them:
* Aaron
* Alan Velasco
* Anders Hovmöller
* Andrew Toolan
* Anthony Sottile
* Aron Coyle
* Brian Maissy
* Bruno Oliveira
* Cyrus Maden
* Florian Bruhin
* Henk-Jaap Wagenaar
* Ian Lesperance
* Jon Dufresne
* Jurko Gospodnetić
* Kate
* Kimberly
* Per A. Brodtkorb
* Pierre-Alexandre Fonta
* Raphael Castaneda
* Ronny Pfannschmidt
* ST John
* Segev Finer
* Thomas Hisch
* Tzu-ping Chung
* feuillemorte
Happy testing,
The Pytest Development Team

View File

@@ -0,0 +1,27 @@
pytest-3.4.1
=======================================
pytest 3.4.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Aaron
* Alan Velasco
* Andy Freeland
* Brian Maissy
* Bruno Oliveira
* Florian Bruhin
* Jason R. Coombs
* Marcin Bachry
* Pedro Algarvio
* Ronny Pfannschmidt
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,28 @@
pytest-3.4.2
=======================================
pytest 3.4.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Allan Feldman
* Bruno Oliveira
* Florian Bruhin
* Jason R. Coombs
* Kyle Altendorf
* Maik Figura
* Ronny Pfannschmidt
* codetriage-readme-bot
* feuillemorte
* joshm91
* mike
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,51 @@
pytest-3.5.0
=======================================
The pytest team is proud to announce the 3.5.0 release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:
http://doc.pytest.org/en/latest/changelog.html
For complete documentation, please visit:
http://docs.pytest.org
As usual, you can upgrade from pypi via:
pip install -U pytest
Thanks to all who contributed to this release, among them:
* Allan Feldman
* Brian Maissy
* Bruno Oliveira
* Carlos Jenkins
* Daniel Hahler
* Florian Bruhin
* Jason R. Coombs
* Jeffrey Rackauckas
* Jordan Speicher
* Julien Palard
* Kale Kundert
* Kostis Anagnostopoulos
* Kyle Altendorf
* Maik Figura
* Pedro Algarvio
* Ronny Pfannschmidt
* Tadeu Manoel
* Tareq Alayan
* Thomas Hisch
* William Lee
* codetriage-readme-bot
* feuillemorte
* joshm91
* mike
Happy testing,
The Pytest Development Team

View File

@@ -0,0 +1,30 @@
pytest-3.5.1
=======================================
pytest 3.5.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Brian Maissy
* Bruno Oliveira
* Darren Burns
* David Chudzicki
* Floris Bruynooghe
* Holger Kohr
* Irmen de Jong
* Jeffrey Rackauckas
* Rachel Kogan
* Ronny Pfannschmidt
* Stefan Scherfke
* Tim Strazny
* Семён Марьясин
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,41 @@
pytest-3.6.0
=======================================
The pytest team is proud to announce the 3.6.0 release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:
http://doc.pytest.org/en/latest/changelog.html
For complete documentation, please visit:
http://docs.pytest.org
As usual, you can upgrade from pypi via:
pip install -U pytest
Thanks to all who contributed to this release, among them:
* Anthony Shaw
* ApaDoctor
* Brian Maissy
* Bruno Oliveira
* Jon Dufresne
* Katerina Koukiou
* Miro Hrončok
* Rachel Kogan
* Ronny Pfannschmidt
* Tim Hughes
* Tyler Goodlet
* Ville Skyttä
* aviral1701
* feuillemorte
Happy testing,
The Pytest Development Team

View File

@@ -0,0 +1,24 @@
pytest-3.6.1
=======================================
pytest 3.6.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Anthony Sottile
* Bruno Oliveira
* Jeffrey Rackauckas
* Miro Hrončok
* Niklas Meinzer
* Oliver Bestwalter
* Ronny Pfannschmidt
Happy testing,
The pytest Development Team

View File

@@ -0,0 +1,29 @@
pytest-3.6.2
=======================================
pytest 3.6.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Alan Velasco
* Alex Barbato
* Anthony Sottile
* Bartosz Cierocki
* Bruno Oliveira
* Daniel Hahler
* Guoqiang Zhang
* Hynek Schlawack
* John T. Wodder II
* Michael Käufl
* Ronny Pfannschmidt
* Samuel Dion-Girardeau
Happy testing,
The pytest Development Team

View File

@@ -25,23 +25,23 @@ to assert that your function returns a certain value. If this assertion fails
you will see the return value of the function call::
$ pytest test_assert1.py
======= test session starts ========
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 item
test_assert1.py F
======= FAILURES ========
_______ test_function ________
test_assert1.py F [100%]
================================= FAILURES =================================
______________________________ test_function _______________________________
def test_function():
> assert f() == 4
E assert 3 == 4
E + where 3 = f()
test_assert1.py:5: AssertionError
======= 1 failed in 0.12 seconds ========
========================= 1 failed in 0.12 seconds =========================
``pytest`` has support for showing the values of the most common subexpressions
including calls, attributes, comparisons, and binary and unary
@@ -91,7 +91,7 @@ In the context manager form you may use the keyword argument
``message`` to specify a custom failure message::
>>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"):
... pass
... pass
... Failed: Expecting ZeroDivisionError
If you want to write test code that works on Python 2.4 as well,
@@ -168,16 +168,16 @@ when it encounters comparisons. For example::
if you run this module::
$ pytest test_assert2.py
======= test session starts ========
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 item
test_assert2.py F
======= FAILURES ========
_______ test_set_comparison ________
test_assert2.py F [100%]
================================= FAILURES =================================
___________________________ test_set_comparison ____________________________
def test_set_comparison():
set1 = set("1308")
set2 = set("8035")
@@ -188,9 +188,9 @@ if you run this module::
E Extra items in the right set:
E '5'
E Use -v to get the full diff
test_assert2.py:5: AssertionError
======= 1 failed in 0.12 seconds ========
========================= 1 failed in 0.12 seconds =========================
Special comparisons are done for a number of cases:
@@ -209,8 +209,8 @@ the ``pytest_assertrepr_compare`` hook.
.. autofunction:: _pytest.hookspec.pytest_assertrepr_compare
:noindex:
As an example consider adding the following hook in a conftest.py which
provides an alternative explanation for ``Foo`` objects::
As an example consider adding the following hook in a :ref:`conftest.py <conftest.py>`
file which provides an alternative explanation for ``Foo`` objects::
# content of conftest.py
from test_foocompare import Foo
@@ -238,17 +238,17 @@ you can run the test module and get the custom output defined in
the conftest file::
$ pytest -q test_foocompare.py
F
======= FAILURES ========
_______ test_compare ________
F [100%]
================================= FAILURES =================================
_______________________________ test_compare _______________________________
def test_compare():
f1 = Foo(1)
f2 = Foo(2)
> assert f1 == f2
E assert Comparing Foo instances:
E vals: 1 != 2
test_foocompare.py:11: AssertionError
1 failed in 0.12 seconds

View File

@@ -10,3 +10,11 @@ With the pytest 3.0 release we introduced a clear communication scheme for when
To communicate changes we are already issuing deprecation warnings, but they are not displayed by default. In pytest 3.0 we changed the default setting so that pytest deprecation warnings are displayed if not explicitly silenced (with ``--disable-pytest-warnings``).
We will only remove deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we will not remove it in 4.0 but in 5.0).
Deprecation Roadmap
-------------------
We track deprecation and removal of features using milestones and the `deprecation <https://github.com/pytest-dev/pytest/issues?q=label%3A%22type%3A+deprecation%22>`_ and `removal <https://github.com/pytest-dev/pytest/labels/type%3A%20removal>`_ labels on GitHub.
Following our deprecation policy, after starting issuing deprecation warnings we keep features for *at least* two minor versions before considering removal.

View File

@@ -14,7 +14,7 @@ Install argcomplete using::
For global activation of all argcomplete enabled python applications run::
sudo activate-global-python-argcomplete
sudo activate-global-python-argcomplete
For permanent (but not global) ``pytest`` activation, use::
@@ -23,6 +23,3 @@ For permanent (but not global) ``pytest`` activation, use::
For one-time activation of argcomplete for ``pytest`` only, use::
eval "$(register-python-argcomplete pytest)"

View File

@@ -1,113 +1,90 @@
:orphan:
.. _`pytest helpers`:
Pytest API and builtin fixtures
================================================
This is a list of ``pytest.*`` API functions and fixtures.
Most of the information of this page has been moved over to :ref:`reference`.
For information on plugin hooks and objects, see :ref:`plugins`.
For information on the ``pytest.mark`` mechanism, see :ref:`mark`.
For the below objects, you can also interactively ask for help, e.g. by
typing on the Python interactive prompt something like::
import pytest
help(pytest)
.. currentmodule:: pytest
Invoking pytest interactively
---------------------------------------------------
.. autofunction:: main
More examples at :ref:`pytest.main-usage`
Helpers for assertions about Exceptions/Warnings
--------------------------------------------------------
.. autofunction:: raises
Examples at :ref:`assertraises`.
.. autofunction:: deprecated_call
Comparing floating point numbers
--------------------------------
.. autofunction:: approx
Raising a specific test outcome
--------------------------------------
You can use the following functions in your test, fixture or setup
functions to force a certain test outcome. Note that most often
you can rather use declarative marks, see :ref:`skipping`.
.. autofunction:: _pytest.outcomes.fail
.. autofunction:: _pytest.outcomes.skip
.. autofunction:: _pytest.outcomes.importorskip
.. autofunction:: _pytest.outcomes.xfail
.. autofunction:: _pytest.outcomes.exit
Fixtures and requests
-----------------------------------------------------
To mark a fixture function:
.. autofunction:: _pytest.fixtures.fixture
Tutorial at :ref:`fixtures`.
The ``request`` object that can be used from fixture functions.
.. autoclass:: _pytest.fixtures.FixtureRequest()
:members:
.. _builtinfixtures:
.. _builtinfuncargs:
Builtin fixtures/function arguments
-----------------------------------------
You can ask for available builtin or project-custom
:ref:`fixtures <fixtures>` by typing::
For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures (add ``-v`` to also see fixtures with leading ``_``), type ::
$ pytest -q --fixtures
cache
Return a cache object that can persist state between testing sessions.
cache.get(key, default)
cache.set(key, value)
Keys must be a ``/`` separated value, where the first part is usually the
name of your plugin or application to avoid clashes with other cache users.
Values can be any object handled by the json stdlib module.
capsys
Enable capturing of writes to sys.stdout/sys.stderr and make
Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
captured output available via ``capsys.readouterr()`` method calls
which return a ``(out, err)`` tuple.
which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text``
objects.
capsysbinary
Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
captured output available via ``capsys.readouterr()`` method calls
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes``
objects.
capfd
Enable capturing of writes to file descriptors 1 and 2 and make
Enable capturing of writes to file descriptors ``1`` and ``2`` and make
captured output available via ``capfd.readouterr()`` method calls
which return a ``(out, err)`` tuple.
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text``
objects.
capfdbinary
Enable capturing of write to file descriptors 1 and 2 and make
captured output available via ``capfdbinary.readouterr`` method calls
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be
``bytes`` objects.
doctest_namespace
Inject names into the doctest namespace.
Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
pytestconfig
the pytest config object with access to command line opts.
record_xml_property
Add extra xml properties to the tag for the calling test.
Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
Example::
def test_foo(pytestconfig):
if pytestconfig.getoption("verbose"):
...
record_property
Add an extra properties the calling test.
User properties become part of the test report and are available to the
configured reporters, like JUnit XML.
The fixture is callable with ``(name, value)``, with value being automatically
xml-encoded.
Example::
def test_function(record_property):
record_property("example_key", 1)
record_xml_property
(Deprecated) use record_property.
record_xml_attribute
Add extra xml attributes to the tag for the calling test.
The fixture is callable with ``(name, value)``, with value being
automatically xml-encoded
caplog
Access and control log capturing.
Captured logs are available through the following methods::
* caplog.text -> string containing formatted log output
* caplog.records -> list of logging.LogRecord instances
* caplog.record_tuples -> list of (logger_name, level, message) tuples
* caplog.clear() -> clear captured records and formatted log output string
monkeypatch
The returned ``monkeypatch`` fixture provides these
helper methods to modify objects, dictionaries or os.environ::
monkeypatch.setattr(obj, name, value, raising=True)
monkeypatch.delattr(obj, name, raising=True)
monkeypatch.setitem(mapping, name, value)
@@ -116,17 +93,14 @@ You can ask for available builtin or project-custom
monkeypatch.delenv(name, value, raising=True)
monkeypatch.syspath_prepend(path)
monkeypatch.chdir(path)
All modifications will be undone after the requesting
test function or fixture has finished. The ``raising``
parameter determines if a KeyError or AttributeError
will be raised if the set/deletion operation has no target.
recwarn
Return a WarningsRecorder instance that provides these methods:
* ``pop(category=None)``: return last warning matching the category.
* ``clear()``: clear list of warnings
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
See http://docs.python.org/library/warnings.html for information
on warning categories.
tmpdir_factory
@@ -137,5 +111,12 @@ You can ask for available builtin or project-custom
created as a sub directory of the base temporary
directory. The returned object is a `py.path.local`_
path object.
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
no tests ran in 0.12 seconds
You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like::
import pytest
help(pytest)

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