← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1542587] Re: keystone-manage commands should use sys.exit()

 

Reviewed:  https://review.openstack.org/274519
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=297a2c17374ffbca4f18f9fd39eb5863d57c92a0
Submitter: Jenkins
Branch:    master

commit 297a2c17374ffbca4f18f9fd39eb5863d57c92a0
Author: Qiaowei Ren <qiaowei.ren@xxxxxxxxx>
Date:   Mon Feb 1 14:36:10 2016 +0800

    Replace exit() with sys.exit()
    
    The exit() function is added by the site module so that it can be used
    in the interactive interpreter. It's use is not recommended in
    applications:
    https://docs.python.org/2/library/constants.html#constants-added-by-the-site-module
    
    Co-Authored-By: David Stanek <dstanek@xxxxxxxxxxx>
    Closes-Bug: #1542587
    Change-Id: Ic6a1fe7f3925b0efd34111713cc56857757b29cf


** Changed in: keystone
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1542587

Title:
  keystone-manage commands should use sys.exit()

Status in OpenStack Identity (keystone):
  Fix Released

Bug description:
  when change exit() to sys.exit() in
  keystone.cmd.cli.DomainConfigUpload.main(), the following unit tests
  failed:

  File "keystone/tests/unit/test_cli.py", line 357, in test_config_upload
  File "keystone/tests/unit/test_cli.py", line 297, in test_no_overwrite_config
  File "keystone/tests/unit/test_cli.py", line 323, in test_config_upload
  File "keystone/tests/unit/test_cli.py", line 340, in test_config_upload

  the log is as follow:

  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):
        File "keystone/tests/unit/test_cli.py", line 357, in test_config_upload
          self.assertRaises(SystemExit, cli.DomainConfigUpload.main)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 434, in assertRaises
          self.assertThat(our_callable, matcher)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 445, in assertThat
          mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 495, in _matchHelper
          mismatch = matcher.match(matchee)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 108, in match
          mismatch = self.exception_matcher.match(exc_info)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 62, in match
          mismatch = matcher.match(matchee)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 426, in match
          reraise(*matchee)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 101, in match
          result = matchee()
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 982, in __call__
          return self._callable_object(*self._args, **self._kwargs)
        File "keystone/cmd/cli.py", line 696, in main
          sys.exit(status)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1062, in __call__
          return _mock_self._mock_call(*args, **kwargs)
        File "/opt/stack/keystone/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1118, in _mock_call
          raise effect
      keystone.tests.unit.core.UnexpectedExit

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1542587/+subscriptions


References