Python3: do not use the 'file' type
It does not exist in Python 3, so we have to use a workaround. Change-Id: Ib41b5d12102707004b354835265861710aaba568 Closes-Bug: 1287728
This commit is contained in:
parent
4f9fc84118
commit
2df7840cfa
|
@ -17,6 +17,7 @@
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import six
|
||||
import subprocess
|
||||
import tempfile
|
||||
import testtools
|
||||
|
@ -30,6 +31,12 @@ import glanceclient.v1.shell as v1shell
|
|||
|
||||
from tests import utils
|
||||
|
||||
if six.PY3:
|
||||
import io
|
||||
file_type = io.IOBase
|
||||
else:
|
||||
file_type = file
|
||||
|
||||
fixtures = {
|
||||
'/v1/images/96d2c7e1-de4e-4612-8aa2-ba26610c804e': {
|
||||
'PUT': (
|
||||
|
@ -402,7 +409,7 @@ class ShellStdinHandlingTests(testtools.TestCase):
|
|||
self._do_update('44d2c7e1-de4e-4612-8aa2-ba26610c444f')
|
||||
|
||||
self.assertTrue('data' in self.collected_args[1])
|
||||
self.assertIsInstance(self.collected_args[1]['data'], file)
|
||||
self.assertIsInstance(self.collected_args[1]['data'], file_type)
|
||||
self.assertEqual(self.collected_args[1]['data'].read(),
|
||||
'Some Data')
|
||||
|
||||
|
@ -427,7 +434,7 @@ class ShellStdinHandlingTests(testtools.TestCase):
|
|||
self._do_update('44d2c7e1-de4e-4612-8aa2-ba26610c444f')
|
||||
|
||||
self.assertTrue('data' in self.collected_args[1])
|
||||
self.assertIsInstance(self.collected_args[1]['data'], file)
|
||||
self.assertIsInstance(self.collected_args[1]['data'], file_type)
|
||||
self.assertEqual(self.collected_args[1]['data'].read(),
|
||||
'Some Data\n')
|
||||
|
||||
|
|
Loading…
Reference in New Issue