Better logging when bad extension class is given.

This was necessary to debug an issue with different unit tests influencing
each other in Attract.
This commit is contained in:
2016-09-20 15:12:06 +02:00
parent 7598ad0b57
commit 40896fc70b
2 changed files with 18 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
# -*- encoding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import base64
@@ -94,9 +96,15 @@ class AbstractPillarTest(TestMinimal):
# Not only delete self.app (like the superclass does),
# but also un-import the application.
del sys.modules['pillar']
remove = [modname for modname in sys.modules
if modname.startswith('pillar.')]
self.unload_modules('pillar')
def unload_modules(self, module_name):
"""Uploads the named module, and all submodules."""
del sys.modules[module_name]
remove = {modname for modname in sys.modules
if modname.startswith('%s.' % module_name)}
for modname in remove:
del sys.modules[modname]