Commit Graph

75 Commits

Author SHA1 Message Date
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
Ronny Pfannschmidt 703e4b11ba run black 2018-05-23 16:48:46 +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 aff463a3c4 Merge remote-tracking branch 'upstream/master' into features 2018-01-27 12:28:43 -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
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 983a09a2d4 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-11-10 18:33:02 -02:00
Bruno Oliveira 03829fde8a Fix linting E741: ambiguous variable name 2017-11-04 13:59:10 -02: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
Ronny Pfannschmidt be401bc2f8 fix linting issues 2017-07-28 18:27:59 +02:00
Ronny Pfannschmidt 06a49338b2 make Test Outcomes inherit from BaseException instead of exception
fixes #580
2017-07-28 15:28:51 +02:00
Bruno Oliveira 26ee2355d9 Merge remote-tracking branch 'upstream/features' into fix-flake8-errors 2017-07-19 17:09:05 -03:00
Bruno Oliveira 2d4f1f022e Introduce PYTEST_CURRENT_TEST environment variable
Fix #2583
2017-07-19 10:01:50 -03:00
Bruno Oliveira 7b1870a94e Fix flake8 in features branch 2017-07-17 21:16:14 -03:00
Andras Tim 5ae59279f4 Fixed E704 flake8 errors
multiple statements on one line (def)
2017-07-17 01:44:23 +02:00
Andras Tim b840622819 Fixed E302 flake8 errors
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Andras Tim 195a816522 Fixed E265 flake8 errors
block comment should start with ‘# ‘
2017-07-17 01:44:22 +02:00
Andras Tim 8f3eb6dfc7 Fixed E261 flake8 errors
at least two spaces before inline comment
2017-07-17 01:44:22 +02:00
Andras Tim 617e510b6e Fixed E231 flake8 errors
missing whitespace after ‘,’, ‘;’, or ‘:’
2017-07-17 01:44:22 +02:00
Andras Tim 4b22f270a3 Fixed E226 flake8 errors
missing whitespace around arithmetic operator
2017-07-17 01:44:22 +02:00
Andras Tim 4b20b9d8d9 Fixed E123 flake8 errors
closing bracket does not match indentation of opening bracket’s line
2017-07-17 01:28:16 +02:00
Andras Tim 6af2abdb53 Fixed flake8 warnings
W191 indentation contains tabs
W292 no newline at end of file
W293 blank line contains whitespace
W391 blank line at end of file
2017-07-17 01:28:16 +02:00
Bruno Oliveira 46d157fe07 Fix collection report when collecting a single test item 2017-06-03 20:39:53 -03:00
Bruno Oliveira 42a5d6bdfa Add __future__ imports to all pytest modules
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Michal Wajszczuk fb0b90646e New-style classes implemented for python 2.7 - #2147 2017-02-16 20:28:17 +01:00
Bruno Oliveira 1eb5a690d4 Fix flake8 E305 and E306 errors
These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
2016-11-20 18:59:15 -02:00
Bruno Oliveira 63dc71c57e Fix regression when using importorskip at module level
Fix #1822
2016-08-19 18:21:25 -03:00
Bruno Oliveira ff296fd541 Add capstdout and capstderr attrs to TestReport
Related to #1790
2016-08-03 21:49:43 -03:00
Bruno Oliveira 08002ab75a Add longreprtext property to TestReport objects
Related to #1790
2016-08-03 21:49:28 -03:00
Bruno Oliveira c2864aba3d Merge branch 'master' into merge-master
# Conflicts:
#	AUTHORS
#	CHANGELOG.rst
#	_pytest/monkeypatch.py
#	_pytest/python.py
2016-07-25 19:06:29 -03:00
Tom Viner 42adaf5a61 Fix #1210 display msg for early calls to exit 2016-07-24 14:16:34 +02:00
Bruno Oliveira ff8fb4950e setup_* and teardown_* functions argument now optional
setup_module, setup_function and setup_method
extra argument are now optional and may be omitted.

Fix #1728
2016-07-14 23:41:40 -03:00
Bruno Oliveira 458ecae1df Replace all usages of "pytest_funcarg__" for @pytest.fixture 2016-07-11 22:21:52 -03:00
Omar Kohl d81f23009b Raise CollectError if pytest.skip() is called during collection
pytest.skip() must not be used at module level because it can easily be
misunderstood and used as a decorator instead of pytest.mark.skip, causing the
whole module to be skipped instead of just the test being decorated.

This is unexpected for users used to the @unittest.skip decorator and therefore
it is best to bail out with a clean error when it happens.

The pytest equivalent of @unittest.skip is @pytest.mark.skip .

Adapt existing tests that were actually relying on this behaviour and add a
test that explicitly test that collection fails.

fix #607
2016-06-24 20:56:21 +02:00
Guyzmo accd962c9f Fixed issue shadowing error when missing argument on teardown_method
When the method argument is missing on teardown_method, the traceback is
100% internal to pytest, which with default options get pruned. Then
that traceback is empty, leading to a new exception as a traceback shall
not be empty.

This PR fixes that issue by pushing back the last stack on the
traceback, when the stacktrace is empty after pruning. Then the output
is still pruned, but gives meaningful information with the item where it
failed on the stack.

* fixes issue #1604

Signed-off-by: Guyzmo <guyzmo+github@m0g.net>
2016-06-12 03:45:24 +02:00
Bruno Oliveira 5d4703852e Add test when using native strings with non-ascii chars 2016-03-05 19:34:15 -03:00
Bruno Oliveira 24d3e01548 pytest.fail with non-ascii characters raises an internal pytest error
Fix #1178
2016-03-05 16:09:01 -03:00
Ryan Wooden d98d655094 Simplify IndexError test. 2016-02-26 08:25:49 -04:00
Anatoly Bubenkov cf9a09e988 catch IndexError exceptions when getting exception source location 2016-02-26 08:18:12 -04:00
Bruno Oliveira a912d3745b Moved py.code code over to py.test
Fix #103
2016-01-25 23:18:04 -02:00
Michael Droettboom a0cefb3213 Use inspect.signature instead of inspect.getargspec 2015-09-16 06:33:53 -04:00
Bruno Oliveira d7d418cd47 Fix forked_run_report in pytest.xdist 1.13 2015-08-20 21:17:27 -04:00
Bruno Oliveira 2ffd37b816 return non-zero exit code if no tests are collected
Fix #812
Fix #500
2015-08-18 07:35:02 -03:00
Eric Hunsberger 3cd19a7e45 Use monkeypatch for setting modules in tests
Instead of directly setting `sys.modules`. This ensures that they
get removed at the end of the test.
2015-07-24 12:34:06 -04:00
Eric Hunsberger d104487282 importorskip: Allow non-integer version strings
Use `pkg_resources.parse_version` to parse version strings.
This can handle 'dev', 'rc', alpha and beta version strings,
among others.
2015-07-24 12:34:06 -04:00
Almar Klein a9b7de8bf0 address reviewer comments 2015-03-21 17:26:23 +01:00
Almar Klein 0fc75c9622 Storing sys.last_traceback: test, docs and changelog 2015-03-21 17:06:24 +01:00
Floris Bruynooghe 39a297afe6 Improve test by also matching expected output 2014-08-30 21:57:01 +01:00
Floris Bruynooghe 98dcd764bc Depend on newer version of py
This fixes issue560, a test for which is included here as well.
2014-08-14 23:23:04 +01:00