11502: Use os.path.join instead of formatting path-like strings on tests.
authorLucas Di Pentima <lucas@curoverse.com>
Tue, 18 Apr 2017 16:45:39 +0000 (13:45 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Tue, 18 Apr 2017 16:45:39 +0000 (13:45 -0300)
sdk/python/tests/test_arv_get.py

index afbe634b12d8439800ff01c24478b7e984cc64f3..8be528fe6ebbb8f36579c2d6d6866895c55a4195 100644 (file)
@@ -70,11 +70,11 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers):
         # Download the entire collection to the temp directory
         r = self.run_get(["{}/".format(self.col_loc), self.tempdir])
         self.assertEqual(0, r)
-        with open("{}/foo.txt".format(self.tempdir), "r") as f:
+        with open(os.path.join(self.tempdir, "foo.txt"), "r") as f:
             self.assertEqual("foo", f.read())
-        with open("{}/bar.txt".format(self.tempdir), "r") as f:
+        with open(os.path.join(self.tempdir, "bar.txt"), "r") as f:
             self.assertEqual("bar", f.read())
-        with open("{}/subdir/baz.txt".format(self.tempdir), "r") as f:
+        with open(os.path.join(self.tempdir, "subdir", "baz.txt"), "r") as f:
             self.assertEqual("baz", f.read())
 
     def test_get_collection_unstripped_manifest(self):
@@ -99,12 +99,12 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers):
         # Get the collection manifest by UUID
         r = self.run_get(['--strip-manifest', col_loc, self.tempdir])
         self.assertEqual(0, r)
-        with open("{}/{}".format(self.tempdir, col_loc), "r") as f:
+        with open(os.path.join(self.tempdir, col_loc), "r") as f:
             self.assertEqual(col_manifest, f.read())
         # Get the collection manifest by PDH
         r = self.run_get(['--strip-manifest', col_pdh, self.tempdir])
         self.assertEqual(0, r)
-        with open("{}/{}".format(self.tempdir, col_pdh), "r") as f:
+        with open(os.path.join(self.tempdir, col_pdh), "r") as f:
             self.assertEqual(col_manifest, f.read())
 
     def test_invalid_collection(self):
@@ -126,10 +126,10 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers):
     def test_preexistent_destination(self):
         # Asking to place a file with the same path as a local one should
         # generate an error and avoid overwrites.
-        with open("{}/foo.txt".format(self.tempdir), "w") as f:
+        with open(os.path.join(self.tempdir, "foo.txt"), "w") as f:
             f.write("another foo")
         r = self.run_get(["{}/foo.txt".format(self.col_loc), self.tempdir])
         self.assertNotEqual(0, r)
-        with open("{}/foo.txt".format(self.tempdir), "r") as f:
+        with open(os.path.join(self.tempdir, "foo.txt"), "r") as f:
             self.assertEqual("another foo", f.read())