Commit 58c1456d authored by Sebastien Robin's avatar Sebastien Robin

unicode strings were coming from json, use utf8 strings instead to avoid rmtree errors

parent fa309128
......@@ -474,6 +474,5 @@ branch = foo
non_ascii_file = open(os.path.join(controler.software_root, file_name), 'w')
non_ascii_file.close()
self.assertEquals([file_name], os.listdir(controler.software_root))
controler.software_root = unicode(controler.software_root)
controler._resetSoftware()
self.assertEquals([], os.listdir(controler.software_root))
......@@ -81,9 +81,6 @@ def main(*args):
for key in ('slapos_directory', 'working_directory', 'test_suite_directory',
'log_directory', 'run_directory'):
d = CONFIG[key]
if isinstance(d, unicode):
d = d.encode('utf8')
CONFIG[key] = d
if not os.path.isdir(d):
raise ValueError('Directory %r does not exists.' % d)
CONFIG['master_url'] = 'http://%s:%s' % (CONFIG['proxy_host'],
......
......@@ -63,6 +63,21 @@ class SlapOSInstance(object):
def _checkData(self):
pass
def deunicodeData(data):
if isinstance(data, list):
new_data = []
for sub_data in data:
new_data.append(deunicodeData(sub_data))
elif isinstance(data, unicode):
new_data = data.encode('utf8')
elif isinstance(data, dict):
new_data = {}
for key, value in data.iteritems():
key = deunicodeData(key)
value = deunicodeData(value)
new_data[key] = value
return new_data
class NodeTestSuite(SlapOSInstance):
def __init__(self, reference):
......@@ -344,7 +359,7 @@ branch = %(branch)s
portal = taskdistribution.TaskDistributionTool(portal_url, logger=DummyLogger(log))
test_suite_portal = taskdistribution.TaskDistributor(portal_url, logger=DummyLogger(log))
test_suite_json = test_suite_portal.startTestSuite(config['test_node_title'])
test_suite_data = json.loads(test_suite_json)
test_suite_data = deunicodeData(json.loads(test_suite_json))
log("Got following test suite data from master : %r" % \
(test_suite_data,))
#Clean-up test suites
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment