Commit Graph

2536 Commits

Author SHA1 Message Date
Bruno Oliveira 5ea647a245 Attempt to fix flaky test_request_garbage on Windows
Fix #3564
2018-06-10 19:18:44 -03: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 1a7dcd73cf Add a default value to CallInfo.result 2018-06-09 16:58:23 -07: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
Ronny Pfannschmidt 464117b472 fix imports in tests 2018-06-05 10:20:36 +02: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
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 ff19f273a9 Use six to import queue instead of py.builtin._tryimport 2018-06-03 13:12:49 -07:00
Anthony Sottile 3d0717813a bytes() is a builtin in python2.6+ 2018-06-03 11:54:36 -07: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 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
Ronny Pfannschmidt 9ed1289b01 run black on test_source_multiline_block.py 2018-05-24 12:12:12 +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 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 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
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 674879976f Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-05-18 12:30:08 -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
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
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
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
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
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
turturica 05b5b64379 Merge remote-tracking branch 'upstream/features' into features 2018-04-25 21:20:39 -07:00
Bruno Oliveira 63368e07ea Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-04-24 21:26:45 -03:00
turturica d483b401ee Merge remote-tracking branch 'upstream/features' into features 2018-04-24 13:45:10 -07:00
turturica acacf75f49 Added another package-scoped fixture test.
Changed existing complex tests to use package fixtures.
2018-04-24 13:32:58 -07: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
turturica fedc78522b Build a stack of all previous packages instead of just the one closest to the initial argument(s).
Address #3358 by caching nodes in a session dict.
2018-04-21 18:39:42 -07:00
turturica e44d4e6508 Merge remote-tracking branch 'upstream/features' into features 2018-04-20 15:21:24 -07:00
Bruno Oliveira 3318e53d01
Merge pull request #3382 from feuillemorte/3290-improve-monkeypatch
#3290 improve monkeypatch
2018-04-19 17:05:52 -03:00
turturica 7d923c389e Merge remote-tracking branch 'upstream/features' into features 2018-04-18 00:11:03 -07:00
turturica c02e8d8b0d Fix test collection when tests are passed as IDs at the command line. Note this is still broken due to #3358. 2018-04-16 11:44:05 -07:00
Brian Maissy 857098fe0f added indicative error when parametrizing an argument with a default value 2018-04-15 20:52:57 +03:00
feuillemorte ba7cad3962 #3290 Fix comments 2018-04-13 16:00:07 +03: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
turturica 2b1410895e Add package scoped fixtures #2283 2018-04-11 15:39:42 -07:00
Bruno Oliveira 10a7160549 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-04-11 18:07:47 -03:00
feuillemorte 3d60f955f0 #3290 Added test 2018-04-11 12:45:37 +03:00
Bruno Oliveira 78c900448e Add acceptance test for #2798 2018-04-10 21:04:30 -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
Tim Strazny ec2d8223cf Fix issue #3372 2018-04-06 14:16:12 +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
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
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
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 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 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 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
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
Anthony Shaw 09e5a226dc
add broken test 2018-03-29 09:03:20 +11: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 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
Anthony Shaw f1f4c8c104
updates for code review recommendations 2018-03-27 17:38:17 +11: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 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 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
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 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
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
Bruno Oliveira 1fff81e21d Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-03-16 18:15:28 -03:00
Jason R. Coombs 3c3fc3bb9d Add test capturing new expectation. Ref #3314. 2018-03-15 21:25:50 -04: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
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
Kostis Anagnostopoulos 68375513f3 Add TC to demonstrate #3297 that caplog.clear() does not clean text 2018-03-13 00:28:47 +02: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
Ronny Pfannschmidt 5e5935759e make nodeids precalculated, there is no sane reason to commpute lazyly 2018-03-09 10:52:59 +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 99aab2c3f5 #3268 Added deprecation to custom configs 2018-03-02 10:52:38 +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
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
feuillemorte 409b919fc0 #3260 Added test 2018-02-27 19:16:45 +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
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
feuillemorte 31476c69ab #3203 Fix tests 2018-02-26 17:39:32 +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
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
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
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
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
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
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
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 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
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
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
Florian Bruhin 3cbf0c8ec0 Raise unexpected exceptions with pytest.raises() using match= 2018-02-15 12:11:56 +01: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
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 063e2da967
Merge pull request #3176 from feuillemorte/1478_no_stdout_option
#1478 Added --no-stdout option
2018-02-09 18:36:36 -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
feuillemorte 71367881ed #1478 Added --show-capture=both option (fix comments) 2018-02-08 16:21:22 +03: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 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
feuillemorte 1a650a9eb9 #1478 Added --show-capture option 2018-02-06 23:38:51 +03:00
Pedro Algarvio 67558e0e22
Additionally handle logstart and logfinish hooks 2018-02-06 15:45:36 +00:00
Pedro Algarvio 0d15a46863
Don't traceback on unkown sections. 2018-02-05 19:09:38 +00: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 8c81722a0c
Merge pull request #3167 from nicoddemus/fix-py37
Fix test for py37
2018-02-02 17:13:00 -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
feuillemorte 949a620d3a #1478 Added --no-stdout option 2018-01-31 22:36:28 +03: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
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
Bruno Oliveira 6e4efccc38 Rename test_cache to test_cacheprovider for consistency with cacheprovider 2018-01-29 08:40:29 -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 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
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 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
Alan Velasco a24ca9872f Change cache directory name to include `pytest` 2018-01-25 07:50:08 -06: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 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 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 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 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 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
feuillemorte 83034bbd48 #1642 Fix rootdir option 2018-01-20 22:30:01 +03: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 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 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
Anders Hovmöller 7ea5a22657 Access captures logs in teardown 2018-01-19 12:42:35 +01:00
feuillemorte 4a18d76160 #1642 remove print 2018-01-17 23:14:40 +03:00
feuillemorte d784155fd2 #1642 Add rootdir option 2018-01-17 23:02:31 +03:00
feuillemorte 8433e2ba04 #2953 fix comments: fix exception type 2018-01-16 23:35:57 +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
Brian Maissy 4a3863c2e2 use flush in order to avoid hanging on mac 2018-01-14 23:00:23 +02:00
Bruno Oliveira 5939b336cd Fix progress report when tests fail during teardown
Fix #3088
2018-01-11 20:42:05 -02: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
Anthony Sottile 205e29d843 Remove unnecessary `# noqa` comments.
Commit automated with https://github.com/asottile/yesqa
2017-12-22 08:29:48 -08: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 afc607cfd8 move node base classes from main to nodes 2017-12-18 11:08:20 +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
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
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 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
Ronny Pfannschmidt 476d4df1b7
Merge pull request #3010 from cryvate/fix-issue-2985
Improve handling of pyargs
2017-12-13 13:56:42 +01:00
Antony Lee c8e7d1ae34 Respect PYTEST_DONT_REWRITE for plugins too. 2017-12-12 17:43:17 -08: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
Srinivas Reddy Thatiparthy c2cd239d35 remove _ast reference from test cases as well 2017-12-11 23:24:47 +05:30
Jurko Gospodnetić 3b85e0c3a9 simplify test_conftest_found_with_double_dash() test code 2017-12-11 15:10:04 +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ć 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
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
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
ST John 652936f47f make linter happier 2017-11-30 10:29:05 +00:00
ST John e66473853c add test 2017-11-30 10:19:29 +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
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 6843d45c51 added test for #2920 fix 2017-11-28 17:29:52 +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 4678cbeb91 Merge remote-tracking branch 'upstream/features' 2017-11-27 19:37:58 -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 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 f50ace7c0a Merge remote-tracking branch 'upstream/master' into release-3.3.0 2017-11-23 20:20:40 +00:00
Bruno Oliveira dc574c60ef Use regex match-count syntax to improve test readability 2017-11-22 17:16:25 -02:00
Sviatoslav Abakumov 5e71ffab87 Handle marks without description 2017-11-22 15:47:15 +03: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 3a5dbabf60 Add tests for progress output and docs for ``console_output_style``
Fix #2657
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
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
Bruno Oliveira 1f08d990d5 Deprecate metafunc.addcall
Fix #2876
2017-11-15 15:16:00 -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 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
Ronny Pfannschmidt f0f2d2b861
Merge branch 'master' into fix-missing-nodeid-with-pyargs 2017-11-11 14:33:55 +01: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 3900879a5c Mark test_py2_unicode as xfail in PyPy2 on Windows
#2905
2017-11-09 19:17:17 -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
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
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 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
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
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
Bruno Oliveira 27cea340f3 Remove trailing whitespace 2017-10-26 21:55:28 -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
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 6b86b0dbfe Fix additional linting issues 2017-10-24 21:01:00 -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
Sviatoslav Abakumov 52aadcd7c1 Strip whitespace from markers in INI config
Resolves #2856.
2017-10-24 14:18:39 +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 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