forked from orbit-oss/flask
Do not break extension tests if tested with installed extensions.
This commit is contained in:
parent
d4d75701bc
commit
56afafae67
3 changed files with 14 additions and 9 deletions
|
|
@ -18,10 +18,15 @@ from flask.testsuite import FlaskTestCase
|
|||
class ExtImportHookTestCase(FlaskTestCase):
|
||||
|
||||
def setup(self):
|
||||
# we clear this out for various reasons. The most important one is
|
||||
# that a real flaskext could be in there which would disable our
|
||||
# fake package. Secondly we want to make sure that the flaskext
|
||||
# import hook does not break on reloading.
|
||||
for entry, value in sys.modules.items():
|
||||
if (entry.startswith('flask.ext.') or
|
||||
entry.startswith('flask_') or
|
||||
entry.startswith('flaskext.')) and value is not None:
|
||||
entry.startswith('flaskext.') or
|
||||
entry == 'flaskext') and value is not None:
|
||||
sys.modules.pop(entry, None)
|
||||
from flask import ext
|
||||
reload(ext)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue