Commits

Can Xue committed fb89228

update test for options

Comments (0)

Files changed (1)

test/test_options.py

 # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license
 
 import os
+import sys
 from shlex import split
 from functools import partial
 from tempfile import NamedTemporaryFile
     eq_(options.get('gender'), 'unknown')
 
 
+def prepare_unaccptable():
+    class Nul(object):
+        def write(*args):
+            pass
+    global stderr
+    stderr = sys.stderr
+    sys.stderr = Nul()
+
+
+def cleanup_unaccptable():
+    sys.stderr = stderr
+
+
+@with_setup(prepare_unaccptable, cleanup_unaccptable)
 @raises(SystemExit)
 def test_cli_unacceptable_value():
     options.parse_options(split('--gender m'))
 def test_cli_override_conf():
     options.parse_options(split('-f "%s" --enabled yes' % temp_config_file.name))
     eq_(options.get('enabled'), True)
-