Skip to content

Commit

Permalink
Merge pull request #2914 from nicoddemus/addfinalizer-refactor
Browse files Browse the repository at this point in the history
Make SubRequest.addfinalizer an explicit method
  • Loading branch information
RonnyPfannschmidt authored Nov 11, 2017
2 parents 742f9cb + f320686 commit b671c5a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion _pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ def __init__(self, request, scope, param, param_index, fixturedef):
self.param_index = param_index
self.scope = scope
self._fixturedef = fixturedef
self.addfinalizer = fixturedef.addfinalizer
self._pyfuncitem = request._pyfuncitem
self._fixture_values = request._fixture_values
self._fixture_defs = request._fixture_defs
Expand All @@ -586,6 +585,9 @@ def __init__(self, request, scope, param, param_index, fixturedef):
def __repr__(self):
return "<SubRequest %r for %r>" % (self.fixturename, self._pyfuncitem)

def addfinalizer(self, finalizer):
self._fixturedef.addfinalizer(finalizer)


class ScopeMismatchError(Exception):
""" A fixture function tries to use a different fixture function which
Expand Down

0 comments on commit b671c5a

Please sign in to comment.