Commit Graph

2500 Commits

Author SHA1 Message Date
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
Thomas Hisch 5e92644f94 Properly reset LogCaptureHandler in caplog
Closes #3297
2018-03-13 00:36:51 +02: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 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 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 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 988ace9eb2 Add documentation for marks 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 215c6b281e Add Monkeypatch and tutorial links for logging 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 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
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
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
Maik Figura 056d9e8dc2
Use `isdir` instead of `exists` 2018-03-04 00:55:04 +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
feuillemorte f501d0021c #3268 Fix warning variable 2018-03-02 11:28:30 +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 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
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 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 94050a8aaf Remove config paramter from pytest_terminal_summary as discussed during review 2018-02-27 07:26:25 -03:00
Jason R. Coombs cfaf3600c1 Consolidate behavior by using filterfalse and always_iterable 2018-02-27 03:38:56 -05:00
Bruno Oliveira 4e405dd9f9 Show "short test summary info" after tracebacks and warnings 2018-02-26 21:12:33 -03:00
feuillemorte 46c5d5355e #3203 Remove progress when no-capture 2018-02-26 17:19:58 +03:00
Jeffrey Rackauckas 307cd6630f Add the ability to use platform in pytest.mark.skipif 2018-02-25 22:38:25 -08:00
Ronny Pfannschmidt da3f4045e7
Merge pull request #3250 from RonnyPfannschmidt/mark-package
Mark package
2018-02-24 18:19:27 +01: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 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 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 60358b6db8
Fix linting 2018-02-22 18:49:20 -03: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 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
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
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
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 7a62619a75 Merge remote-tracking branch 'upstream/master' into features 2018-02-21 10:39:55 -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 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 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 69d608aec3 Merge remote-tracking branch 'upstream/master' into merge-upstream 2018-02-17 09:38:06 -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
Jordan Speicher 774c539f1a Add --deselect command line option
Fixes #3198
2018-02-16 08:17:37 -06: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
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 ce1872e7e8 Merge branch 'master' into bugfix/985/disable-output-capturing-in-doctest 2018-02-13 12:33:07 -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