Commit Graph

57 Commits

Author SHA1 Message Date
Andreas Pelme 39331856ed Use the correct stacklevel for getfuncargvalue() deprecation warning.
Fixed #2681.
2017-08-13 14:59:33 +02:00
Bruno Oliveira e1aed8cb17 Merge pull request #2490 from RonnyPfannschmidt/fix-580
Test Outcomes as BaseException - fix #580
2017-07-30 17:38:42 -03:00
Ronny Pfannschmidt 06a49338b2 make Test Outcomes inherit from BaseException instead of exception
fixes #580
2017-07-28 15:28:51 +02:00
Lawrence Mitchell a546a612bd Fix nondeterminism in fixture collection order
fixtures.reorder_items is non-deterministic because it reorders based
on iteration over an (unordered) set.  Change the code to use an
OrderedDict instead so that we get deterministic behaviour, fixes #920.
2017-07-26 14:41:10 +01:00
Andras Tim 15610289ac Fixed E712 flake8 errors
comparison to True should be ‘if cond is True:’ or ‘if cond:’
2017-07-17 01:44:23 +02:00
Andras Tim 7248b759e8 Fixed E303 flake8 errors
too many blank lines (3)
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 17a21d540b Fixed E301 flake8 errors
expected 1 blank line, found 0
2017-07-17 01:44:23 +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 2e8caefcab Fixed E225 flake8 errors
missing whitespace around operator
2017-07-17 01:44:22 +02:00
Andras Tim 3fabc4d219 Fixed E222 flake8 errors
multiple spaces after operator
2017-07-17 01:44:22 +02:00
Andras Tim f640e0cb04 Fixed E221 flake8 errors
multiple spaces before operator
2017-07-17 01:44:22 +02:00
Andras Tim cf97159009 Fixed E128 flake8 errors
continuation line under-indented for visual indent
2017-07-17 01:28:16 +02:00
Andras Tim e855a79dd4 Fixed E126 flake8 errors
continuation line over-indented for hanging indent
2017-07-17 01:28:16 +02:00
Andras Tim 92e2cd9c68 Fixed E125 flake8 errors
continuation line with same indent as next logical line
2017-07-17 01:28:16 +02:00
Andras Tim 0be97624b7 Fixed E121 flake8 errors
continuation line under-indented for hanging indent
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 4e4ebbef5a Improve test to ensure the expected function is re-raised 2017-06-13 20:16:48 -03:00
Ryan Fitzpatrick 5a856b6e29 handle and reraise subrequest finalizer exceptions 2017-06-12 21:26:42 -04:00
Bruno Oliveira d86c89e193 Revert refactor of old-style to new-style classes
As discussed in the mailing list, unfortunately this might break APIs
due to the subtle differences between new and old-style classes (see #2398).

This reverts commit d4afa1554b from PR #2179.
2017-05-17 18:20:51 -03:00
Bruno Oliveira f3b359f5b8 Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
#	_pytest/capture.py
#	_pytest/compat.py
#	_pytest/python.py
#	testing/python/collect.py
#	testing/test_mark.py
2017-05-03 19:04:53 -03:00
Ben Lloyd 21f1c2b03f Update fixtures.py
Corrected "or or" typo in docstring (and made indentation consistent).
2017-04-07 16:48:38 +01:00
Ronny Pfannschmidt c9ab421398 fix python2 only import loop failure 2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt 7cdefce656 fix up oversights 2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt 92f6ab1881 fix all singular internal module imports and add a test for them 2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt 23bc9815c4 remove pytest_namespace from _pytest.fixtures 2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt 61f418a267 hollow out pytest_namespace in _pytest.fixtures 2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt c74103f395 remove pytest_namespace from recwarn and fixture decorators 2017-03-28 11:45:06 +02:00
Bruno Oliveira 9f85584656 Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings 2017-03-20 19:59:05 -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
Bruno Oliveira 78194093af Improve warning representation in terminal plugin and fix tests 2017-03-16 21:57:32 -03:00
Bruno Oliveira 1e0cf5ce4d Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
#	AUTHORS
#	CHANGELOG.rst
#	_pytest/pytester.py
2017-03-10 15:54:05 -03:00
Ran Benita 3a0a0c2df9 Ignore errors raised from descriptors when collecting fixtures
Descriptors (e.g. properties) such as in the added test case are
triggered during collection, executing arbitrary code which can raise.
Previously, such exceptions were propagated and failed the collection.
Now these exceptions are caught and the corresponding attributes are
silently ignored.

A better solution would be to completely skip access to all custom
descriptors, such that the offending code doesn't even trigger. However
I think this requires manually going through the instance and all of its
MRO for each and every attribute checking if it might be a proper
fixture before accessing it. So I took the easy route here.

In other words, putting something like this in your test class is still
a bad idea...:

    @property
    def innocent(self):
        os.system('rm -rf /')

Fixes #2234.
2017-02-07 14:27:34 +02:00
Ran Benita 87fb689ab1 Remove an unneeded `except KeyboardInterrupt`
KeyboardInterrupt is a subclass of BaseException, but not of Exception.
Hence if we remove this except, KeyboardInterrupts will still be raised
so the behavior stays the same.
2017-02-07 14:12:09 +02:00
mandeep d4afa1554b Refactored old style classes to new style classes 2017-01-08 22:52:42 -06: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
Tyler Goodlet 6db2f315fa Explain a bad scope value to the user 2016-09-21 16:40:58 -04:00
Bruno Oliveira 463e6572c5 Merge branch 'master' into merge-master-into-features
Preparing for 3.0
2016-08-17 22:39:23 -03:00
Bruno Oliveira 707b6b5e3f Revert all invocation-fixtures code
Due to a serious regression found in #1794, it was decided to pull off
invocation features from 3.0 so it can be (hopefully) re-introduced
in 3.1
2016-08-17 08:12:55 -03:00
Bruno Oliveira 277b6d3974 Sort fixture names when a fixture lookup error occurs 2016-08-02 19:45:31 -03:00
Bruno Oliveira 553dc2600f Strip invocation-scope suffix when displaying fixture lookup error 2016-08-01 20:34:56 -03:00
Bruno Oliveira aa145fa83e Add 'invocation' scope option to fixture docstring 2016-07-29 12:47:30 -03:00
Bruno Oliveira 76fbc6379f Fix deprecated directive in docstring 2016-07-29 12:39:48 -03:00
Floris Bruynooghe 510a6083ba Merge pull request #1758 from nicoddemus/deprecated-module
Add deprecation module to centralize deprecation messages and bits of…
2016-07-28 22:36:55 +01: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
Bruno Oliveira 6c8b0a28e1 Add deprecation module to centralize deprecation messages and bits of code 2016-07-25 18:14:39 -03:00
Bruno Oliveira 4f2bf965cb Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures 2016-07-20 21:16:27 -03:00
Bruno Oliveira 20f97c3041 Small documentation improvements 2016-07-20 20:22:28 -03:00