nosetest options cause no such option errors

Bug #1056420 reported by Mark Washenberger on 2012-09-25
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Low
Mark Washenberger
Folsom
Low
Joshua Harlow
Grizzly
Low
Mark Washenberger
glance (Ubuntu)
Undecided
Unassigned
Quantal
Undecided
Unassigned

Bug Description

When trying to use nose options, there are a few place in the test code where openstack common config is failing because its trying to parse sys.argv. For example:

$ eatmydata ./run_tests.sh glance/tests/unit/v2/test_images_resource.py -x

TestImagesController
    test_create Usage: nosetests [options]

nosetests: error: no such option: -x
ERROR 0.00

======================================================================
ERROR: test_create (glance.tests.unit.v2.test_images_resource.TestImagesController)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/markwash/devel/glance/glance/tests/unit/v2/test_images_resource.py", line 77, in setUp
    super(TestImagesController, self).setUp()
  File "/home/markwash/devel/glance/glance/tests/utils.py", line 60, in setUp
    config.parse_args()
  File "/home/markwash/devel/glance/glance/common/config.py", line 73, in parse_args
    default_config_files=default_config_files)
  File "/home/markwash/devel/glance/glance/openstack/common/cfg.py", line 1024, in __call__
    self._cli_values, leftovers = self._parse_cli_opts(args)
  File "/home/markwash/devel/glance/glance/openstack/common/cfg.py", line 1529, in _parse_cli_opts
    values, leftovers = self._oparser.parse_args(args)
  File "/usr/lib/python2.7/optparse.py", line 1401, in parse_args
    self.error(str(err))
  File "/usr/lib/python2.7/optparse.py", line 1583, in error
    self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))
  File "/usr/lib/python2.7/optparse.py", line 1573, in exit
    sys.exit(status)
SystemExit: 2

Fix proposed to branch: master
Review: https://review.openstack.org/13662

Changed in glance:
assignee: nobody → Mark Washenberger (markwash)
status: New → In Progress

Reviewed: https://review.openstack.org/13662
Committed: http://github.com/openstack/glance/commit/ef641597dbfc0fcb856c143b213be493ab44cc65
Submitter: Jenkins
Branch: master

commit ef641597dbfc0fcb856c143b213be493ab44cc65
Author: Mark Washenberger <email address hidden>
Date: Tue Sep 25 19:57:10 2012 +0000

    Pass empty args to test config parser.

    This fixes bug 1056420, which allows users to pass nosetests options
    through run_tests.sh again.

    Change-Id: I03e84488a24e2552b61aa0cab842d8325e8e856f

Changed in glance:
status: In Progress → Fix Committed

Fix proposed to branch: master
Review: https://review.openstack.org/14295

Changed in glance:
status: Fix Committed → In Progress
Joshua Harlow (harlowja) wrote :

Can we also backport this to folsom?

Joshua Harlow (harlowja) wrote :

This is also broken for things like ' --exclude-dir=glance/tests/functional', and really any other nose options that will cause the openstack/glance config to not recgonize...

Joshua Harlow (harlowja) wrote :

This seems like its also broken in tests/utils.py

#NOTE(bcwaldon): parse_args has to be called to register certain
# command-line options - specifically we need config_dir for
# the following policy tests
config.parse_args()

Fixing there might be the most general solution?

Brian Waldon (bcwaldon) on 2012-10-13
Changed in glance:
importance: Undecided → Low
milestone: none → grizzly-1

Reviewed: https://review.openstack.org/14295
Committed: http://github.com/openstack/glance/commit/6c6863bea9e8014e5f5036be106a2a08c6f7d553
Submitter: Jenkins
Branch: master

commit 6c6863bea9e8014e5f5036be106a2a08c6f7d553
Author: Mark Washenberger <email address hidden>
Date: Wed Oct 10 16:31:01 2012 +0000

    Don't parse commandline in filesystem tests

    This fixes another instance of bug 1056420.

    Change-Id: I50d80aa6fcbb50044c623f680a13356d8eeac475

Changed in glance:
status: In Progress → Fix Committed
Mark McLoughlin (markmc) on 2012-10-13
tags: added: folsom-backport-potential

Reviewed: https://review.openstack.org/14440
Committed: http://github.com/openstack/glance/commit/1d5c651321a87e218995821b0d148867db977988
Submitter: Jenkins
Branch: stable/folsom

commit 1d5c651321a87e218995821b0d148867db977988
Author: Mark Washenberger <email address hidden>
Date: Tue Sep 25 19:57:10 2012 +0000

    Pass empty args to test config parser.

    This fixes bug 1056420, which allows users to pass nosetests options
    through run_tests.sh again.

    Change-Id: I03e84488a24e2552b61aa0cab842d8325e8e856f
    (cherry picked from commit ef641597dbfc0fcb856c143b213be493ab44cc65)

tags: added: in-stable-folsom
Thierry Carrez (ttx) on 2012-11-21
Changed in glance:
status: Fix Committed → Fix Released
Changed in glance (Ubuntu):
status: New → Fix Released
Changed in glance (Ubuntu Quantal):
status: New → Confirmed

Hello Mark, or anyone else affected,

Accepted glance into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/glance/2012.2.1-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in glance (Ubuntu Quantal):
status: Confirmed → Fix Committed
tags: added: verification-needed
Mark McLoughlin (markmc) on 2013-01-22
tags: removed: folsom-backport-potential in-stable-folsom
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glance - 2012.2.1-0ubuntu1

---------------
glance (2012.2.1-0ubuntu1) quantal-proposed; urgency=low

  * Dropped patches, applied upstream:
    - debian/patches/CVE-2012-4573.patch
    - debian/patches/CVE-2012-4573b.patch
  * Resynchronize with stable/folsom (199783ce) (LP: #1085255):
    - [49408e9] Glance image-delete HTTPInternalServerError HTTP 500
      (LP: #1075580)
    - [91aaa48] Image fails to upload to swift: TypeError: object of type
      'CooperativeReader' has no len( (LP: #1057322)
    - [a296a5b] Return 403 when admin deletes a deleted image (LP: #1060944)
    - [3e58a6a] Disallow updating deleted images. (LP: #1060930)
    - [26c8085] admins can see deleted images in v2 api (LP: #1071446)
    - [8321ca6] No exclude option to skip tests in run_tests.sh (LP: #1065758)
    - [c3bea11] Badly named stable/folsom Glance tarballs (LP: #1059634)
    - [fc0ee76] Non-admin users can cause public glance images to be deleted
      from the backend storage repository in the v2 api (LP: #1076506)
    - [90bcdc5] Non-admin users can cause public glance images to be deleted
      from the backend storage repository (LP: #1065187)
    - [7841cc9] FakeAuth not always admin
    - [ddad275] Jenkins jobs fail because of incompatibility between sqlalchemy-
      migrate and the newest sqlalchemy-0.8.0b1 (LP: #1073569)
    - [1d5c651] nosetest options cause no such option errors (LP: #1056420)
    - [ac223e2] Set defaultbranch in .gitreview to stable/folsom
 -- Adam Gandelman <email address hidden> Tue, 04 Dec 2012 09:19:35 -0800

Changed in glance (Ubuntu Quantal):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers