Update "data" to bytes object
The param "data" in f.write(data) should be bytes. Change-Id: Icbf9463c6f406df9cf25a8cf637b0173387582c5
This commit is contained in:
parent
19aae78daf
commit
58cb979a40
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
@ -44,8 +43,6 @@ class TestUtils(unittest.TestCase):
|
|||||||
temp.close()
|
temp.close()
|
||||||
self.assertFalse(os.path.exists(temp.name))
|
self.assertFalse(os.path.exists(temp.name))
|
||||||
|
|
||||||
# @unittest.skipIf(sys.version_info.major == 3,
|
|
||||||
# 'Not supported on python v 3.x')
|
|
||||||
def test_find_config_files_path(self):
|
def test_find_config_files_path(self):
|
||||||
temp = tempfile.NamedTemporaryFile('wb', delete=True,
|
temp = tempfile.NamedTemporaryFile('wb', delete=True,
|
||||||
suffix='.conf')
|
suffix='.conf')
|
||||||
@ -55,12 +52,10 @@ class TestUtils(unittest.TestCase):
|
|||||||
temp.close()
|
temp.close()
|
||||||
self.assertFalse(os.path.exists(temp.name))
|
self.assertFalse(os.path.exists(temp.name))
|
||||||
|
|
||||||
@unittest.skipIf(sys.version_info.major == 3,
|
|
||||||
'Not supported on python v 3.x')
|
|
||||||
def test_get_jobs_from_disk(self):
|
def test_get_jobs_from_disk(self):
|
||||||
temp = tempfile.mkdtemp()
|
temp = tempfile.mkdtemp()
|
||||||
file = '/'.join([temp, "test.conf"])
|
file = '/'.join([temp, "test.conf"])
|
||||||
data = '{"job_id": "test"}'
|
data = b'{"job_id": "test"}'
|
||||||
with open(file, 'wb') as f:
|
with open(file, 'wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
ret = utils.get_jobs_from_disk(temp)
|
ret = utils.get_jobs_from_disk(temp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user