summaryrefslogtreecommitdiff
path: root/trove/tests/unittests/taskmanager/test_models.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2016-05-26 16:29:51 +0200
committerVictor Stinner <vstinner@redhat.com>2016-05-30 10:47:26 +0200
commit61614653d6b35b3d6b4c8802c737c02cb9968f4a (patch)
tree0a89c6bbea03ad559617be2b1359ed157b6980b2 /trove/tests/unittests/taskmanager/test_models.py
parentf9df5af18dce3a1aad80de9cae56cb7d47ff5b33 (diff)
downloadtrove-61614653d6b35b3d6b4c8802c737c02cb9968f4a.tar.gz
Port more unit tests to Python 3
* Replace string.find(a, b) with a.find(b) * NamedTemporaryFile: open file in text mode rather than opening it in binary mode. * Module.process_contents(): if contents is a Unicode string, first encode it to UTF-8 before hashing the content to MD5. * ClusterController: replace dict.items()[0] with next(iter(dict.items())) * tox: run the following tests on Python 3.4 - mysql/test_common.py - taskmanager/test_models.py - module/test_module_models.py - test_cluster_controller.py Partially implements: blueprint trove-python3 Change-Id: I5372520f9717b4f0279c4b436ca88c160ddf894b
Diffstat (limited to 'trove/tests/unittests/taskmanager/test_models.py')
-rw-r--r--trove/tests/unittests/taskmanager/test_models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/trove/tests/unittests/taskmanager/test_models.py b/trove/tests/unittests/taskmanager/test_models.py
index 1698e6e0..a385a7f5 100644
--- a/trove/tests/unittests/taskmanager/test_models.py
+++ b/trove/tests/unittests/taskmanager/test_models.py
@@ -193,10 +193,11 @@ class FreshInstanceTasksTest(trove_testtools.TestCase):
self.orig_DBI_find_by = DBInstance.find_by
self.userdata = "hello moto"
self.guestconfig_content = "guest config"
- with NamedTemporaryFile(suffix=".cloudinit", delete=False) as f:
+ with NamedTemporaryFile(mode="w", suffix=".cloudinit",
+ delete=False) as f:
self.cloudinit = f.name
f.write(self.userdata)
- with NamedTemporaryFile(delete=False) as f:
+ with NamedTemporaryFile(mode="w", delete=False) as f:
self.guestconfig = f.name
f.write(self.guestconfig_content)
self.freshinstancetasks = taskmanager_models.FreshInstanceTasks(