Merge "Fix broken UTs for python3"

This commit is contained in:
Jenkins 2015-07-07 13:28:04 +00:00 committed by Gerrit Code Review
commit 0efe815a63
3 changed files with 8 additions and 4 deletions

View File

@ -563,8 +563,8 @@ class ListObjectMixin(object):
"""List count of value occurrences"""
return self.objects.count(value)
def sort(self, cmp=None, key=None, reverse=False):
self.objects.sort(cmp=cmp, key=key, reverse=reverse)
def sort(self, key=None, reverse=False):
self.objects.sort(key=key, reverse=reverse)
def obj_what_changed(self):
changes = set(self._obj_changes)

View File

@ -13,6 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import six
from oslo_config import cfg
from designate import exceptions
@ -108,7 +109,10 @@ class MemcachePoolManagerCache(cache_base.PoolManagerCache):
action=pool_manager_status.action,
tail=tail
)
return key.encode('utf-8')
if six.PY2:
return key.encode('utf-8')
else:
return key
def _build_serial_number_key(self, pool_manager_status):
return self._status_key(pool_manager_status, 'serial_number')

View File

@ -26,4 +26,4 @@ class Bind9Test(TestCase):
def test_bind9_zone_ends_with_empty_line(self):
name = ['templates', 'bind9-zone.jinja2']
resource_string = utils.resource_string(*name)
self.assertEqual('\n\n', resource_string[-2:])
self.assertEqual(b'\n\n', resource_string[-2:])