Merge .set_config() into constructor
This commit is contained in:
parent
e0cb046885
commit
9118c0222f
|
@ -76,8 +76,7 @@ def pytest_load_initial_conftests(early_config, parser, args):
|
|||
|
||||
hook = None
|
||||
if mode == "rewrite":
|
||||
hook = rewrite.AssertionRewritingHook() # noqa
|
||||
hook.set_config(early_config)
|
||||
hook = rewrite.AssertionRewritingHook(early_config) # noqa
|
||||
sys.meta_path.insert(0, hook)
|
||||
|
||||
early_config._assertstate.hook = hook
|
||||
|
|
|
@ -44,7 +44,9 @@ else:
|
|||
class AssertionRewritingHook(object):
|
||||
"""PEP302 Import hook which rewrites asserts."""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.fnpats = config.getini("python_files")
|
||||
self.session = None
|
||||
self.modules = {}
|
||||
self._register_with_pkg_resources()
|
||||
|
@ -52,10 +54,6 @@ class AssertionRewritingHook(object):
|
|||
def set_session(self, session):
|
||||
self.session = session
|
||||
|
||||
def set_config(self, config):
|
||||
self.config = config
|
||||
self.fnpats = config.getini("python_files")
|
||||
|
||||
def find_module(self, name, path=None):
|
||||
state = self.config._assertstate
|
||||
state.trace("find_module called for: %s" % name)
|
||||
|
|
Loading…
Reference in New Issue