Commit Graph

2449 Commits

Author SHA1 Message Date
Anthony Sottile af0059079c Remove unused fix-lint tox environment 2018-07-08 17:05:01 -07:00
Anthony Sottile 4ae93a7a07 Remove obsolete __future__ imports 2018-07-08 08:37:02 -07:00
Anthony Sottile 42bbb4fa8a Use -mpytest when invoking pytest in pytester 2018-07-07 17:18:44 -07:00
Bruno Oliveira 303133f013
Merge pull request #3647 from jeffreyrack/3610-add-trace-option
3610 add trace option
2018-07-07 10:05:34 -03:00
Bruno Oliveira 3c19370cec Merge remote-tracking branch 'upstream/features' into jonozzz/features 2018-07-05 18:15:17 -03:00
Bruno Oliveira 7696d5371a Merge remote-tracking branch 'upstream/master' into features 2018-07-04 18:49:35 -03:00
Jeffrey Rackauckas 067de257e1 Fix test_pdb.py with pexpect 2018-07-02 21:03:21 -07:00
Jeffrey Rackauckas 4a925ef5e9 Fixing bug in test. 2018-07-02 20:29:59 -07:00
Jeffrey Rackauckas 2f1a2cf07f Fixing --trace test. 2018-07-02 19:55:08 -07:00
Jeffrey Rackauckas 6cc4fe2412 Fixing bad indentation 2018-07-02 19:53:46 -07:00
Jeffrey Rackauckas 10a8691eca Add support for yielded functions. 2018-07-02 19:46:26 -07:00
Jeffrey Rackauckas bc268a58d1 Adding needed newline 2018-07-01 20:22:50 -07:00
Jeffrey Rackauckas 0b70477930 Fix linting issues. 2018-07-01 20:18:00 -07:00
Jeffrey Rackauckas 533f4cc10c Fix test to pass 2018-06-30 21:36:27 -07:00
Jeffrey Rackauckas 952bbefaac Add initial test. 2018-06-30 18:26:58 -07:00
Bruno Oliveira 2b75a311a7
Merge pull request #3637 from RonnyPfannschmidt/fix-3631
fix #3631 - don't store legacy markinfo when its impossible
2018-06-30 17:48:46 -03:00
victor dad3e77319 Improve test readability. 2018-06-30 18:57:24 +02:00
Victor 3a1c15316b Updated test for python 2.7 2018-06-30 16:11:20 +02:00
Victor a6636fddcd Fixed open function with encoding in python 2.7 2018-06-29 17:04:30 +02:00
Victor 342f2cdc17 Fixes #3630 2018-06-29 16:09:39 +02:00
Ronny Pfannschmidt 5bd5b8c68a fix #3631 - don't store legacy markinfo when its impossible 2018-06-29 14:01:20 +02:00
Ronny Pfannschmidt 0fd86ec8a8 move some fill fixture acceptance tests contents to the examples script folder 2018-06-29 10:58:33 +02:00
Ronny Pfannschmidt 4ae7e9788c fix quotes in scope order test 2018-06-29 07:13:18 +02:00
Ronny Pfannschmidt 5582ad0445 remove use of formatting in test_func_closure_module_auto
this makes it apparent that pytester should supply some kind of variable support
2018-06-29 07:07:03 +02:00
Ronny Pfannschmidt 982b614010 remove format calls for most fixture tests 2018-06-29 07:07:03 +02:00
Ronny Pfannschmidt 7845ab4bc3 remove test file formatting from TestContextManagerFixtureFuncs 2018-06-29 07:07:03 +02:00
Bruno Oliveira 8680dfc939
Merge pull request #3629 from egnartsms/issue-2220-param-breaks-dep
Make test parametrization override indirect fixtures
2018-06-28 21:43:21 -03:00
Ronny Pfannschmidt 3c73d6298a merge from master to features 2018-06-28 17:32:41 +02:00
Serhii Mozghovyi 1dc5e97ac2 Make test parametrization override indirect fixtures 2018-06-28 14:32:29 +03:00
Bruno Oliveira e9371a58a0
Merge pull request #3622 from RonnyPfannschmidt/builtin-serialize
move report classes to own file to prepare for serialisazion
2018-06-27 15:17:09 -03:00
Ronny Pfannschmidt e860ff7299 port some acceptance tests over to copy_example 2018-06-26 22:59:40 +02:00
Ronny Pfannschmidt cc6eb9f83c move test reports to own file 2018-06-26 22:09:15 +02:00
Ronny Pfannschmidt b8486037d3 fix #3605 - unpack markdecorators from parameterization 2018-06-26 21:57:31 +02:00
Ronny Pfannschmidt 78a82c05ef consistent failure on all python versions for test_markers_from_parametrize 2018-06-26 21:57:31 +02:00
Ronny Pfannschmidt 853975d93b add failing test for #3605 2018-06-26 21:57:31 +02:00
Ronny Pfannschmidt 89e0a3ec27 merge from master to features 2018-06-26 17:01:05 +02:00
Anthony Sottile f940967e23 Fix test offset after black moved code 2018-06-26 06:35:48 -07:00
Anthony Sottile cbaa7dd56a Upgrade pre-commit hooks except pyupgrade 2018-06-26 06:35:27 -07:00
Marcelo Duarte Trevisani 0030ceb11c Bug fix #3593 - approx method in a single element of numpy array
If the user pass as a expected value a numpy array created like
numpy.array(5); it will creates an array with one element without shape,
when used with approx it will raise an error
'TypeError: iteration over a 0-d array'
2018-06-25 22:55:16 +02:00
Ondřej Súkup deff54aae0
Try import mock, but on python 3.3+ can use also stdlib unittest.mock
From Python 3.3 is mock part of python standard library in unittest namespace
2018-06-23 23:27:07 +02:00
Ronny Pfannschmidt ee30bf45c9 rebase onto readme addition 2018-06-23 00:03:10 +02:00
Ronny Pfannschmidt c7eb53317b port cache plugin internals to pathlib
warning logging got broken by detanglement from config
2018-06-22 23:56:22 +02:00
avirlrma c672bfa32e added changelog entry
moved cache readme tests to test_cacheprovider.py
2018-06-21 17:43:10 +05:30
avirlrma 8f1d8ac970 fixed linting errors
ran black
removed unused imports and variables
2018-06-21 15:15:55 +05:30
avirlrma 53d4710c62 added tests for .pytest_cache README
Helper class to check if readme exists in .pytest_cache directory
 Tests to check for readme when tests pass and when they fail
2018-06-21 14:25:00 +05:30
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
Bruno Oliveira 9e32b6ae48
Small typo and grammar fix 2018-06-15 15:05:00 -03:00
Ronny Pfannschmidt 99402cf1c0 add a readme to the example scripts 2018-06-15 20:02:01 +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 5221a14764 Failing test case for #3583 2018-06-15 17:23:49 +00:00
Ronny Pfannschmidt 3ac2ae3c8c black 2018-06-15 18:13:45 +02:00
Ronny Pfannschmidt ea906056fa add the actually expected fixtureorder for #519 2018-06-15 18:04:24 +02:00
Ronny Pfannschmidt c081c5ee23 add example scripts for issue #519 2018-06-15 18:04:24 +02:00
Wil Cooley 3615977608 Add `messages` property to `caplog` fixture. 2018-06-14 12:22:33 -07:00
Ronny Pfannschmidt eb0c6a8287 fix addmarker - extract mark from markdecorator 2018-06-13 17:27:00 +02:00
Ronny Pfannschmidt 321f66f711 mark test_wrapped_getfuncargnames_patching as xfail 2018-06-12 22:25:05 +02:00
Ronny Pfannschmidt 37793d4cdb fix addmarker - extract mark from markdecorator 2018-06-12 15:50:58 +02: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 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
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