Commit Graph

89 Commits

Author SHA1 Message Date
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
Dmitry Malinovsky a63b34c685 Switch to item fspath 2016-12-20 10:44:09 +06:00
Dmitry Malinovsky 522d59e844 Use session.config.hook instead of ihook. Fixes #2124 2016-12-10 16:45:40 +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
Daniel Hahler 3cfebdd7c5 funcarg_prefix_warning: remove newline
Followup to https://github.com/pytest-dev/pytest/pull/1718.
2016-07-13 18:33:24 +02:00
Daniel Hahler 15e97a7c78 Add punctuation to funcarg_prefix_warning 2016-07-12 23:49:09 +02:00
Bruno Oliveira 458ecae1df Replace all usages of "pytest_funcarg__" for @pytest.fixture 2016-07-11 22:21:52 -03:00
Bruno Oliveira ad4125dc0d Deprecate "pytest_funcarg__" prefix to declare fixtures
Fixes #1684
2016-07-11 22:21:50 -03:00
Bruno Oliveira 0ca06962e9 Improve docs 2016-07-11 20:33:16 -03:00
Bruno Oliveira fb4da00a32 Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures 2016-07-11 20:09:13 -03:00
Ronny Pfannschmidt 8c49561470 split most fixture related code into own plugin 2016-07-09 20:36:00 +02:00