Merge "Fix Python 3 issues in glance.tests.unit.common"
This commit is contained in:
commit
ac23bd2620
@ -40,13 +40,13 @@ class TestPasteApp(test_utils.BaseTestCase):
|
||||
paste_append=None):
|
||||
|
||||
def _writeto(path, str):
|
||||
with open(path, 'wb') as f:
|
||||
with open(path, 'w') as f:
|
||||
f.write(str or '')
|
||||
f.flush()
|
||||
|
||||
def _appendto(orig, copy, str):
|
||||
shutil.copy(orig, copy)
|
||||
with open(copy, 'ab') as f:
|
||||
with open(copy, 'a') as f:
|
||||
f.write(str or '')
|
||||
f.flush()
|
||||
|
||||
|
@ -68,7 +68,7 @@ class TestLocationStrategy(base.IsolatedUnitTest):
|
||||
|
||||
loaded_modules = location_strategy._load_strategies()
|
||||
self.assertEqual(1, len(loaded_modules))
|
||||
self.assertEqual('module_name', loaded_modules.keys()[0])
|
||||
self.assertIn('module_name', loaded_modules)
|
||||
# Skipped module #2, duplicated one.
|
||||
self.assertEqual('module1', loaded_modules['module_name'].__name__)
|
||||
|
||||
@ -98,7 +98,7 @@ class TestLocationStrategy(base.IsolatedUnitTest):
|
||||
|
||||
loaded_modules = location_strategy._load_strategies()
|
||||
self.assertEqual(1, len(loaded_modules))
|
||||
self.assertEqual('module_good', loaded_modules.keys()[0])
|
||||
self.assertIn('module_good', loaded_modules)
|
||||
# Skipped module #1, initialize failed one.
|
||||
self.assertEqual('module_good', loaded_modules['module_good'].__name__)
|
||||
|
||||
|
@ -60,7 +60,7 @@ class SemVerTestCase(test_utils.BaseTestCase):
|
||||
semver_db.parse("1.1.1-0.11.z.24.y.255").__composite_values__()[1],
|
||||
semver_db.parse("1.1.1-1.11.z.24.y.255").__composite_values__()[1],
|
||||
semver_db.parse("1.1.1-alp.1.2.3.4.5.6").__composite_values__()[1]]
|
||||
for i in xrange(len(versions) - 1):
|
||||
for i in range(len(versions) - 1):
|
||||
self.assertLess(versions[i], versions[i + 1])
|
||||
|
||||
def test_too_large_version(self):
|
||||
|
3
tox.ini
3
tox.ini
@ -19,8 +19,11 @@ downloadcache = ~/cache/pip
|
||||
commands =
|
||||
python -m testtools.run \
|
||||
glance.tests.unit.common.test_client \
|
||||
glance.tests.unit.common.test_config \
|
||||
glance.tests.unit.common.test_exception \
|
||||
glance.tests.unit.common.test_property_utils \
|
||||
glance.tests.unit.common.test_scripts \
|
||||
glance.tests.unit.common.test_semver \
|
||||
glance.tests.unit.common.test_swift_store_utils \
|
||||
glance.tests.unit.test_artifact_type_definition_framework \
|
||||
glance.tests.unit.test_artifacts_plugin_loader \
|
||||
|
Loading…
x
Reference in New Issue
Block a user