Skip to content

Commit

Permalink
Replace utils method with oslo.utils reflection provided one
Browse files Browse the repository at this point in the history
Change-Id: Ife14a6acd01a16c4b1092b43fb94942db0e03036
  • Loading branch information
harlowja committed Jun 7, 2015
1 parent 42de3f6 commit e0f0608
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
5 changes: 3 additions & 2 deletions oslo_db/sqlalchemy/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@


import os

from oslo_utils import reflection
import six

from oslo_db import exception
from oslo_db.sqlalchemy import provision
from oslo_db.sqlalchemy import session
from oslo_db.sqlalchemy import utils


class DbFixture(fixtures.Fixture):
Expand Down Expand Up @@ -192,7 +193,7 @@ def ins_wrap(self):
if self.engine.name not in dialects:
msg = ('The test "%s" can be run '
'only on %s. Current engine is %s.')
args = (utils.get_callable_name(f), ' '.join(dialects),
args = (reflection.get_callable_name(f), ' '.join(dialects),
self.engine.name)
self.skip(msg % args)
else:
Expand Down
25 changes: 0 additions & 25 deletions oslo_db/sqlalchemy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,6 @@
_DBURL_REGEX = re.compile(r"[^:]+://([^:]+):([^@]+)@.+")


def get_callable_name(function):
# TODO(harlowja): Replace this once
# it is possible to use https://review.openstack.org/#/c/122495/ which is
# a more complete and expansive module that does a similar thing...
try:
method_self = six.get_method_self(function)
except AttributeError:
method_self = None
if method_self is not None:
if isinstance(method_self, six.class_types):
im_class = method_self
else:
im_class = type(method_self)
try:
parts = (im_class.__module__, function.__qualname__)
except AttributeError:
parts = (im_class.__module__, im_class.__name__, function.__name__)
else:
try:
parts = (function.__module__, function.__qualname__)
except AttributeError:
parts = (function.__module__, function.__name__)
return '.'.join(parts)


def sanitize_db_url(url):
match = _DBURL_REGEX.match(url)
if match:
Expand Down

0 comments on commit e0f0608

Please sign in to comment.