Extract method for _mark_plugins_for_rewrite

This commit is contained in:
Jason R. Coombs 2017-05-20 04:18:41 -04:00
parent 637550b249
commit 6d2e11b7d1
1 changed files with 4 additions and 1 deletions

View File

@ -995,6 +995,10 @@ class Config(object):
except SystemError: except SystemError:
mode = 'plain' mode = 'plain'
else: else:
self._mark_plugins_for_rewrite(hook)
self._warn_about_missing_assertion(mode)
def _mark_plugins_for_rewrite(self, hook):
import pkg_resources import pkg_resources
self.pluginmanager.rewrite_hook = hook self.pluginmanager.rewrite_hook = hook
for entrypoint in pkg_resources.iter_entry_points('pytest11'): for entrypoint in pkg_resources.iter_entry_points('pytest11'):
@ -1013,7 +1017,6 @@ class Config(object):
elif is_package: elif is_package:
package_name = os.path.dirname(fn) package_name = os.path.dirname(fn)
hook.mark_rewrite(package_name) hook.mark_rewrite(package_name)
self._warn_about_missing_assertion(mode)
def _warn_about_missing_assertion(self, mode): def _warn_about_missing_assertion(self, mode):
try: try: