Port project instance tests to Python 3
* Fix division: replace a/b with a//b to get integers * test_clean_file_upload_form_invalid_data(): use a byte string, not an unicode string for the test. The test ensures that decoding from UTF-8 fails. * quotas: replace filter() with a list-comprehesion to get a list on Python 3. * tox.ini: add the following tests to Python 3.4 - openstack_dashboard.dashboards.project.instances.tests - openstack_dashboard.test.tests.quotas * tox.ini: add also --exclude-dir=openstack_dashboard/test/integration_tests to openstack_dashboard tests on Python 3.4 Partial-Implements: blueprint porting-python3 Change-Id: I7caed713222b50ffec431155e6f91b543f7df466
This commit is contained in:
parent
e6e87aa55e
commit
49671ca4cf
@ -3417,7 +3417,7 @@ class InstanceTests(helpers.TestCase):
|
|||||||
'volume_type': 'volume_id',
|
'volume_type': 'volume_id',
|
||||||
'volume_id': volume_choice,
|
'volume_id': volume_choice,
|
||||||
'volume_size': max(
|
'volume_size': max(
|
||||||
image.min_disk, image.size / 1024 ** 3),
|
image.min_disk, image.size // 1024 ** 3),
|
||||||
'device_name': device_name,
|
'device_name': device_name,
|
||||||
'count': 1}
|
'count': 1}
|
||||||
|
|
||||||
@ -3556,7 +3556,7 @@ class InstanceTests(helpers.TestCase):
|
|||||||
def test_launch_form_instance_volume_size_error(self,
|
def test_launch_form_instance_volume_size_error(self,
|
||||||
test_with_profile=False):
|
test_with_profile=False):
|
||||||
image = self.images.get(name='protected_images')
|
image = self.images.get(name='protected_images')
|
||||||
volume_size = image.min_disk / 2
|
volume_size = image.min_disk // 2
|
||||||
msg = ("The Volume size is too small for the '%s' image" %
|
msg = ("The Volume size is too small for the '%s' image" %
|
||||||
image.name)
|
image.name)
|
||||||
self._test_launch_form_instance_volume_size(image, volume_size, msg,
|
self._test_launch_form_instance_volume_size(image, volume_size, msg,
|
||||||
@ -4439,7 +4439,7 @@ class InstanceTests(helpers.TestCase):
|
|||||||
|
|
||||||
def test_clean_file_upload_form_invalid_data(self):
|
def test_clean_file_upload_form_invalid_data(self):
|
||||||
t = workflows.create_instance.CustomizeAction(self.request, {})
|
t = workflows.create_instance.CustomizeAction(self.request, {})
|
||||||
upload_str = '\x81'
|
upload_str = b'\x81'
|
||||||
files = {'script_upload':
|
files = {'script_upload':
|
||||||
self.SimpleFile('script_name',
|
self.SimpleFile('script_name',
|
||||||
upload_str,
|
upload_str,
|
||||||
|
@ -326,7 +326,7 @@ def _get_tenant_network_usages(request, usages, disabled_quotas, tenant_id):
|
|||||||
routers = []
|
routers = []
|
||||||
routers = neutron.router_list(request)
|
routers = neutron.router_list(request)
|
||||||
if tenant_id:
|
if tenant_id:
|
||||||
routers = filter(lambda rou: rou.tenant_id == tenant_id, routers)
|
routers = [rou for rou in routers if rou.tenant_id == tenant_id]
|
||||||
usages.tally('routers', len(routers))
|
usages.tally('routers', len(routers))
|
||||||
|
|
||||||
|
|
||||||
|
6
tox.ini
6
tox.ini
@ -23,17 +23,18 @@ commands = /bin/bash run_tests.sh -N --no-pep8 {posargs}
|
|||||||
commands =
|
commands =
|
||||||
python manage.py test --settings=horizon.test.settings horizon.test.tests
|
python manage.py test --settings=horizon.test.settings horizon.test.tests
|
||||||
python manage.py test --settings=openstack_dashboard.test.settings \
|
python manage.py test --settings=openstack_dashboard.test.settings \
|
||||||
openstack_dashboard.dashboards.admin.metering \
|
--exclude-dir=openstack_dashboard/test/integration_tests \
|
||||||
openstack_dashboard.contrib.sahara.content.data_processing.data_sources.tests \
|
openstack_dashboard.contrib.sahara.content.data_processing.data_sources.tests \
|
||||||
openstack_dashboard.contrib.sahara.content.data_processing.job_binaries.tests \
|
openstack_dashboard.contrib.sahara.content.data_processing.job_binaries.tests \
|
||||||
openstack_dashboard.contrib.sahara.content.data_processing.jobs.tests \
|
openstack_dashboard.contrib.sahara.content.data_processing.jobs.tests \
|
||||||
openstack_dashboard.dashboards.admin.volumes.volumes.tests \
|
|
||||||
openstack_dashboard.dashboards.admin.aggregates \
|
openstack_dashboard.dashboards.admin.aggregates \
|
||||||
openstack_dashboard.dashboards.admin.metering \
|
openstack_dashboard.dashboards.admin.metering \
|
||||||
|
openstack_dashboard.dashboards.admin.volumes.volumes.tests \
|
||||||
openstack_dashboard.dashboards.identity.users \
|
openstack_dashboard.dashboards.identity.users \
|
||||||
openstack_dashboard.dashboards.project.access_and_security.api_access.tests \
|
openstack_dashboard.dashboards.project.access_and_security.api_access.tests \
|
||||||
openstack_dashboard.dashboards.project.images.images.tests.CreateImageFormTests \
|
openstack_dashboard.dashboards.project.images.images.tests.CreateImageFormTests \
|
||||||
openstack_dashboard.dashboards.project.images.tests.ImagesAndSnapshotsUtilsTests \
|
openstack_dashboard.dashboards.project.images.tests.ImagesAndSnapshotsUtilsTests \
|
||||||
|
openstack_dashboard.dashboards.project.instances \
|
||||||
openstack_dashboard.dashboards.project.networks.tests \
|
openstack_dashboard.dashboards.project.networks.tests \
|
||||||
openstack_dashboard.dashboards.project.overview.tests \
|
openstack_dashboard.dashboards.project.overview.tests \
|
||||||
openstack_dashboard.dashboards.project.stacks.tests.TemplateFormTests \
|
openstack_dashboard.dashboards.project.stacks.tests.TemplateFormTests \
|
||||||
@ -67,6 +68,7 @@ commands =
|
|||||||
openstack_dashboard.test.tests.error_pages \
|
openstack_dashboard.test.tests.error_pages \
|
||||||
openstack_dashboard.test.tests.policy \
|
openstack_dashboard.test.tests.policy \
|
||||||
openstack_dashboard.test.tests.policy_backend \
|
openstack_dashboard.test.tests.policy_backend \
|
||||||
|
openstack_dashboard.test.tests.quotas \
|
||||||
openstack_dashboard.test.tests.utils
|
openstack_dashboard.test.tests.utils
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
|
Loading…
Reference in New Issue
Block a user