Skip to content

Commit

Permalink
restore sys.modules
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Sep 29, 2020
1 parent 7d6cd18 commit a60c3db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_main.py
Expand Up @@ -11,6 +11,7 @@ def test_cli_calling():
def test_do_not_import_linter():
"""When deal is imported, it must not trigger importing linter.
"""
old_modules = sys.modules.copy()
for name in list(sys.modules):
if name == 'deal' or name.startswith('deal.'):
del sys.modules[name]
Expand All @@ -24,3 +25,5 @@ def test_do_not_import_linter():
raise ImportError('oh no, linter was imported')
if name == 'astroid' or name.startswith('astroid.'):
raise ImportError('oh no, astroid was imported')

sys.modules = old_modules

0 comments on commit a60c3db

Please sign in to comment.