You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/09/06 15:56:56 UTC
[2/2] git commit: Use with, fix test.
Use with, fix test.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3fb2097f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3fb2097f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3fb2097f
Branch: refs/heads/trunk
Commit: 3fb2097f73ad538f6889911ff47da73861eb8509
Parents: 49a9caf
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Sep 6 15:47:32 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Sep 6 15:47:32 2013 +0200
----------------------------------------------------------------------
libcloud/test/compute/test_ec2.py | 10 +++++++---
libcloud/test/storage/test_cloudfiles.py | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fb2097f/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 22d1cc5..840a786 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -12,6 +12,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+from __future__ import with_statement
+
import os
import sys
@@ -339,9 +342,10 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
def test_ex_import_keypair_from_string(self):
path = os.path.join(os.path.dirname(__file__), "fixtures", "misc", "dummy_rsa.pub")
- fh = open(path)
- key = self.driver.ex_import_keypair_from_string('keypair', fh.read())
- fh.close()
+
+ with open(path, 'r') as fh:
+ key = self.driver.ex_import_keypair_from_string('keypair', fh.read())
+
self.assertEqual(key['keyName'], 'keypair')
self.assertEqual(key['keyFingerprint'], null_fingerprint)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fb2097f/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index 56e6293..703b012 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -671,7 +671,7 @@ class CloudFilesTests(unittest.TestCase):
self.assertEqual(func_args[0], "/" + container.name + "/" + object_name)
self.assertEqual(func_kwargs["headers"]["X-Object-Manifest"],
container.name + "/" + object_name + "/")
- self.assertEqualEqual(func_kwargs["method"], "PUT")
+ self.assertEqual(func_kwargs["method"], "PUT")
def test__upload_object_manifest_wrong_hash(self):
fake_response = type('CloudFilesResponse', (), {'headers':