title: pytest argparse test case does not work
body: <p>I'm using Python 3.4.6.</p>
  
  <p>Here is the factory:</p>
  
  <pre><code>def create_parser():
      """ Create argument parser """
  
      # Input configuration parameters
      _parser = argparse.ArgumentParser(description='Segments Engine')
  
      # Application only parameters
      _parser.add_argument(
          '-V', '--version', version='%(prog)s ' + __version__,
          action='version')
      _pasrser.add_argument(
          '-d', '--debug', action='store_true')
  
      return _parser
  </code></pre>
  
  <p>The test case is as follows:</p>
  
  <pre><code>class TestCli(unittest.TestCase):
      """ Test the cli.py module """
  
      def __init__(self, *args, **kwargs):
          """ Initialize Unit Test """
          super(TestCli, self).__init__(*args, **kwargs)
  
      def setup(self):
          """ Setup before each test case """
          setup_config(app)
          setup_logging(app)
  
      def teardown(self):
          """ Tear down after each test case """
          pass
  
      def test_version(self):
          parser = create_parser()
          with pytest.raises(SystemExit):
              args = vars(parser.parse_args(['', '-V']))
  
          assert args.version == __version__
  
      def test_debug(self):
          parser = create_parser()
          args = parser.parse_args(['-d'])
  
          assert args.debug
  </code></pre>
  
  <p>Then I execute as follows:</p>
  
  <pre><code>pytest tests/test_cli.py
  </code></pre>
  
  <p>I get the following errors, what am I doing wrong?</p>
  
  <pre><code>======================================================================================= test session starts =========================================================================================
  platform darwin -- Python 3.4.6, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
  rootdir: /Users/francisco.benavides/Documents/src/segments-engine, inifile:
  collected 1 item s
  
  tests/test_cli.py F
  
  self = &lt;tests.test_cli.TestCli testMethod=test_version&gt;
  
      def test_version(self):
          parser = create_parser()
  &gt;       args = vars(parser.parse_args(['', '-V']))
  
  tests/test_cli.py:29:
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:1728: in parse_args
  args, argv = self.parse_known_args(args, namespace)
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:1760: in parse_known_args
  namespace, args = self._parse_known_args(args, namespace)
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:1966: in _parse_known_args
  start_index = consume_optional(start_index)
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:1906: in consume_optional
  take_action(action, args, option_string)
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:1834: in take_action
  action(self, namespace, argument_values, option_string)
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:1043: in __call__
  parser.exit()
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  
  self = ArgumentParser(prog='pytest', usage=None, description='Segments Engine', formatter_class=&lt;class 'argparse.HelpFormatter'&gt;, conflict_handler='error', add_help=True), status = 0, message = None
  
  def exit(self, status=0, message=None):
      if message:
          self._print_message(message, _sys.stderr)
  &gt;       _sys.exit(status)
  E       SystemExit: 0
  
  ../../../.pyenv/versions/3.4.6/lib/python3.4/argparse.py:2373: SystemExit
  ---------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------
  pytest 0.0.1
  </code></pre>
  
  <p>I have tried several ways I found googling, but so far nothing has helped me.</p>