Merge branch 'pytest-2.7'
Conflicts: _pytest/config.py _pytest/genscript.py _pytest/mark.py tox.ini
This commit is contained in:
@@ -983,9 +983,10 @@ def showfixtures(config):
|
||||
return wrap_session(config, _showfixtures_main)
|
||||
|
||||
def _showfixtures_main(config, session):
|
||||
import _pytest.config
|
||||
session.perform_collect()
|
||||
curdir = py.path.local()
|
||||
tw = py.io.TerminalWriter()
|
||||
tw = _pytest.config.create_terminal_writer(config)
|
||||
verbose = config.getvalue("verbose")
|
||||
|
||||
fm = session._fixturemanager
|
||||
@@ -1924,10 +1925,13 @@ class FixtureDef:
|
||||
self.finish()
|
||||
assert not hasattr(self, "cached_result")
|
||||
|
||||
fixturefunc = self.func
|
||||
|
||||
if self.unittest:
|
||||
result = self.func(request.instance, **kwargs)
|
||||
if request.instance is not None:
|
||||
# bind the unbound method to the TestCase instance
|
||||
fixturefunc = self.func.__get__(request.instance)
|
||||
else:
|
||||
fixturefunc = self.func
|
||||
# the fixture function needs to be bound to the actual
|
||||
# request.instance so that code working with "self" behaves
|
||||
# as expected.
|
||||
@@ -1935,12 +1939,13 @@ class FixtureDef:
|
||||
fixturefunc = getimfunc(self.func)
|
||||
if fixturefunc != self.func:
|
||||
fixturefunc = fixturefunc.__get__(request.instance)
|
||||
try:
|
||||
result = call_fixture_func(fixturefunc, request, kwargs,
|
||||
self.yieldctx)
|
||||
except Exception:
|
||||
self.cached_result = (None, my_cache_key, sys.exc_info())
|
||||
raise
|
||||
|
||||
try:
|
||||
result = call_fixture_func(fixturefunc, request, kwargs,
|
||||
self.yieldctx)
|
||||
except Exception:
|
||||
self.cached_result = (None, my_cache_key, sys.exc_info())
|
||||
raise
|
||||
self.cached_result = (result, my_cache_key, None)
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user