Permalink
Browse files

restored previous slimit.minifier after deletion in test_cmd

  • Loading branch information...
1 parent c37b655 commit 5b01fc92ef4aa5a1bd7a356370d87c716fb3af8d @duilio duilio committed May 7, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/slimit/tests/test_cmd.py
@@ -88,8 +88,9 @@ def test_main_stdin_stdout(self):
# slimit.minifier should be deleted from sys.modules in order
# to have a proper reference to sys.stdin and sys.stdou when
# 'main' definition is evaluated during module import
+ old_module = None
try:
- del sys.modules['slimit.minifier']
+ old_module = sys.modules.pop('slimit.minifier')
except KeyError:
pass
@@ -99,6 +100,8 @@ def test_main_stdin_stdout(self):
main(['-m'])
self.assertEqual('function foo(){var a=5;}', out.getvalue())
+ if old_module:
+ sys.modules['slimit.minifier'] = old_module
def test_main_sys_argv(self):
out = StringIO.StringIO()
@@ -108,4 +111,3 @@ def test_main_sys_argv(self):
main(inp=inp, out=out)
self.assertEqual('var a=5;', out.getvalue())
-

0 comments on commit 5b01fc9

Please sign in to comment.