Test test_utils_drop_unique_constraint() fails if we run it separately

Bug #1217306 reported by Viktor Serhieiev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Undecided
Viktor Serhieiev

Bug Description

looks like that we haven't patched sqlalchemy migrate in this test. See traceback

vsergeyev@vsergeyev-pc:~/sandbox/oslo-incubator$ tox -e py27 -- test_utils_drop_unique_constraint

======================================================================
FAIL: unit.db.sqlalchemy.test_utils.TestMigrationUtils.test_utils_drop_unique_constraint
tags: worker-0
----------------------------------------------------------------------
Empty attachments:
  pythonlogging:'openstack.common'
  stderr
  stdout

Traceback (most recent call last):
  File "/home/vsergeev/sandbox/oslo-incubator/tests/unit/db/sqlalchemy/test_utils.py", line 440, in test_utils_drop_unique_constraint
    utils.drop_unique_constraint(engine, table_name, uc_name, 'foo')
  File "/home/vsergeev/sandbox/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/openstack/common/db/sqlalchemy/utils.py", line 243, in drop_unique_constraint
    uc.drop()
  File "/home/vsergeev/sandbox/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/migrate/changeset/constraint.py", line 59, in drop
    self.__do_imports('constraintdropper', *a, **kw)
  File "/home/vsergeev/sandbox/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/migrate/changeset/constraint.py", line 32, in __do_imports
    run_single_visitor(engine, visitorcallable, self, *a, **kw)
  File "/home/vsergeev/sandbox/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/migrate/changeset/databases/visitor.py", line 75, in run_single_visitor
    fn(element, **kwargs)
  File "/home/vsergeev/sandbox/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/migrate/changeset/databases/sqlite.py", line 143, in visit_migrate_unique_constraint
    self._not_supported('ALTER TABLE DROP CONSTRAINT')
  File "/home/vsergeev/sandbox/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/migrate/changeset/databases/sqlite.py", line 22, in _not_supported
    "%s; see http://www.sqlite.org/lang_altertable.html" % op)
NotSupportedError: SQLite does not support ALTER TABLE DROP CONSTRAINT; see http://www.sqlite.org/lang_altertable.html

Tags: db
Changed in oslo:
assignee: nobody → Victor Sergeyev (vsergeyev)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/43864
Committed: http://github.com/openstack/oslo-incubator/commit/1eb6b4486f1dc1c8990ec464bff49fb950752adc
Submitter: Jenkins
Branch: master

commit 1eb6b4486f1dc1c8990ec464bff49fb950752adc
Author: Victor Sergeyev <email address hidden>
Date: Tue Aug 27 12:48:52 2013 +0300

    Use monkey_patch() in TestMigrationUtils setUp()

    We use monkey patched sqlalchemy-migrate in
    openstack.common.db.sqlalchemy.utils module. It allows us drop
    unique constrains is SQLite.
    If we run all tests, we also use `patched` migrate in
    TestMigrationUtils(), but it patches in
    `tests/unit/db/sqlalchemy/test_migrate.py` file. So tests from
    TestMigrationUtils() class fails if we run them separately.

    Added sqlalchemy-migrate monkey patch in setUp() method
    TestMigrationUtils test class due to use `patched` migrate
    in tests.

    Fixes bug 1217306

    Change-Id: I037ad36c1db3f88501f2b0f6ae9f2c946de1afa6

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.