Test tearDown: remove all 'application.xxx' submodules from sys.modules

This ensures that the modules are reloaded for every test, for better
test separation.
This commit is contained in:
Sybren A. Stüvel 2016-07-07 14:59:22 +02:00
parent c871089eab
commit 2bdfbaea13

View File

@ -69,6 +69,10 @@ class AbstractPillarTest(TestMinimal):
# Not only delete self.app (like the superclass does),
# but also un-import the application.
del sys.modules['application']
remove = [modname for modname in sys.modules
if modname.startswith('application.')]
for modname in remove:
del sys.modules[modname]
def ensure_file_exists(self, file_overrides=None):
self.ensure_project_exists()